From: Christoph Lameter <clameter@sgi.com>
To: Andrew Morton <akpm@osdl.org>
Cc: Paul Jackson <pj@sgi.com>, Jay Cliburn <jacliburn@bellsouth.net>,
linux-kernel@vger.kernel.org
Subject: Re: [BUG] commit 3c517a61, slab: better fallback allocation behavior
Date: Mon, 11 Dec 2006 09:13:11 -0800 (PST) [thread overview]
Message-ID: <Pine.LNX.4.64.0612110855380.500@schroedinger.engr.sgi.com> (raw)
In-Reply-To: <20061210141435.afac089d.akpm@osdl.org>
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;
}
next prev parent reply other threads:[~2006-12-11 17:13 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-12-10 19:49 Jay Cliburn
2006-12-10 20:49 ` Paul Jackson
2006-12-10 22:14 ` Andrew Morton
2006-12-11 17:13 ` Christoph Lameter [this message]
2006-12-11 17:37 ` Christoph Lameter
2006-12-11 19:41 ` Jay Cliburn
2006-12-12 18:57 ` Paul Jackson
2006-12-12 19:22 ` Christoph Lameter
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=Pine.LNX.4.64.0612110855380.500@schroedinger.engr.sgi.com \
--to=clameter@sgi.com \
--cc=akpm@osdl.org \
--cc=jacliburn@bellsouth.net \
--cc=linux-kernel@vger.kernel.org \
--cc=pj@sgi.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
all inboxes | Powered by JetHome®