Skip to contentSkip to conversation

mm/codetag: fix arg in pgalloc_tag_copy alloc_tag_sub

PATCH Superseded Sourav Panda 3 participants 3 messages Oct 22, 2024

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mm/codetag: fix arg in pgalloc_tag_copy alloc_tag_sub

alloc_tag_sub() takes bytes as opposed to number of pages as argument.

Currently pgalloc_tag_copy() passes the number of pages. This fix passes the current unit, which is the number of bytes allocated.

Fixes e0a955bf7f61 ("mm/codetag: add pgalloc_tag_copy()")
---
 include/linux/mm.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/mm.h +1 -1
index ecf63d2b0582..2890001c8b97 100644
@@ -4203,7 +4203,7 @@ static inline void pgalloc_tag_copy(struct folio *new, struct folio *old)
 	/* Clear the old ref to the original allocation tag. */
 	clear_page_tag_ref(&old->page);
 	/* Decrement the counters of the tag on get_new_folio. */
-	alloc_tag_sub(ref, folio_nr_pages(new));
+	alloc_tag_sub(ref, folio_size(new));
 
 	__alloc_tag_ref_set(ref, tag);
 
Signature · 1 line
2.47.0.105.g07ac214952-goog
Reviewed-by on v1 1/1
#1 lore raw
Quoted 8 lines · Sourav Panda

alloc_tag_sub() takes bytes as opposed to number of pages as argument.

Currently pgalloc_tag_copy() passes the number of pages. This fix passes the current unit, which is the number of bytes allocated.

Fixes e0a955bf7f61 ("mm/codetag: add pgalloc_tag_copy()")

Thanks,
Pasha

Quoted 20 lines
---
 include/linux/mm.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/mm.h +1 -2
index ecf63d2b0582..2890001c8b97 100644
@@ -4203,7 +4203,7 @@ static inline void pgalloc_tag_copy(struct folio *new, struct folio *old)
        /* Clear the old ref to the original allocation tag. */
        clear_page_tag_ref(&old->page);
        /* Decrement the counters of the tag on get_new_folio. */
-       alloc_tag_sub(ref, folio_nr_pages(new));
+       alloc_tag_sub(ref, folio_size(new));
 
        __alloc_tag_ref_set(ref, tag);
 
--

2.47.0.105.g07ac214952-goog

reviewer Acked-by
#2 lore raw
Quoted 5 lines · Pasha Tatashin
Quoted 3 lines · Sourav Panda

alloc_tag_sub() takes bytes as opposed to number of pages as argument.

Quoted 7 lines
Quoted 5 lines

Currently pgalloc_tag_copy() passes the number of pages. This fix passes the current unit, which is the number of bytes allocated.

Fixes e0a955bf7f61 ("mm/codetag: add pgalloc_tag_copy()")

Oops... Thanks for the fix!

Quoted 24 lines

Thanks,
Pasha

Quoted 20 lines
---
 include/linux/mm.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/mm.h +1 -2
index ecf63d2b0582..2890001c8b97 100644
@@ -4203,7 +4203,7 @@ static inline void pgalloc_tag_copy(struct folio *new, struct folio *old)
        /* Clear the old ref to the original allocation tag. */
        clear_page_tag_ref(&old->page);
        /* Decrement the counters of the tag on get_new_folio. */
-       alloc_tag_sub(ref, folio_nr_pages(new));
+       alloc_tag_sub(ref, folio_size(new));
 
        __alloc_tag_ref_set(ref, tag);
 
--

2.47.0.105.g07ac214952-goog