linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Warn if we run out of swap space
@ 2009-05-22 18:58 Christoph Lameter
  2009-05-22 20:47 ` Pavel Machek
                   ` (3 more replies)
  0 siblings, 4 replies; 34+ messages in thread
From: Christoph Lameter @ 2009-05-22 18:58 UTC (permalink / raw)
  To: akpm; +Cc: linux-mm, Pavel Machek, Dave Hansen


Subject: Warn if we run out of swap space

Running out of swap space means that the evicton of anonymous pages may no longer
be possible which can lead to OOM conditions.

Print a warning when swap space first becomes exhausted.

Signed-off-by: Christoph Lameter <cl@linux-foundation.org>

---
 mm/swapfile.c |    5 +++++
 1 file changed, 5 insertions(+)

Index: linux-2.6/mm/swapfile.c
===================================================================
--- linux-2.6.orig/mm/swapfile.c	2009-05-22 12:25:19.000000000 -0500
+++ linux-2.6/mm/swapfile.c	2009-05-22 13:56:10.000000000 -0500
@@ -380,6 +380,7 @@ swp_entry_t get_swap_page(void)
 	pgoff_t offset;
 	int type, next;
 	int wrapped = 0;
+	static int printed = 0;

 	spin_lock(&swap_lock);
 	if (nr_swap_pages <= 0)
@@ -410,6 +411,10 @@ swp_entry_t get_swap_page(void)
 	}

 	nr_swap_pages++;
+	if (!printed) {
+		printed = 1;
+		printk(KERN_WARNING "All of swap is in use. Some pages cannot be swapped out.");
+	}
 noswap:
 	spin_unlock(&swap_lock);
 	return (swp_entry_t) {0};

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 34+ messages in thread

end of thread, other threads:[~2009-06-04  6:02 UTC | newest]

Thread overview: 34+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-05-22 18:58 [PATCH] Warn if we run out of swap space Christoph Lameter
2009-05-22 20:47 ` Pavel Machek
2009-05-23  4:38 ` Andrew Morton
2009-05-25  0:53   ` KAMEZAWA Hiroyuki
2009-05-24 13:44 ` KOSAKI Motohiro
2009-05-25  2:42   ` Randy Dunlap
2009-05-26  0:40     ` KOSAKI Motohiro
2009-05-26  1:05       ` Randy Dunlap
2009-05-26  1:08         ` KOSAKI Motohiro
2009-05-26  3:29     ` Paul Mundt
2009-05-26 14:23       ` Christoph Lameter
2009-05-26 20:15         ` Andrew Morton
2009-05-26 20:45           ` Randy Dunlap
2009-05-26 20:55             ` Andrew Morton
2009-05-27  0:25               ` KAMEZAWA Hiroyuki
2009-05-26 20:54           ` Christoph Lameter
2009-05-26 21:01             ` Andrew Morton
2009-05-26 21:05               ` Christoph Lameter
2009-05-27  0:42         ` KAMEZAWA Hiroyuki
2009-05-27 13:54           ` Christoph Lameter
2009-06-04  6:02             ` KOSAKI Motohiro
2009-06-01 16:19 ` Avi Kivity
2009-06-01 17:29   ` Christoph Lameter
2009-06-01 17:38     ` Avi Kivity
2009-06-01 19:35   ` Andrew Morton
2009-06-01 19:44     ` Avi Kivity
2009-06-02  9:14       ` Pavel Machek
2009-06-02  9:19         ` Avi Kivity
2009-06-02  9:15       ` Pavel Machek
2009-06-02  9:21         ` Avi Kivity
2009-06-02  9:30           ` Pavel Machek
2009-06-02  9:50             ` Avi Kivity
2009-06-02  9:23         ` Avi Kivity
2009-06-02  9:26           ` Pavel Machek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox