[PATCH] swap: freeing update swap_list.next
This makes negligible difference in practice: but swap_list.next should not be
updated to a higher prio in the general helper swap_info_get, but rather in
swap_entry_free; and then only in the case when entry is actually freed.
Signed-off-by: Hugh Dickins <hugh@veritas.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
diff --git a/mm/swapfile.c b/mm/swapfile.c
index 6cc6dfb..62e0da8 100644
--- a/mm/swapfile.c
+++ b/mm/swapfile.c
@@ -215,8 +215,6 @@
if (!p->swap_map[offset])
goto bad_free;
swap_list_lock();
- if (p->prio > swap_info[swap_list.next].prio)
- swap_list.next = type;
swap_device_lock(p);
return p;
@@ -253,6 +251,8 @@
p->lowest_bit = offset;
if (offset > p->highest_bit)
p->highest_bit = offset;
+ if (p->prio > swap_info[swap_list.next].prio)
+ swap_list.next = p - swap_info;
nr_swap_pages++;
p->inuse_pages--;
}