[oom]: [4/4] check __GFP_WIRED in out_of_memory()

From: William Lee Irwin III
Date: Wed Jun 23 2004 - 16:13:27 EST


Index: linux-2.6.7/include/linux/swap.h
===================================================================
--- linux-2.6.7.orig/include/linux/swap.h 2004-06-16 05:18:55.000000000 +0000
+++ linux-2.6.7/include/linux/swap.h 2004-06-23 16:41:20.000000000 +0000
@@ -148,7 +148,7 @@
#define vm_swap_full() (nr_swap_pages*2 < total_swap_pages)

/* linux/mm/oom_kill.c */
-extern void out_of_memory(void);
+void out_of_memory(int gfp_mask);

/* linux/mm/memory.c */
extern void swapin_readahead(swp_entry_t, unsigned long, struct vm_area_struct *);
Index: linux-2.6.7/mm/oom_kill.c
===================================================================
--- linux-2.6.7.orig/mm/oom_kill.c 2004-06-16 05:19:29.000000000 +0000
+++ linux-2.6.7/mm/oom_kill.c 2004-06-23 16:41:58.000000000 +0000
@@ -220,7 +220,7 @@
/**
* out_of_memory - is the system out of memory?
*/
-void out_of_memory(void)
+void out_of_memory(int gfp_mask)
{
/*
* oom_lock protects out_of_memory()'s static variables.
@@ -233,7 +233,7 @@
/*
* Enough swap space left? Not OOM.
*/
- if (nr_swap_pages > 0)
+ if (!(gfp_mask & __GFP_WIRED) && nr_swap_pages > 0)
return;

spin_lock(&oom_lock);
Index: linux-2.6.7/mm/vmscan.c
===================================================================
--- linux-2.6.7.orig/mm/vmscan.c 2004-06-16 05:18:58.000000000 +0000
+++ linux-2.6.7/mm/vmscan.c 2004-06-23 16:42:12.000000000 +0000
@@ -944,7 +944,7 @@
blk_congestion_wait(WRITE, HZ/10);
}
if ((gfp_mask & __GFP_FS) && !(gfp_mask & __GFP_NORETRY))
- out_of_memory();
+ out_of_memory(gfp_mask);
out:
for (i = 0; zones[i] != 0; i++)
zones[i]->prev_priority = zones[i]->temp_priority;
-
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/