public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] slub: use N_NORMAL_MEMORY in can_free_to_pcs to handle remote frees
@ 2026-04-03  7:37 Hao Li
  2026-04-03 12:02 ` Harry Yoo (Oracle)
  2026-04-03 18:02 ` David Rientjes
  0 siblings, 2 replies; 6+ messages in thread
From: Hao Li @ 2026-04-03  7:37 UTC (permalink / raw)
  To: vbabka, harry.yoo, akpm
  Cc: cl, rientjes, roman.gushchin, linux-mm, linux-kernel, Hao Li

Memory hotplug now keeps N_NORMAL_MEMORY up to date correctly, so make
can_free_to_pcs() use it.

As a result, when freeing objects on memoryless nodes, or on nodes that
have memory but only in ZONE_MOVABLE, the objects can be freed to the
sheaf instead of going through the slow path.

Signed-off-by: Hao Li <hao.li@linux.dev>
---

Hi Vlastimil, this patch depends on a prerequisite patch[1] from a few days
ago. I'm not sure how this should be handled. I wonder if Andrew might put them
in the same tree.

[1] https://lore.kernel.org/linux-mm/20260330035941.518186-1-hao.li@linux.dev/

---
 mm/slub.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/mm/slub.c b/mm/slub.c
index fb2c5c57bc4e..4927407c9699 100644
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -6022,14 +6022,15 @@ static __always_inline bool can_free_to_pcs(struct slab *slab)
 		goto check_pfmemalloc;
 
 	/*
-	 * Freed object isn't from this cpu's node, but that node is memoryless.
+	 * Freed object isn't from this cpu's node, but that node is memoryless
+	 * or only has ZONE_MOVABLE memory, which slab cannot allocate from.
 	 * Proceed as it's better to cache remote objects than falling back to
 	 * the slowpath for everything. The allocation side can never obtain
 	 * a local object anyway, if none exist. We don't have numa_mem_id() to
 	 * point to the closest node as we would on a proper memoryless node
 	 * setup.
 	 */
-	if (unlikely(!node_state(numa_node, N_MEMORY)))
+	if (unlikely(!node_state(numa_node, N_NORMAL_MEMORY)))
 		goto check_pfmemalloc;
 #endif
 
-- 
2.50.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] slub: use N_NORMAL_MEMORY in can_free_to_pcs to handle remote frees
  2026-04-03  7:37 [PATCH] slub: use N_NORMAL_MEMORY in can_free_to_pcs to handle remote frees Hao Li
@ 2026-04-03 12:02 ` Harry Yoo (Oracle)
  2026-04-03 18:14   ` Vlastimil Babka (SUSE)
  2026-04-03 18:02 ` David Rientjes
  1 sibling, 1 reply; 6+ messages in thread
From: Harry Yoo (Oracle) @ 2026-04-03 12:02 UTC (permalink / raw)
  To: Hao Li; +Cc: vbabka, akpm, cl, rientjes, roman.gushchin, linux-mm,
	linux-kernel

On Fri, Apr 03, 2026 at 03:37:36PM +0800, Hao Li wrote:
> Memory hotplug now keeps N_NORMAL_MEMORY up to date correctly, so make
> can_free_to_pcs() use it.
> 
> As a result, when freeing objects on memoryless nodes, or on nodes that
> have memory but only in ZONE_MOVABLE, the objects can be freed to the
> sheaf instead of going through the slow path.
> 
> Signed-off-by: Hao Li <hao.li@linux.dev>
> ---

Acked-by: Harry Yoo (Oracle) <harry@kernel.org>

> Hi Vlastimil, this patch depends on a prerequisite patch[1] from a few days
> ago. I'm not sure how this should be handled.

> I wonder if Andrew might put them in the same tree.

But it also depends on the patch series
"[PATCH 0/3] slab: support memoryless nodes with sheaves".

So perhaps better send it to Linus after 7.1-rc1?

Thanks!

> [1] https://lore.kernel.org/linux-mm/20260330035941.518186-1-hao.li@linux.dev/

-- 
Cheers,
Harry / Hyeonggon

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] slub: use N_NORMAL_MEMORY in can_free_to_pcs to handle remote frees
  2026-04-03  7:37 [PATCH] slub: use N_NORMAL_MEMORY in can_free_to_pcs to handle remote frees Hao Li
  2026-04-03 12:02 ` Harry Yoo (Oracle)
