[patch] swap_free overstimate {lowest,highest}_bit

Andrea Arcangeli (andrea@suse.de)
Mon, 9 Aug 1999 02:45:14 +0200 (CEST)


As Mark pointed out loong ago, swap_free enlarge our free-swap-windows
even if there are still reference to the swap entry. This partially breaks
the get_swap_page() optimization done by the lowest/highest bit. Also SCT
confirmed the bug when Mark pointed it out.

This is how I fixed the bug in 2.3.13-pre8:

--- 2.3.13-pre8-tmp/mm/swapfile.c.~1~ Thu Jul 22 01:07:28 1999
+++ 2.3.13-pre8-tmp/mm/swapfile.c Mon Aug 9 02:39:38 1999
@@ -126,15 +126,17 @@
offset = SWP_OFFSET(entry);
if (offset >= p->max)
goto bad_offset;
- if (offset < p->lowest_bit)
- p->lowest_bit = offset;
- if (offset > p->highest_bit)
- p->highest_bit = offset;
if (!p->swap_map[offset])
goto bad_free;
if (p->swap_map[offset] < SWAP_MAP_MAX) {
if (!--p->swap_map[offset])
+ {
+ if (offset < p->lowest_bit)
+ p->lowest_bit = offset;
+ if (offset > p->highest_bit)
+ p->highest_bit = offset;
nr_swap_pages++;
+ }
}
#ifdef DEBUG_SWAP
printk("DebugVM: swap_free(entry %08lx, count now %d)\n",

Andrea

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/