From: Matthew Wilcox <willy@infradead.org>
To: Long Li <lonuxli.64@gmail.com>
Cc: cl@linux.com, penberg@kernel.org, rientjes@google.com,
iamjoonsoo.kim@lge.com, akpm@linux-foundation.org,
linux-mm@kvack.org
Subject: Re: [PATCH v5] mm, slab: Check GFP_SLAB_BUG_MASK before alloc_pages in kmalloc_order
Date: Sat, 4 Jul 2020 03:32:00 +0100 [thread overview]
Message-ID: <20200704023200.GK25523@casper.infradead.org> (raw)
In-Reply-To: <20200704022607.GA57530@lilong>
On Sat, Jul 04, 2020 at 02:26:07AM +0000, Long Li wrote:
> kmalloc cannot allocate memory from HIGHMEM. Allocating large amounts
> of memory currently bypasses the check and will simply leak the memory
> when page_address() returns NULL. To fix this, factor the
> GFP_SLAB_BUG_MASK check out of slab & slub, and call it from
> kmalloc_order() as well. In order to make the code clear, the warning
> message is put in one place.
>
> Reviewed-by: Matthew Wilcox (Oracle) <willy@infradead.org>
> Reviewed-by: Pekka Enberg <penberg@kernel.org>
> Cc: Christoph Lameter <cl@linux.com>
> Cc: David Rientjes <rientjes@google.com>
> Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>
> Cc: Andrew Morton <akpm@linux-foundation.org>
> Signed-off-by: Long Li <lonuxli.64@gmail.com>
> ---
>
> changes in v5:
> -Change the check function name to kmalloc_fix_flags(), This name
> may be more appropriate.
>
> changes in V4:
> -Change the check function name to kmalloc_check_flags()
> -Put the flags check into the kmalloc_check_flags()
No. As I said:
The point of not doing that was that this is unlikely(). With your
change there is now a function call to check something that's (extremely)
unlikely().
prev parent reply other threads:[~2020-07-04 2:32 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-04 2:26 [PATCH v5] mm, slab: Check GFP_SLAB_BUG_MASK before alloc_pages in kmalloc_order Long Li
2020-07-04 2:32 ` Matthew Wilcox [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=20200704023200.GK25523@casper.infradead.org \
--to=willy@infradead.org \
--cc=akpm@linux-foundation.org \
--cc=cl@linux.com \
--cc=iamjoonsoo.kim@lge.com \
--cc=linux-mm@kvack.org \
--cc=lonuxli.64@gmail.com \
--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;
as well as URLs for NNTP newsgroup(s).