linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Vlastimil Babka <vbabka@suse.cz>
To: Dmitry Vyukov <dvyukov@gmail.com>,
	cl@linux.com, penberg@kernel.org, akpm@linux-foundation.org,
	rientjes@google.com, iamjoonsoo.kim@lge.com
Cc: Dmitry Vyukov <dvyukov@google.com>,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] mm: don't warn about large allocations for slab
Date: Tue, 16 Oct 2018 15:59:52 +0200	[thread overview]
Message-ID: <12881182-2459-910a-8f3a-04b3e85f08b6@suse.cz> (raw)
In-Reply-To: <20180927171502.226522-1-dvyukov@gmail.com>

On 9/27/18 7:15 PM, Dmitry Vyukov wrote:
> From: Dmitry Vyukov <dvyukov@google.com>
> 
> Slub does not call kmalloc_slab() for sizes > KMALLOC_MAX_CACHE_SIZE,
> instead it falls back to kmalloc_large().
> For slab KMALLOC_MAX_CACHE_SIZE == KMALLOC_MAX_SIZE and it calls
> kmalloc_slab() for all allocations relying on NULL return value
> for over-sized allocations.
> This inconsistency leads to unwanted warnings from kmalloc_slab()
> for over-sized allocations for slab. Returning NULL for failed
> allocations is the expected behavior.
> 
> Make slub and slab code consistent by checking size >
> KMALLOC_MAX_CACHE_SIZE in slab before calling kmalloc_slab().
> 
> While we are here also fix the check in kmalloc_slab().
> We should check against KMALLOC_MAX_CACHE_SIZE rather than
> KMALLOC_MAX_SIZE. It all kinda worked because for slab the
> constants are the same, and slub always checks the size against
> KMALLOC_MAX_CACHE_SIZE before kmalloc_slab().
> But if we get there with size > KMALLOC_MAX_CACHE_SIZE anyhow
> bad things will happen. For example, in case of a newly introduced
> bug in slub code.
> 
> Also move the check in kmalloc_slab() from function entry
> to the size > 192 case. This partially compensates for the additional
> check in slab code and makes slub code a bit faster
> (at least theoretically).
> 
> Also drop __GFP_NOWARN in the warning check.
> This warning means a bug in slab code itself,
> user-passed flags have nothing to do with it.
> 
> Nothing of this affects slob.
> 
> Signed-off-by: Dmitry Vyukov <dvyukov@google.com>
> Cc: Christoph Lameter <cl@linux.com>
> Cc: Pekka Enberg <penberg@kernel.org>
> Cc: David Rientjes <rientjes@google.com>
> Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>
> Cc: Andrew Morton <akpm@linux-foundation.org>
> Cc: linux-mm@kvack.org
> Cc: linux-kernel@vger.kernel.org
> Reported-by: syzbot+87829a10073277282ad1@syzkaller.appspotmail.com
> Reported-by: syzbot+ef4e8fc3a06e9019bb40@syzkaller.appspotmail.com
> Reported-by: syzbot+6e438f4036df52cbb863@syzkaller.appspotmail.com
> Reported-by: syzbot+8574471d8734457d98aa@syzkaller.appspotmail.com
> Reported-by: syzbot+af1504df0807a083dbd9@syzkaller.appspotmail.com

Acked-by: Vlastimil Babka <vbabka@suse.cz>

      reply	other threads:[~2018-10-16 13:59 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-27 17:15 Dmitry Vyukov
2018-10-16 13:59 ` Vlastimil Babka [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=12881182-2459-910a-8f3a-04b3e85f08b6@suse.cz \
    --to=vbabka@suse.cz \
    --cc=akpm@linux-foundation.org \
    --cc=cl@linux.com \
    --cc=dvyukov@gmail.com \
    --cc=dvyukov@google.com \
    --cc=iamjoonsoo.kim@lge.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=penberg@kernel.org \
    --cc=rientjes@google.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