@ 2026-04-03 18:02 ` David Rientjes
  1 sibling, 0 replies; 6+ messages in thread
From: David Rientjes @ 2026-04-03 18:02 UTC (permalink / raw)
  To: Hao Li; +Cc: vbabka, harry.yoo, akpm, cl, roman.gushchin, linux-mm,
	linux-kernel

On Fri, 3 Apr 2026, Hao Li wrote:

> Memory hotplug now keeps N_NORMAL_MEMORY up to date correctly, so make
> can_free_to_pcs() use it.
> 
> As a result, when freeing objects on memoryless nodes, or on nodes that
> have memory but only in ZONE_MOVABLE, the objects can be freed to the
> sheaf instead of going through the slow path.
> 
> Signed-off-by: Hao Li <hao.li@linux.dev>

Acked-by: David Rientjes <rientjes@google.com>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] slub: use N_NORMAL_MEMORY in can_free_to_pcs to handle remote frees
  2026-04-03 12:02 ` Harry Yoo (Oracle)
@ 2026-04-03 18:14   ` Vlastimil Babka (SUSE)
  2026-04-04  4:05     ` Hao Li
  2026-04-06  1:57     ` Harry Yoo (Oracle)
  0 siblings, 2 replies; 6+ messages in thread
From: Vlastimil Babka (SUSE) @ 2026-04-03 18:14 UTC (permalink / raw)
  To: Harry Yoo (Oracle), Hao Li
  Cc: akpm, cl, rientjes, roman.gushchin, linux-mm, linux-kernel

On 4/3/26 14:02, Harry Yoo (Oracle) wrote:
> On Fri, Apr 03, 2026 at 03:37:36PM +0800, Hao Li wrote:
>> Memory hotplug now keeps N_NORMAL_MEMORY up to date correctly, so make
>> can_free_to_pcs() use it.
>> 
>> As a result, when freeing objects on memoryless nodes, or on nodes that
>> have memory but only in ZONE_MOVABLE, the objects can be freed to the
>> sheaf instead of going through the slow path.
>> 
>> Signed-off-by: Hao Li <hao.li@linux.dev>
>> ---
> 
> Acked-by: Harry Yoo (Oracle) <harry@kernel.org>
> 
>> Hi Vlastimil, this patch depends on a prerequisite patch[1] from a few days
>> ago. I'm not sure how this should be handled.
> 
>> I wonder if Andrew might put them in the same tree.

> But it also depends on the patch series
> "[PATCH 0/3] slab: support memoryless nodes with sheaves".
> 
> So perhaps better send it to Linus after 7.1-rc1?

[1] is in mm-hotfixes so it should get to mainline before 7.0 final, so then
it's fine to add this to slab updates PR for 7.1-rc1

> Thanks!
> 
>> [1] https://lore.kernel.org/linux-mm/20260330035941.518186-1-hao.li@linux.dev/
> 


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] slub: use N_NORMAL_MEMORY in can_free_to_pcs to handle remote frees
  2026-04-03 18:14   ` Vlastimil Babka (SUSE)
@ 2026-04-04  4:05     ` Hao Li
  2026-04-06  1:57     ` Harry Yoo (Oracle)
  1 sibling, 0 replies; 6+ messages in thread
From: Hao Li @ 2026-04-04  4:05 UTC (permalink / raw)
  To: Vlastimil Babka (SUSE), Harry Yoo (Oracle)
  Cc: akpm, cl, rientjes, roman.gushchin, linux-mm, linux-kernel

