linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: "Christoph Lameter (Ampere)" <cl@gentwo.org>
To: Chen Jun <chenjun102@huawei.com>
Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org,
	penberg@kernel.org,  rientjes@google.com, iamjoonsoo.kim@lge.com,
	akpm@linux-foundation.org,  vbabka@suse.cz,
	roman.gushchin@linux.dev, 42.hyeyoo@gmail.com,
	 xuqiang36@huawei.com, wangkefeng.wang@huawei.com
Subject: Re: [PATCH v2] mm/slub: Reduce memory consumption in extreme scenarios
Date: Fri, 5 Apr 2024 09:50:22 -0700 (PDT)	[thread overview]
Message-ID: <0a59e5a1-1961-5eb2-2eb0-a930006e3f80@gentwo.org> (raw)
In-Reply-To: <20240330082335.29710-1-chenjun102@huawei.com>

On Sat, 30 Mar 2024, Chen Jun wrote:

> When kmalloc_node() is called without __GFP_THISNODE and the target node
> lacks sufficient memory, SLUB allocates a folio from a different node
> other than the requested node, instead of taking a partial slab from it.

Hmmm... This would mean that we do not consult the partial lists of the 
other nodes. That is something to be fixed in the allocator.

> However, since the allocated folio does not belong to the requested
> node, it is deactivated and added to the partial slab list of the node
> it belongs to.

That should only occur if a request for an object for node X follows a 
request for an object from node Y.

> This behavior can result in excessive memory usage when the requested
> node has insufficient memory, as SLUB will repeatedly allocate folios
> from other nodes without reusing the previously allocated ones.

That is bad. Can we avoid that by verifying proper allocator behavior
during deactivation and ensuring that it searches remote partial objects 
first before doing something drastic as going to the page allocator?

> To prevent memory wastage,
> when (node != NUMA_NO_NODE) && !(gfpflags & __GFP_THISNODE) is,
> 1) try to get a partial slab from target node with GFP_NOWAIT |
>   __GFP_THISNODE opportunistically.

Did we check the partial lists of that node first for available 
objects before going to the page allocator?

get_any_partial() should do that. Maybe it is not called in the 
kmalloc_node case.



  parent reply	other threads:[~2024-04-05 16:58 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-30  8:23 Chen Jun
2024-04-02 16:08 ` Vlastimil Babka
2024-04-05 16:50 ` Christoph Lameter (Ampere) [this message]
2024-04-08 13:17   ` Vlastimil Babka
2024-04-08 18:17     ` Christoph Lameter (Ampere)
2024-04-09  6:16       ` Vlastimil Babka

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=0a59e5a1-1961-5eb2-2eb0-a930006e3f80@gentwo.org \
    --to=cl@gentwo.org \
    --cc=42.hyeyoo@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=chenjun102@huawei.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 \
    --cc=roman.gushchin@linux.dev \
    --cc=vbabka@suse.cz \
    --cc=wangkefeng.wang@huawei.com \
    --cc=xuqiang36@huawei.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