[2.4] heavy-load under swap space shortage

j-nomura
2004-02-02T10:13:05Z

Hello,

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.

swap_out()
..
try_to_swap_out()
..
entry = get_swap_page()
/* find no swap page available */

How about checking nr_swap_pages first and giving up if it's 0?
Applying the patch below extremely reduced systime consumption by swap_out
under swap space shortage.

Systems without swap also suffer from the same problem.

Any comments?

Best regards.
--
NOMURA, Jun'ichi <j-nomura@ce.jp.nec.com>

--- linux-2.4.24/mm/vmscan.c
+++ linux/mm/vmscan.c
@@ -326,8 +326,11 @@ out_unlock:
static int swap_out(zone_t * classzone)
{
int counter, nr_pages = SWAP_CLUSTER_MAX;
struct mm_struct *mm;
+
+ if (nr_swap_pages <= 0)
+ return 0;

counter = mmlist_nr << 1;
do {
if (unlikely(current->need_resched)) {