From: Michal Hocko <mhocko@kernel.org>
To: Matthew Wilcox <willy@infradead.org>
Cc: linux-mm@kvack.org, Matthew Wilcox <mawilcox@microsoft.com>,
Christoph Lameter <cl@linux.com>,
Pekka Enberg <penberg@kernel.org>,
David Rientjes <rientjes@google.com>,
Joonsoo Kim <iamjoonsoo.kim@lge.com>,
Andrew Morton <akpm@linux-foundation.org>,
linux-kernel@vger.kernel.org, Jan Kara <jack@suse.cz>,
Jeff Layton <jlayton@redhat.com>,
Mel Gorman <mgorman@techsingularity.net>
Subject: Re: [PATCH v2 2/2] slab: __GFP_ZERO is incompatible with a constructor
Date: Wed, 11 Apr 2018 08:35:54 +0200 [thread overview]
Message-ID: <20180411063554.GB30893@dhcp22.suse.cz> (raw)
In-Reply-To: <20180411060320.14458-3-willy@infradead.org>
On Tue 10-04-18 23:03:20, Matthew Wilcox wrote:
> diff --git a/mm/slab.c b/mm/slab.c
> index 58c8cecc26ab..9ad85fd9fca8 100644
> --- a/mm/slab.c
> +++ b/mm/slab.c
> @@ -2661,6 +2661,7 @@ static struct page *cache_grow_begin(struct kmem_cache *cachep,
> invalid_mask, &invalid_mask, flags, &flags);
> dump_stack();
> }
> + BUG_ON(cachep->ctor && (flags & __GFP_ZERO));
NAK. We really do not want to blow the whole kernel just because
somebody is doing something stupid. Make it WARN_ON_ONCE and fix up the
flag.
> +static inline bool slab_no_ctor(struct kmem_cache *s)
> +{
> + if (IS_ENABLED(CONFIG_DEBUG_VM))
> + return !WARN_ON_ONCE(s->ctor);
> + return true;
> +}
I do realize that you want to keep the hotpath without additional checks
but if for nothing else this is a really bad misnomer.
debug_slab_no_ctor()? I can clearly see how somebody uses this blindly
for a different purpose.
[...]
> diff --git a/mm/slub.c b/mm/slub.c
> index a28488643603..9f8f38a552e5 100644
> --- a/mm/slub.c
> +++ b/mm/slub.c
> @@ -1576,6 +1576,7 @@ static struct page *allocate_slab(struct kmem_cache *s, gfp_t flags, int node)
>
> if (gfpflags_allow_blocking(flags))
> local_irq_enable();
> + BUG_ON(s->ctor && (flags & __GFP_ZERO));
No no on this as well.
Othe than that. Once those are fixed, feel free to add
Acked-by: Michal Hocko <mhocko@suse.com>
--
Michal Hocko
SUSE Labs
next prev parent reply other threads:[~2018-04-11 6:35 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-04-11 6:03 [PATCH v2 0/2] Fix __GFP_ZERO vs constructor Matthew Wilcox
2018-04-11 6:03 ` [PATCH v2 1/2] Fix NULL pointer in page_cache_tree_insert Matthew Wilcox
2018-04-11 6:03 ` [PATCH v2 2/2] slab: __GFP_ZERO is incompatible with a constructor Matthew Wilcox
2018-04-11 6:35 ` Michal Hocko [this message]
2018-04-11 13:44 ` Christopher Lameter
2018-04-11 19:24 ` Matthew Wilcox
2018-04-11 21:11 ` Christopher Lameter
2018-04-11 23:56 ` Matthew Wilcox
2018-04-12 14:10 ` Christopher Lameter
2018-04-12 14:27 ` Matthew Wilcox
2018-04-12 15:15 ` Christopher Lameter
2018-04-12 19:13 ` [PATCH v3 " Matthew Wilcox
2018-04-16 15:10 ` Christopher Lameter
2018-08-03 21:22 ` Guenter Roeck
2018-08-03 22:33 ` Matthew Wilcox
2018-08-04 9:28 ` Geert Uytterhoeven
2018-08-04 14:00 ` Guenter Roeck
2018-04-12 0:54 ` [PATCH v2 0/2] Fix __GFP_ZERO vs constructor Minchan Kim
2018-04-12 19:24 ` Matthew Wilcox
2018-04-13 12:44 ` 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=20180411063554.GB30893@dhcp22.suse.cz \
--to=mhocko@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=cl@linux.com \
--cc=iamjoonsoo.kim@lge.com \
--cc=jack@suse.cz \
--cc=jlayton@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mawilcox@microsoft.com \
--cc=mgorman@techsingularity.net \
--cc=penberg@kernel.org \
--cc=rientjes@google.com \
--cc=willy@infradead.org \
/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).