From: Heiko Carstens <heiko.carstens@de.ibm.com>
To: Michal Hocko <mhocko@suse.com>
Cc: Anatoly Stepanov <astepanov@cloudlinux.com>,
Vlastimil Babka <vbabka@suse.cz>,
linux-mm@kvack.org, akpm@linux-foundation.org,
vdavydov.dev@gmail.com, umka@cloudlinux.com,
panda@cloudlinux.com, vmeshkov@cloudlinux.com
Subject: Re: [PATCH] mm: use vmalloc fallback path for certain memcg allocations
Date: Mon, 5 Dec 2016 15:09:33 +0100 [thread overview]
Message-ID: <20161205140932.GC8045@osiris> (raw)
In-Reply-To: <20161205052325.GA30758@dhcp22.suse.cz>
On Mon, Dec 05, 2016 at 06:23:26AM +0100, Michal Hocko wrote:
> > >
> > > ret = kzalloc(size, gfp_mask);
> > > if (ret)
> > > return ret;
> > > return vzalloc(size);
> > >
> >
> > > I also do not like memcg_alloc helper name. It suggests we are
> > > allocating a memcg while it is used for cache arrays and slab LRUS.
> > > Anyway this pattern is quite widespread in the kernel so I would simply
> > > suggest adding kvmalloc function instead.
> >
> > Agreed, it would be nice to have a generic call.
> > I would suggest an impl. like this:
> >
> > void *kvmalloc(size_t size)
>
> gfp_t gfp_mask should be a parameter as this should be a generic helper.
>
> > {
> > gfp_t gfp_mask = GFP_KERNEL;
>
>
> > void *ret;
> >
> > if (size > PAGE_SIZE)
> > gfp_mask |= __GFP_NORETRY | __GFP_NOWARN;
> >
> >
> > if (size <= (PAGE_SIZE << PAGE_ALLOC_COSTLY_ORDER)) {
> > ret = kzalloc(size, gfp_mask);
> > if (ret)
> > return ret;
> > }
>
> No, please just do as suggested above. Tweak the gfp_mask for higher
> order requests and do kmalloc first with vmalloc as a fallback.
You may simply use the slightly different and open-coded variant within
fs/seq_file.c:seq_buf_alloc(). That one got a lot of testing in the
meantime...
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next prev parent reply other threads:[~2016-12-05 14:09 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-12-01 1:16 [PATCH] mm: use vmalloc fallback path for certain memcg allocations Anatoly Stepanov
2016-12-02 8:19 ` Alexey Lyashkov
2016-12-02 8:44 ` Vlastimil Babka
2016-12-02 9:19 ` Michal Hocko
2016-12-02 6:54 ` Anatoly Stepanov
2016-12-05 5:23 ` Michal Hocko
2016-12-02 22:09 ` Anatoly Stepanov
2016-12-06 8:47 ` Michal Hocko
2016-12-03 15:55 ` Anatoly Stepanov
2016-12-08 8:45 ` Michal Hocko
2016-12-05 14:09 ` Heiko Carstens [this message]
2016-12-05 14:19 ` Michal Hocko
2016-12-02 22:15 ` Anatoly Stepanov
2016-12-06 8:34 ` 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=20161205140932.GC8045@osiris \
--to=heiko.carstens@de.ibm.com \
--cc=akpm@linux-foundation.org \
--cc=astepanov@cloudlinux.com \
--cc=linux-mm@kvack.org \
--cc=mhocko@suse.com \
--cc=panda@cloudlinux.com \
--cc=umka@cloudlinux.com \
--cc=vbabka@suse.cz \
--cc=vdavydov.dev@gmail.com \
--cc=vmeshkov@cloudlinux.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.