linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Matthew Wilcox <willy@infradead.org>
To: Christopher Lameter <cl@linux.com>
Cc: Long Li <lonuxli.64@gmail.com>,
	penberg@kernel.org, rientjes@google.com, iamjoonsoo.kim@lge.com,
	akpm@linux-foundation.org, linux-mm@kvack.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v1] mm:free unused pages in kmalloc_order
Date: Mon, 29 Jun 2020 15:52:59 +0100	[thread overview]
Message-ID: <20200629145259.GD25523@casper.infradead.org> (raw)
In-Reply-To: <alpine.DEB.2.22.394.2006291446560.27163@www.lameter.com>

On Mon, Jun 29, 2020 at 02:48:06PM +0000, Christopher Lameter wrote:
> On Sat, 27 Jun 2020, Long Li wrote:
> > Environment using the slub allocator, 1G memory in my ARM32.
> > kmalloc(1024, GFP_HIGHUSER) can allocate memory normally,
> > kmalloc(64*1024, GFP_HIGHUSER) will cause a memory leak, because
> > alloc_pages returns highmem physical pages, but it cannot be directly
> > converted into a virtual address and return NULL, the pages has not
> > been released. Usually driver developers will not use the
> > GFP_HIGHUSER flag to allocate memory in kmalloc, but I think this
> > memory leak is not perfect, it is best to be fixed. This is the
> > first time I have posted a patch, there may be something wrong.
> 
> Highmem is not supported by the slab allocators. Please ensure that there
> is a warning generated if someone attempts to do such an allocation. We
> used to check for that.

Sounds like we need a test somewhere that checks this behaviour.

> In order to make such allocations possible one would have to create yet
> another kmalloc array for high memory.

Not for this case because it goes straight to kmalloc_order().  What does
make this particular case impossible is that we can't kmap() a compound
page.  We could vmap it, but why are we bothering?


  reply	other threads:[~2020-06-29 14:53 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-27  4:55 [PATCH v1] mm:free unused pages in kmalloc_order Long Li
2020-06-29  2:42 ` Matthew Wilcox
2020-06-29 14:49   ` Christopher Lameter
2020-06-29 14:48 ` Christopher Lameter
2020-06-29 14:52   ` Matthew Wilcox [this message]
2020-07-01 15:18     ` Christopher Lameter

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=20200629145259.GD25523@casper.infradead.org \
    --to=willy@infradead.org \
    --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=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).