[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1302295413.7286.1133.camel@nimitz>
Date: Fri, 08 Apr 2011 13:43:33 -0700
From: Dave Hansen <dave@...ux.vnet.ibm.com>
To: David Rientjes <rientjes@...gle.com>
Cc: linux-mm@...ck.org, linux-kernel@...r.kernel.org,
Johannes Weiner <hannes@...xchg.org>
Subject: Re: [PATCH 1/2] break out page allocation warning code
On Fri, 2011-04-08 at 13:37 -0700, David Rientjes wrote:
> > +static DEFINE_RATELIMIT_STATE(nopage_rs,
> > + DEFAULT_RATELIMIT_INTERVAL,
> > + DEFAULT_RATELIMIT_BURST);
> > +
> > +void nopage_warning(gfp_t gfp_mask, int order, const char *fmt, ...)
>
> I suggest a different name for this, something like warn_alloc_failure()
> or such.
That works for me.
> I guess this isn't general enough where it could be used in the oom killer
> as well?
Nope, don't think so. I took a look at it, but it isn't horribly close
to this.
> > +{
> > + va_list args;
> > + int r;
> > + unsigned int filter = SHOW_MEM_FILTER_NODES;
> > + const gfp_t wait = gfp_mask & __GFP_WAIT;
> > +
> > + if ((gfp_mask & __GFP_NOWARN) || !__ratelimit(&nopage_rs))
> > + return;
> > +
> > + /*
> > + * This documents exceptions given to allocations in certain
> > + * contexts that are allowed to allocate outside current's set
> > + * of allowed nodes.
> > + */
> > + if (!(gfp_mask & __GFP_NOMEMALLOC))
> > + if (test_thread_flag(TIF_MEMDIE) ||
> > + (current->flags & (PF_MEMALLOC | PF_EXITING)))
> > + filter &= ~SHOW_MEM_FILTER_NODES;
> > + if (in_interrupt() || !wait)
> > + filter &= ~SHOW_MEM_FILTER_NODES;
> > +
> > + if (fmt) {
> > + printk(KERN_WARNING);
> > + va_start(args, fmt);
> > + r = vprintk(fmt, args);
> > + va_end(args);
> > + }
> > +
> > + printk(KERN_WARNING);
> > + printk("%s: page allocation failure: order:%d, mode:0x%x\n",
> > + current->comm, order, gfp_mask);
>
> This shouldn't be here, it should have been printed already.
The "page allocation failure" might have been, if it was specified (it
isn't from the allocator), but order and mode haven't been. My thought
here is that _all_ allocator failures will want to output mode and gfp,
so it might as well be common code instead of making everybody specify
it.
-- Dave
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists