From: "Levin, Alexander (Sasha Levin)" <alexander.levin@verizon.com>
To: Michal Hocko <mhocko@kernel.org>
Cc: Andrew Morton <akpm@linux-foundation.org>,
"linux-mm@kvack.org" <linux-mm@kvack.org>,
LKML <linux-kernel@vger.kernel.org>,
John Hubbard <jhubbard@nvidia.com>,
Andreas Dilger <adilger@dilger.ca>,
Vlastimil Babka <vbabka@suse.cz>
Subject: Re: [PATCH 1/9] mm: introduce kv[mz]alloc helpers
Date: Fri, 2 Jun 2017 07:40:12 +0000 [thread overview]
Message-ID: <20170602074008.wctxj5il3rqnnpbf@sasha-lappy> (raw)
In-Reply-To: <20170602072855.GB29840@dhcp22.suse.cz>
On Fri, Jun 02, 2017 at 09:28:56AM +0200, Michal Hocko wrote:
> On Fri 02-06-17 07:17:22, Sasha Levin wrote:
> > On Mon, Mar 06, 2017 at 11:30:24AM +0100, Michal Hocko wrote:
> > > +void *kvmalloc_node(size_t size, gfp_t flags, int node)
> > > +{
> > > + gfp_t kmalloc_flags = flags;
> > > + void *ret;
> > > +
> > > + /*
> > > + * vmalloc uses GFP_KERNEL for some internal allocations (e.g page tables)
> > > + * so the given set of flags has to be compatible.
> > > + */
> > > + WARN_ON_ONCE((flags & GFP_KERNEL) != GFP_KERNEL);
> >
> > Hm, there are quite a few locations in the kernel that do something like:
> >
> > __vmalloc(len, GFP_NOFS, PAGE_KERNEL);
> >
> > According to your patch, vmalloc can't really do GFP_NOFS, right?
>
> Yes. It is quite likely that they will just work because the hardcoded
> GFP_KERNEL inside the vmalloc path is in unlikely paths (page table
> allocations for example) but yes they are broken. I didn't convert some
> places which opencode the kvmalloc with GFP_NOFS because I strongly
> _believe_ that the GFP_NOFS should be revisited, checked whether it is
> needed, documented if so and then memalloc_nofs__{save,restore} be used
> for the scope which is reclaim recursion unsafe. This would turn all
> those vmalloc users to the default GFP_KERNEL and still do the right
> thing.
While you haven't converted those paths, other folks have picked up
on that:
commit beeeccca9bebcec386cc31c250cff8a06cf27034
Author: Vinnie Magro <vmagro@fb.com>
Date: Thu May 25 12:18:02 2017 -0700
btrfs: Use kvzalloc instead of kzalloc/vmalloc in alloc_bitmap
[...]
Maybe we should make kvmalloc_node() fail non-GFP_KERNEL allocations
rather than just warn on them to make this error more evident? I'm not
sure how these warnings were missed during testing.
--
Thanks,
Sasha
next prev parent reply other threads:[~2017-06-02 7:40 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-03-06 10:30 [PATCH 0/6 v5] kvmalloc Michal Hocko
2017-03-06 10:30 ` [PATCH 1/9] mm: introduce kv[mz]alloc helpers Michal Hocko
2017-06-02 7:17 ` Levin, Alexander (Sasha Levin)
2017-06-02 7:28 ` Michal Hocko
2017-06-02 7:40 ` Levin, Alexander (Sasha Levin) [this message]
2017-06-02 7:50 ` Michal Hocko
2017-03-06 10:30 ` [PATCH 2/9] mm: support __GFP_REPEAT in kvmalloc_node for >32kB Michal Hocko
2017-04-07 0:45 ` Shakeel Butt
2017-04-07 7:40 ` Michal Hocko
2017-03-06 10:30 ` [PATCH 3/9] rhashtable: simplify a strange allocation pattern Michal Hocko
2017-03-06 10:30 ` [PATCH 4/9] ila: " Michal Hocko
2017-03-06 10:33 ` [PATCH 5/9] xattr: zero out memory copied to userspace in getxattr Michal Hocko
2017-03-06 10:33 ` [PATCH 6/9] treewide: use kv[mz]alloc* rather than opencoded variants Michal Hocko
2017-03-06 10:33 ` [PATCH 7/9] net: use kvmalloc with __GFP_REPEAT rather than open coded variant Michal Hocko
2017-03-30 23:21 ` Shakeel Butt
2017-03-31 8:46 ` Michal Hocko
2017-03-06 10:33 ` [PATCH 8/9] md: use kvmalloc rather than opencoded variant Michal Hocko
2017-03-06 10:33 ` [PATCH 9/9] bcache: use kvmalloc Michal Hocko
-- strict thread matches above, loose matches on Subject: below --
2017-01-30 9:49 [PATCH 0/6 v3] kvmalloc Michal Hocko
2017-01-30 9:49 ` [PATCH 1/9] mm: introduce kv[mz]alloc helpers Michal Hocko
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=20170602074008.wctxj5il3rqnnpbf@sasha-lappy \
--to=alexander.levin@verizon.com \
--cc=adilger@dilger.ca \
--cc=akpm@linux-foundation.org \
--cc=jhubbard@nvidia.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mhocko@kernel.org \
--cc=vbabka@suse.cz \
/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).