linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Randy Dunlap <randy.dunlap@oracle.com>,
	cl@linux.com, lethal@linux-sh.org,
	kosaki.motohiro@jp.fujitsu.com, linux-mm@kvack.org, pavel@ucw.cz,
	dave@linux.vnet.ibm.com
Subject: Re: [PATCH] Warn if we run out of swap space
Date: Wed, 27 May 2009 09:25:40 +0900	[thread overview]
Message-ID: <20090527092540.2a023168.kamezawa.hiroyu@jp.fujitsu.com> (raw)
In-Reply-To: <20090526135527.750e7df2.akpm@linux-foundation.org>

On Tue, 26 May 2009 13:55:27 -0700
Andrew Morton <akpm@linux-foundation.org> wrote:

> On Tue, 26 May 2009 13:45:13 -0700
> Randy Dunlap <randy.dunlap@oracle.com> wrote:
> 
> > Andrew Morton wrote:
> > > On Tue, 26 May 2009 10:23:36 -0400 (EDT)
> > > Christoph Lameter <cl@linux.com> wrote:
> > > 
> > >> @@ -410,6 +412,11 @@ swp_entry_t get_swap_page(void)
> > >>  	}
> > >>
> > >>  	nr_swap_pages++;
> > >> +	if (!out_of_swap_message_printed) {
> > >> +		out_of_swap_message_printed = 1;
> > >> +		printk(KERN_WARNING "All of swap is in use. Some pages "
> > >> +			"cannot be swapped out.\n");
> > >> +	}
> > >>  noswap:
> > >>  	spin_unlock(&swap_lock);
> > >>  	return (swp_entry_t) {0};
> > >> Index: linux-2.6/mm/vmscan.c
> > >> ===================================================================
> > >> --- linux-2.6.orig/mm/vmscan.c	2009-05-26 09:06:03.000000000 -0500
> > >> +++ linux-2.6/mm/vmscan.c	2009-05-26 09:20:30.000000000 -0500
> > >> @@ -1945,6 +1945,15 @@ out:
> > >>  		goto loop_again;
> > >>  	}
> > >>
> > >> +	/*
> > >> +	 * If we had an out of swap condition but things have improved then
> > >> +	 * reset the flag so that we print the message again when we run
> > >> +	 * out of swap again.
> > >> +	 */
> > >> +#ifdef CONFIG_SWAP
> > >> +	if (out_of_swap_message_printed && !vm_swap_full())
> > >> +		out_of_swap_message_printed = 0;
> > >> +#endif
> > >>  	return sc.nr_reclaimed;
> > >>  }
> > > 
> > > I still worry that there may be usage patterns which will result in
> > > this message coming out many times.
> > 
> > and using printk_ratelimit() or printk_timed_ratelimit() would be OK or not?
> 
> Well...  it would help.  We'd then get the same thing in the logs
> thousands of times rather than hundreds of thousands of times.
> 
> 
> But what's wrong with printing the thing just once, and not printing it
> again until after someone ran swapon or swapoff?  I think that matches up
> with the operator's actions pretty closely?
> 
IMHO, when the system is used every day without reboot and shared by users,
following behavior can be shown.

Monday   : UserA uses.
Tuesday  : UserA uses
Wednesday: UserA uses and near to swap full.
Thursday : UserB uses
Friday   : UserB uses and near to swap full.

If the appliation can be changed while the system is alive, multiple message is
not very bad. And...I don't think swapon/swapoff is usual operation for users.

Anyway, I think vm_swap_full() does all necessary work as Christoph explained in
other thread.

Reviewed-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>

Thanks,
-Kame






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

  reply	other threads:[~2009-05-27  0:26 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-05-22 18:58 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 [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090527092540.2a023168.kamezawa.hiroyu@jp.fujitsu.com \
    --to=kamezawa.hiroyu@jp.fujitsu.com \
    --cc=akpm@linux-foundation.org \
    --cc=cl@linux.com \
    --cc=dave@linux.vnet.ibm.com \
    --cc=kosaki.motohiro@jp.fujitsu.com \
    --cc=lethal@linux-sh.org \
    --cc=linux-mm@kvack.org \
    --cc=pavel@ucw.cz \
    --cc=randy.dunlap@oracle.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox