Re: [2.4] heavy-load under swap space shortage

Hugh Dickins
2004-02-02T13:34:53Z

On Mon, 2 Feb 2004 j-nomura@ce.jp.nec.com wrote:
>
> swap_out() seems always trying scan even if there are no swap space available.
> This keeps CPU(s) busy with rare successful page-out and may cause lock
> contention in big smp system.
>...
> How about checking nr_swap_pages first and giving up if it's 0?

Sorry, no. Don't be misled by the name, swap_out() is used to free
all kinds of mapped pages, not just those which would end up on swap.
Your patch just disables freeing mapped pages under memory pressure.

You could try the untested patch below to swap_out_vma(), but I don't
really recommend it: it still skips freeing up a less common category
of clean pages, just when you'd most like to free them.

Hugh

--- 2.4.25-pre8/mm/vmscan.c 2004-01-30 13:41:14.000000000 +0000
+++ linux/mm/vmscan.c 2004-02-02 13:01:28.067918544 +0000
@@ -263,6 +263,14 @@
if (vma->vm_flags & VM_RESERVED)
return count;

+ /* If no swap, don't waste time on areas which need it */
+ if (nr_swap_pages <= 0) {
+ if (!vma->vm_ops ||
+ !vma->vm_ops->nopage ||
+ vma->vm_ops->nopage == shmem_nopage)
+ return count;
+ }
+
pgdir = pgd_offset(mm, address);

end = vma->vm_end;