summaryrefslogtreecommitdiffstats
path: root/mm
diff options
context:
space:
mode:
authorHugh Dickins <hugh@veritas.com>2005-09-03 15:54:36 -0700
committerLinus Torvalds <torvalds@evo.osdl.org>2005-09-05 00:05:41 -0700
commit89d09a2c80ea6baafb559b86d545fada05e14ab5 (patch)
tree90ff3c2a62c144b93c89b33d66583046f1a7efae /mm
parent6eb396dc4a9781c5e7951143ab56ce5710687ab3 (diff)
downloadlinux-89d09a2c80ea6baafb559b86d545fada05e14ab5.tar.bz2
[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>
Diffstat (limited to 'mm')
-rw-r--r--mm/swapfile.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/mm/swapfile.c b/mm/swapfile.c
index 6cc6dfb4d27b..62e0da8f7e6e 100644
--- a/mm/swapfile.c
+++ b/mm/swapfile.c
@@ -215,8 +215,6 @@ static struct swap_info_struct * swap_info_get(swp_entry_t entry)
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 @@ static int swap_entry_free(struct swap_info_struct *p, unsigned long offset)
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--;
}