[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Pine.LNX.4.64.0612110855380.500@schroedinger.engr.sgi.com>
Date: Mon, 11 Dec 2006 09:13:11 -0800 (PST)
From: Christoph Lameter <clameter@....com>
To: Andrew Morton <akpm@...l.org>
cc: Paul Jackson <pj@....com>, Jay Cliburn <jacliburn@...lsouth.net>,
linux-kernel@...r.kernel.org
Subject: Re: [BUG] commit 3c517a61, slab: better fallback allocation behavior
On Sun, 10 Dec 2006, Andrew Morton wrote:
> > I fixed the cpuset_zone_allowed() call from fallback_alloc() to avoid
> > sleeping. Notice the __GFP_HARDWALL added in Linus's version, or the
> > new function cpuset_zone_allowed_hardwall() in Andrew's version, all
> > done in the last week.
> >
> > But apparently kmem_getpages() can also sleep, as it calls __alloc_pages().
Yes fallback_alloc calls kmem_getpages() and if one does not set the gfp
flags properly __alloc_pages will sleep. fallback_alloc() uses the passed
flags so if kmem_cache_alloc is called with the proper flags set then
__alloc_pages() will not sleep.
In this case kmem_cache_alloc() is called from
journal_alloc_journal_head() with GFP_NOFS set which is
#define GFP_NOFS (__GFP_WAIT | __GFP_IO)
__GFP_WAIT means
#define __GFP_WAIT ((__force gfp_t)0x10u) /* Can wait and reschedule? */
Thus the caller allows __alloc_pages to sleep.
/*
* journal_head splicing and dicing
*/
static struct journal_head *journal_alloc_journal_head(void)
{
struct journal_head *ret;
static unsigned long last_warning;
#ifdef CONFIG_JBD_DEBUG
atomic_inc(&nr_journal_heads);
#endif
ret = kmem_cache_alloc(journal_head_cache, GFP_NOFS);
if (ret == 0) {
jbd_debug(1, "out of memory for journal_head\n");
if (time_after(jiffies, last_warning + 5*HZ)) {
printk(KERN_NOTICE "ENOMEM in %s, retrying.\n",
__FUNCTION__);
last_warning = jiffies;
}
while (ret == 0) {
yield();
ret = kmem_cache_alloc(journal_head_cache,
GFP_NOFS);
}
}
return ret;
}
-
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