Re: Linux 2.6.7

Andrew Morton
2004-06-18T04:37:24Z

Sean Neakums <sneakums@zork.net> wrote:
>
> The 2.6.7 I built seems kind of swap-happy, apparently triggered by an
> overnight updatedb run. I think this also happened with
> 2.6.7-rc3-mm2.

There were corrections to logic errors in the vm scanner which will cause
increased pageout.

> I can't seem to find anything particularly out of the
> ordinary in the information below. I started off with swappiness set
> to 50 as I have for a while and dropped it twice by ten each time
> after a swapoff/swapon. It starts paging stuff out again pretty fast
> after it gets the swap back. Swap is is a dm-crypt device map.

swapoff/swapon doesn't do what you think it does. The pages are read from
the swap device, have the ptes reattached but the pages are placed on the
inactive list, from where they will be swapped out again very easily after
a swapon.

Which is really the correct behaviour: if these pages were earlier swapped
out then clearly they are the right ones to swap out when swap again
becomes available.

But that doesn't seem very important, and the old swapoff/swapon trick is
useful, so...

--- 25/mm/swapfile.c~swapoff-activate-pages 2004-06-17 21:27:41.704568280 -0700
+++ 25-akpm/mm/swapfile.c 2004-06-17 21:28:35.417402688 -0700
@@ -467,6 +467,13 @@ static unsigned long unuse_pmd(struct vm
if (unlikely(pte_same(*pte, swp_pte))) {
unuse_pte(vma, offset + address, pte, entry, page);
pte_unmap(pte);
+
+ /*
+ * Move the page to the active list so it is not
+ * immediately swapped out again after swapon.
+ */
+ activate_page(page);
+
/* add 1 since address may be 0 */
return 1 + offset + address;
}
_