linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: David Rientjes <rientjes@google.com>
To: Long Li <lonuxli.64@gmail.com>
Cc: willy@infradead.org, cl@linux.com, penberg@kernel.org,
	 iamjoonsoo.kim@lge.com, akpm@linux-foundation.org,
	linux-mm@kvack.org,  linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3] mm, slab: Check GFP_SLAB_BUG_MASK before alloc_pages in kmalloc_order
Date: Wed, 1 Jul 2020 11:52:38 -0700 (PDT)	[thread overview]
Message-ID: <alpine.DEB.2.23.453.2007011151280.1908531@chino.kir.corp.google.com> (raw)
In-Reply-To: <20200701151645.GA26223@lilong>

On Wed, 1 Jul 2020, Long Li wrote:

> diff --git a/mm/slab.c b/mm/slab.c
> index ac7a223d9ac3..2850fe3c5fb8 100644
> --- a/mm/slab.c
> +++ b/mm/slab.c
> @@ -2573,13 +2573,9 @@ static struct page *cache_grow_begin(struct kmem_cache *cachep,
>  	 * Be lazy and only check for valid flags here,  keeping it out of the
>  	 * critical path in kmem_cache_alloc().
>  	 */
> -	if (unlikely(flags & GFP_SLAB_BUG_MASK)) {
> -		gfp_t invalid_mask = flags & GFP_SLAB_BUG_MASK;
> -		flags &= ~GFP_SLAB_BUG_MASK;
> -		pr_warn("Unexpected gfp: %#x (%pGg). Fixing up to gfp: %#x (%pGg). Fix your code!\n",
> -				invalid_mask, &invalid_mask, flags, &flags);
> -		dump_stack();
> -	}
> +	if (unlikely(flags & GFP_SLAB_BUG_MASK))
> +		flags = kmalloc_invalid_flags(flags);
> +
>  	WARN_ON_ONCE(cachep->ctor && (flags & __GFP_ZERO));
>  	local_flags = flags & (GFP_CONSTRAINT_MASK|GFP_RECLAIM_MASK);
>  

Is this name correct?  kmalloc_invalid_flags() masks off the invalid flags 
and returns the valid flags :)  Maybe kmalloc_check_flags()?


      parent reply	other threads:[~2020-07-01 18:52 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-01 15:16 [PATCH v3] mm, slab: Check GFP_SLAB_BUG_MASK before alloc_pages in kmalloc_order Long Li
2020-07-01 15:24 ` Matthew Wilcox
2020-07-01 15:47 ` Pekka Enberg
2020-07-01 18:52 ` David Rientjes [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=alpine.DEB.2.23.453.2007011151280.1908531@chino.kir.corp.google.com \
    --to=rientjes@google.com \
    --cc=akpm@linux-foundation.org \
    --cc=cl@linux.com \
    --cc=iamjoonsoo.kim@lge.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=lonuxli.64@gmail.com \
    --cc=penberg@kernel.org \
    --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).