From: Dave Chinner <david@fromorbit.com>
To: "Ricardo M. Correia" <ricardo.correia@oracle.com>
Cc: linux-mm@kvack.org, linux-fsdevel@vger.kernel.org,
Brian Behlendorf <behlendorf1@llnl.gov>,
Andreas Dilger <andreas.dilger@oracle.com>
Subject: Re: Propagating GFP_NOFS inside __vmalloc()
Date: Thu, 11 Nov 2010 09:10:38 +1100 [thread overview]
Message-ID: <20101110221038.GX2715@dastard> (raw)
In-Reply-To: <1289424955.11149.73.camel@oralap>
On Wed, Nov 10, 2010 at 10:35:55PM +0100, Ricardo M. Correia wrote:
> On Wed, 2010-11-10 at 21:42 +0100, Ricardo M. Correia wrote:
> > Hi,
> >
> > As part of Lustre filesystem development, we are running into a
> > situation where we (sporadically) need to call into __vmalloc() from a
> > thread that processes I/Os to disk (it's a long story).
> >
> > In general, this would be fine as long as we pass GFP_NOFS to
> > __vmalloc(), but the problem is that even if we pass this flag, vmalloc
> > itself sometimes allocates memory with GFP_KERNEL.
>
> By the way, it seems that existing users in Linus' tree may be
> vulnerable to the same bug that we experienced:
>
> In GFS:
> 8 1253 fs/gfs2/dir.c <<gfs2_alloc_sort_buffer>>
> ptr = __vmalloc(size, GFP_NOFS, PAGE_KERNEL);
>
> The Ceph filesystem:
> 20 22 net/ceph/buffer.c <<ceph_buffer_new>>
> b->vec.iov_base = __vmalloc(len, gfp, PAGE_KERNEL);
> .. which can be called from:
> 3 560 fs/ceph/inode.c <<fill_inode>>
> xattr_blob = ceph_buffer_new(iinfo->xattr_len, GFP_NOFS);
>
> In the MM code:
> 18 5184 mm/page_alloc.c <<alloc_large_system_hash>>
> table = __vmalloc(size, GFP_ATOMIC, PAGE_KERNEL);
>
> All of these seem to be vulnerable to GFP_KERNEL allocations from within
> __vmalloc(), at least on x86-64 (as I've detailed below).
Hmmm. I'd say there's a definite possibility that vm_map_ram() as
called from in fs/xfs/linux-2.6/xfs_buf.c needs to use GFP_NOFS
allocation, too. Currently vm_map_ram() just uses GFP_KERNEL
internally, but is certainly being called in contexts where we don't
allow recursion (e.g. in a transaction) so probably should allow a
gfp mask to be passed in....
Cheers,
Dave.
--
Dave Chinner
david@fromorbit.com
prev parent reply other threads:[~2010-11-10 22:10 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1289421759.11149.59.camel@oralap>
2010-11-10 21:35 ` Propagating GFP_NOFS inside __vmalloc() Ricardo M. Correia
2010-11-10 22:10 ` Dave Chinner [this message]
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=20101110221038.GX2715@dastard \
--to=david@fromorbit.com \
--cc=andreas.dilger@oracle.com \
--cc=behlendorf1@llnl.gov \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=ricardo.correia@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;
as well as URLs for NNTP newsgroup(s).