Re: [PATCH] Warn if we run out of swap space

Paul Mundt
2009-05-26T03:29:23Z

On Sun, May 24, 2009 at 07:42:02PM -0700, Randy Dunlap wrote:
> KOSAKI Motohiro wrote:
> >> + if (!printed) {
> >> + printed = 1;
> >> + printk(KERN_WARNING "All of swap is in use. Some pages cannot be swapped out.");
> >> + }
> >
> > Why don't you use WARN_ONCE()?
>
> Someone earlier in this patch thread (maybe Pavel?) commented that
> WARN_ONCE() would cause a stack dump and that would be too harsh,
> especially for users. I.e., just the message is needed here, not a
> stack dump.
>
Note that this is precisely what we have printk_once() for these days,
which will do what this patch is doing already. Of course if the variable
will be reset, then it is best left as is.