linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Michal Hocko <mhocko@suse.com>
To: NeilBrown <neilb@suse.de>
Cc: linux-mm@kvack.org, Dave Chinner <david@fromorbit.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Christoph Hellwig <hch@infradead.org>,
	Uladzislau Rezki <urezki@gmail.com>,
	linux-fsdevel@vger.kernel.org,
	LKML <linux-kernel@vger.kernel.org>,
	Ilya Dryomov <idryomov@gmail.com>,
	Jeff Layton <jlayton@kernel.org>
Subject: Re: [PATCH 4/4] mm: allow !GFP_KERNEL allocations for kvmalloc
Date: Tue, 26 Oct 2021 09:15:21 +0200	[thread overview]
Message-ID: <YXerCVllHB9g+JnI@dhcp22.suse.cz> (raw)
In-Reply-To: <163520487423.16092.18303917539436351482@noble.neil.brown.name>

On Tue 26-10-21 10:34:34, Neil Brown wrote:
> On Tue, 26 Oct 2021, Michal Hocko wrote:
> > From: Michal Hocko <mhocko@suse.com>
> > 
> > A support for GFP_NO{FS,IO} and __GFP_NOFAIL has been implemented
> > by previous patches so we can allow the support for kvmalloc. This
> > will allow some external users to simplify or completely remove
> > their helpers.
> > 
> > GFP_NOWAIT semantic hasn't been supported so far but it hasn't been
> > explicitly documented so let's add a note about that.
> > 
> > ceph_kvmalloc is the first helper to be dropped and changed to
> > kvmalloc.
> > 
> > Signed-off-by: Michal Hocko <mhocko@suse.com>
> > ---
> >  include/linux/ceph/libceph.h |  1 -
> >  mm/util.c                    | 15 ++++-----------
> >  net/ceph/buffer.c            |  4 ++--
> >  net/ceph/ceph_common.c       | 27 ---------------------------
> >  net/ceph/crypto.c            |  2 +-
> >  net/ceph/messenger.c         |  2 +-
> >  net/ceph/messenger_v2.c      |  2 +-
> >  net/ceph/osdmap.c            | 12 ++++++------
> >  8 files changed, 15 insertions(+), 50 deletions(-)
> > 
> > diff --git a/include/linux/ceph/libceph.h b/include/linux/ceph/libceph.h
> > index 409d8c29bc4f..309acbcb5a8a 100644
> > --- a/include/linux/ceph/libceph.h
> > +++ b/include/linux/ceph/libceph.h
> > @@ -295,7 +295,6 @@ extern bool libceph_compatible(void *data);
> >  
> >  extern const char *ceph_msg_type_name(int type);
> >  extern int ceph_check_fsid(struct ceph_client *client, struct ceph_fsid *fsid);
> > -extern void *ceph_kvmalloc(size_t size, gfp_t flags);
> >  
> >  struct fs_parameter;
> >  struct fc_log;
> > diff --git a/mm/util.c b/mm/util.c
> > index bacabe446906..fdec6b4b1267 100644
> > --- a/mm/util.c
> > +++ b/mm/util.c
> > @@ -549,13 +549,10 @@ EXPORT_SYMBOL(vm_mmap);
> >   * Uses kmalloc to get the memory but if the allocation fails then falls back
> >   * to the vmalloc allocator. Use kvfree for freeing the memory.
> >   *
> > - * Reclaim modifiers - __GFP_NORETRY and __GFP_NOFAIL are not supported.
> > + * Reclaim modifiers - __GFP_NORETRY and GFP_NOWAIT are not supported.
> 
> GFP_NOWAIT is not a modifier.  It is a base value that can be modified.
> I think you mean that
>     __GFP_NORETRY is not supported and __GFP_DIRECT_RECLAIM is required

I thought naming the higher level gfp mask would be more helpful here.
Most people do not tend to think in terms of __GFP_DIRECT_RECLAIM but
rather GFP_NOWAIT or GFP_ATOMIC.

> But I really cannot see why either of these statements are true.

The reason is same as why vmalloc do not support neither of them.

> Before your patch, __GFP_NORETRY would have forced use of kmalloc, so
> that would mean it isn't really supported.  But that doesn't happen any more.

__GFP_NORETRY is used internaly by kvmalloc but that doesn't mean it is
supported by the caller. In fact __GFP_NORETRY is used to implement a
higher level logic of the prioritization between kmalloc and vmalloc
fallback because some users would rather see vmalloc fallback even for
smaller allocations which do not really fail otherwise (e.g. < order-4).
-- 
Michal Hocko
SUSE Labs


  reply	other threads:[~2021-10-26  7:15 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-25 15:02 [PATCH 0/4] extend vmalloc support for constrained allocations Michal Hocko
2021-10-25 15:02 ` [PATCH 1/4] mm/vmalloc: alloc GFP_NO{FS,IO} for vmalloc Michal Hocko
2021-10-25 15:02 ` [PATCH 2/4] mm/vmalloc: add support for __GFP_NOFAIL Michal Hocko
2021-10-25 22:59   ` NeilBrown
2021-10-26  7:03     ` Michal Hocko
2021-10-26 10:30       ` NeilBrown
2021-10-26 11:29         ` Michal Hocko
2021-10-26 15:48   ` Uladzislau Rezki
2021-10-26 16:28     ` Michal Hocko
2021-10-26 19:33       ` Uladzislau Rezki
2021-10-27  6:46         ` Michal Hocko
2021-10-27 17:55         ` Uladzislau Rezki
2021-10-29  7:57           ` Michal Hocko
2021-10-29 14:05             ` Uladzislau Rezki
2021-10-29 14:45               ` Michal Hocko
2021-10-29 17:23                 ` Uladzislau Rezki
2021-10-25 15:02 ` [PATCH 3/4] mm/vmalloc: be more explicit about supported gfp flags Michal Hocko
2021-10-25 23:26   ` NeilBrown
2021-10-26  7:10     ` Michal Hocko
2021-10-26 10:43       ` NeilBrown
2021-10-26 12:20         ` Michal Hocko
2021-10-25 15:02 ` [PATCH 4/4] mm: allow !GFP_KERNEL allocations for kvmalloc Michal Hocko
2021-10-25 23:34   ` NeilBrown
2021-10-26  7:15     ` Michal Hocko [this message]
2021-10-26 10:48       ` NeilBrown
2021-10-26 12:23         ` 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=YXerCVllHB9g+JnI@dhcp22.suse.cz \
    --to=mhocko@suse.com \
    --cc=akpm@linux-foundation.org \
    --cc=david@fromorbit.com \
    --cc=hch@infradead.org \
    --cc=idryomov@gmail.com \
    --cc=jlayton@kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=neilb@suse.de \
    --cc=urezki@gmail.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