[PATCH 07/13] freeing update swap_list.next

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 <[email protected]>
---

 mm/swapfile.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

--- swap6/mm/swapfile.c	2005-07-08 19:14:26.000000000 +0100
+++ swap7/mm/swapfile.c	2005-07-08 19:14:39.000000000 +0100
@@ -213,8 +213,6 @@ static struct swap_info_struct * swap_in
 	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;
 
@@ -251,6 +249,8 @@ static int swap_entry_free(struct swap_i
 				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--;
 		}
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]
  Powered by Linux