On Fri, Apr 03, 2026 at 08:14:11PM +0200, Vlastimil Babka (SUSE) wrote:
> On 4/3/26 14:02, Harry Yoo (Oracle) wrote:
> > On Fri, Apr 03, 2026 at 03:37:36PM +0800, Hao Li wrote:
> >> Memory hotplug now keeps N_NORMAL_MEMORY up to date correctly, so make
> >> can_free_to_pcs() use it.
> >> 
> >> As a result, when freeing objects on memoryless nodes, or on nodes that
> >> have memory but only in ZONE_MOVABLE, the objects can be freed to the
> >> sheaf instead of going through the slow path.
> >> 
> >> Signed-off-by: Hao Li <hao.li@linux.dev>
> >> ---
> > 
> > Acked-by: Harry Yoo (Oracle) <harry@kernel.org>

Thanks for Ack!

> > 
> >> Hi Vlastimil, this patch depends on a prerequisite patch[1] from a few days
> >> ago. I'm not sure how this should be handled.
> > 
> >> I wonder if Andrew might put them in the same tree.
> 
> > But it also depends on the patch series
> > "[PATCH 0/3] slab: support memoryless nodes with sheaves".
> > 
> > So perhaps better send it to Linus after 7.1-rc1?
> 
> [1] is in mm-hotfixes so it should get to mainline before 7.0 final, so then
> it's fine to add this to slab updates PR for 7.1-rc1

Sounds good, thanks!

> 
> > Thanks!
> > 
> >> [1] https://lore.kernel.org/linux-mm/20260330035941.518186-1-hao.li@linux.dev/
> > 
> 

-- 
Thanks,
Hao

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] slub: use N_NORMAL_MEMORY in can_free_to_pcs to handle remote frees
  2026-04-03 18:14   ` Vlastimil Babka (SUSE)
  2026-04-04  4:05     ` Hao Li
@ 2026-04-06  1:57     ` Harry Yoo (Oracle)
  1 sibling, 0 replies; 6+ messages in thread
From: Harry Yoo (Oracle) @ 2026-04-06  1:57 UTC (permalink / raw)
  To: Vlastimil Babka (SUSE)
  Cc: Hao Li, akpm, cl, rientjes, roman.gushchin, linux-mm,
	linux-kernel

On Fri, Apr 03, 2026 at 08:14:11PM +0200, Vlastimil Babka (SUSE) wrote:
> On 4/3/26 14:02, Harry Yoo (Oracle) wrote:
> > On Fri, Apr 03, 2026 at 03:37:36PM +0800, Hao Li wrote:
> >> Memory hotplug now keeps N_NORMAL_MEMORY up to date correctly, so make
> >> can_free_to_pcs() use it.
> >> 
> >> As a result, when freeing objects on memoryless nodes, or on nodes that
> >> have memory but only in ZONE_MOVABLE, the objects can be freed to the
> >> sheaf instead of going through the slow path.
> >> 
> >> Signed-off-by: Hao Li <hao.li@linux.dev>
> >> ---
> > 
> > Acked-by: Harry Yoo (Oracle) <harry@kernel.org>
> > 
> >> Hi Vlastimil, this patch depends on a prerequisite patch[1] from a few days
> >> ago. I'm not sure how this should be handled.
> > 
> >> I wonder if Andrew might put them in the same tree.
> 
> > But it also depends on the patch series
> > "[PATCH 0/3] slab: support memoryless nodes with sheaves".
> > 
> > So perhaps better send it to Linus after 7.1-rc1?
> 
> [1] is in mm-hotfixes so it should get to mainline before 7.0 final,

Right.

> so then it's fine to add this to slab updates PR for 7.1-rc1

Sounds great!

> >> [1] https://lore.kernel.org/linux-mm/20260330035941.518186-1-hao.li@linux.dev/
> > 

-- 
Cheers,
Harry / Hyeonggon

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2026-04-06  1:57 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-03  7:37 [PATCH] slub: use N_NORMAL_MEMORY in can_free_to_pcs to handle remote frees Hao Li
2026-04-03 12:02 ` Harry Yoo (Oracle)
2026-04-03 18:14   ` Vlastimil Babka (SUSE)
2026-04-04  4:05     ` Hao Li
2026-04-06  1:57     ` Harry Yoo (Oracle)
2026-04-03 18:02 ` David Rientjes

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox