linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] slab: Remove unnecessary call to compound_head() in alloc_from_pcs()
@ 2025-11-24 14:23 Matthew Wilcox (Oracle)
  2025-11-24 19:14 ` Harry Yoo
  0 siblings, 1 reply; 3+ messages in thread
From: Matthew Wilcox (Oracle) @ 2025-11-24 14:23 UTC (permalink / raw)
  To: Vlastimil Babka
  Cc: Matthew Wilcox (Oracle),
	Andrew Morton, Christoph Lameter, David Rientjes, Roman Gushchin,
	Harry Yoo, linux-mm

Each page knows which node it belongs to, so there's no need to
convert to a folio.

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
---
 mm/slub.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mm/slub.c b/mm/slub.c
index e4a02586dacf..e6a330e24145 100644
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -5126,7 +5126,7 @@ void *alloc_from_pcs(struct kmem_cache *s, gfp_t gfp, int node)
 		 * be false because of cpu migration during an unlocked part of
 		 * the current allocation or previous freeing process.
 		 */
-		if (folio_nid(virt_to_folio(object)) != node) {
+		if (page_to_nid(virt_to_page(object)) != node) {
 			local_unlock(&s->cpu_sheaves->lock);
 			return NULL;
 		}
-- 
2.47.2



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

* Re: [PATCH] slab: Remove unnecessary call to compound_head() in alloc_from_pcs()
  2025-11-24 14:23 [PATCH] slab: Remove unnecessary call to compound_head() in alloc_from_pcs() Matthew Wilcox (Oracle)
@ 2025-11-24 19:14 ` Harry Yoo
  2025-11-25 13:13   ` Vlastimil Babka
  0 siblings, 1 reply; 3+ messages in thread
From: Harry Yoo @ 2025-11-24 19:14 UTC (permalink / raw)
  To: Matthew Wilcox (Oracle)
  Cc: Vlastimil Babka, Andrew Morton, Christoph Lameter,
	David Rientjes, Roman Gushchin, linux-mm

On Mon, Nov 24, 2025 at 02:23:27PM +0000, Matthew Wilcox (Oracle) wrote:
> Each page knows which node it belongs to, so there's no need to
> convert to a folio.
> 
> Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
> ---

Nice observation!

Looks good to me,
Reviewed-by: Harry Yoo <harry.yoo@oracle.com>

>  mm/slub.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/mm/slub.c b/mm/slub.c
> index e4a02586dacf..e6a330e24145 100644
> --- a/mm/slub.c
> +++ b/mm/slub.c
> @@ -5126,7 +5126,7 @@ void *alloc_from_pcs(struct kmem_cache *s, gfp_t gfp, int node)
>  		 * be false because of cpu migration during an unlocked part of
>  		 * the current allocation or previous freeing process.
>  		 */
> -		if (folio_nid(virt_to_folio(object)) != node) {
> +		if (page_to_nid(virt_to_page(object)) != node) {
>  			local_unlock(&s->cpu_sheaves->lock);
>  			return NULL;
>  		}
> -- 
> 2.47.2
> 

-- 
Cheers,
Harry / Hyeonggon


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

* Re: [PATCH] slab: Remove unnecessary call to compound_head() in alloc_from_pcs()
  2025-11-24 19:14 ` Harry Yoo
@ 2025-11-25 13:13   ` Vlastimil Babka
  0 siblings, 0 replies; 3+ messages in thread
From: Vlastimil Babka @ 2025-11-25 13:13 UTC (permalink / raw)
  To: Harry Yoo, Matthew Wilcox (Oracle)
  Cc: Andrew Morton, Christoph Lameter, David Rientjes, Roman Gushchin,
	linux-mm

On 11/24/25 20:14, Harry Yoo wrote:
> On Mon, Nov 24, 2025 at 02:23:27PM +0000, Matthew Wilcox (Oracle) wrote:
>> Each page knows which node it belongs to, so there's no need to
>> convert to a folio.
>> 
>> Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
>> ---
> 
> Nice observation!
> 
> Looks good to me,
> Reviewed-by: Harry Yoo <harry.yoo@oracle.com>

Thanks, added.

> 
>>  mm/slub.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>> 
>> diff --git a/mm/slub.c b/mm/slub.c
>> index e4a02586dacf..e6a330e24145 100644
>> --- a/mm/slub.c
>> +++ b/mm/slub.c
>> @@ -5126,7 +5126,7 @@ void *alloc_from_pcs(struct kmem_cache *s, gfp_t gfp, int node)
>>  		 * be false because of cpu migration during an unlocked part of
>>  		 * the current allocation or previous freeing process.
>>  		 */
>> -		if (folio_nid(virt_to_folio(object)) != node) {
>> +		if (page_to_nid(virt_to_page(object)) != node) {
>>  			local_unlock(&s->cpu_sheaves->lock);
>>  			return NULL;
>>  		}
>> -- 
>> 2.47.2
>> 
> 



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

end of thread, other threads:[~2025-11-25 13:14 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-11-24 14:23 [PATCH] slab: Remove unnecessary call to compound_head() in alloc_from_pcs() Matthew Wilcox (Oracle)
2025-11-24 19:14 ` Harry Yoo
2025-11-25 13:13   ` Vlastimil Babka

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