[2.4] heavy-load under swap space shortage

From: j-nomura
Date: Mon Feb 02 2004 - 05:13:58 EST


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@xxxxxxxxxxxxx>

--- 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)) {

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