alloc_tag: mark pages reserved during CMA activation as not tagged
PATCH v2 1/1 alloc_tag: mark pages reserved during CMA activation as not tagged
During CMA activation, pages in CMA area are prepared and then freed without being allocated. This triggers warnings when memory allocation debug config (CONFIG_MEM_ALLOC_PROFILING_DEBUG) is enabled. Fix this by marking these pages not tagged before freeing them.
---
changes since v1 [1]
- Added Fixes tag
- CC'ed stable
[1] https://lore.kernel.org/all/[email protected]/
mm/mm_init.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
mm/mm_init.c +10 -0
@@ -2245,6 +2245,16 @@ void __init init_cma_reserved_pageblock(struct page *page)set_pageblock_migratetype (page,MIGRATE_CMA );set_page_refcounted (page); + +/* pages were reserved and not allocated */ +if (mem_alloc_profiling_enabled ()) { +union codetag_ref *ref =get_page_tag_ref (page); + +if (ref) { +set_codetag_empty (ref); +put_page_tag_ref (ref); + } + }__free_pages (page, pageblock_order);adjust_managed_page_count (page, pageblock_nr_pages);
base-commit: d74da846046aeec9333e802f5918bd3261fb5509
Signature · 1 line
2.46.0.76.ge559c4bf1a-goog
Quoted 26 lines · Suren Baghdasaryan
During CMA activation, pages in CMA area are prepared and then freed without being allocated. This triggers warnings when memory allocation debug config (
CONFIG_MEM_ALLOC_PROFILING_DEBUG) is enabled. Fix this by marking these pages not tagged before freeing them.Fixes d224eb0287fb ("codetag: debug: mark codetags for reserved pages as empty")Signed-off-by Suren Baghdasaryan <[email protected]>Cc [email protected] # v6.10---
changes since v1 [1]
- Added Fixes tag
- CC'ed stable[1] https://lore.kernel.org/all/[email protected]/
mm/mm_init.c | 10 ++++++++++ 1 file changed, 10 insertions(+)mm/mm_init.c +0
-0@@ -2245,6 +2245,16 @@ void __init init_cma_reserved_pageblock(struct page *page)set_pageblock_migratetype (page,MIGRATE_CMA );set_page_refcounted (page);
mm/mm_init.c void __init init_cma_reserved_pageblock(struct page *page) · line 2257
Quoted 10 lines
mm/mm_init.c +10
-0+ +/* pages were reserved and not allocated */ +if (mem_alloc_profiling_enabled ()) { +union codetag_ref *ref =get_page_tag_ref (page); + +if (ref) { +set_codetag_empty (ref); +put_page_tag_ref (ref); + } + }
Should we have a helper like clear_page_tag_ref() that wraps this?
Signature · 3 lines
Cheers, David / dhildenb
Quoted 26 lines · David Hildenbrand
Quoted 24 lines · Suren Baghdasaryan
During CMA activation, pages in CMA area are prepared and then freed without being allocated. This triggers warnings when memory allocation debug config (
CONFIG_MEM_ALLOC_PROFILING_DEBUG) is enabled. Fix this by marking these pages not tagged before freeing them.Fixes d224eb0287fb ("codetag: debug: mark codetags for reserved pages as empty")Signed-off-by Suren Baghdasaryan <[email protected]>Cc [email protected] # v6.10---
changes since v1 [1]
- Added Fixes tag
- CC'ed stable[1] https://lore.kernel.org/all/[email protected]/
mm/mm_init.c | 10 ++++++++++ 1 file changed, 10 insertions(+)mm/mm_init.c +0
-0@@ -2245,6 +2245,16 @@ void __init init_cma_reserved_pageblock(struct page *page)
Quoted 14 lines
mm/mm_init.c void __init init_cma_reserved_pageblock(struct page *page) · line 2257
Quoted 12 lines
mm/mm_init.c +10
-0set_pageblock_migratetype (page,MIGRATE_CMA );set_page_refcounted (page); + +/* pages were reserved and not allocated */ +if (mem_alloc_profiling_enabled ()) { +union codetag_ref *ref =get_page_tag_ref (page); + +if (ref) { +set_codetag_empty (ref); +put_page_tag_ref (ref); + } + }Should we have a helper like
clear_page_tag_ref()that wraps this?
With this one we have 3 instances of this sequence, so it makes sense to have a helper. I'm going to send a v3 with 2 patches - one introducing clear_page_tag_ref() and the next one adding this instance.
Thanks for the suggestion, David!
Quoted 6 lines
--
Cheers,David / dhildenb
Quoted 43 lines · Suren Baghdasaryan
Quoted 26 lines · David Hildenbrand
Quoted 24 lines · Suren Baghdasaryan
During CMA activation, pages in CMA area are prepared and then freed without being allocated. This triggers warnings when memory allocation debug config (
CONFIG_MEM_ALLOC_PROFILING_DEBUG) is enabled. Fix this by marking these pages not tagged before freeing them.Fixes d224eb0287fb ("codetag: debug: mark codetags for reserved pages as empty")Signed-off-by Suren Baghdasaryan <[email protected]>Cc [email protected] # v6.10---
changes since v1 [1]
- Added Fixes tag
- CC'ed stable[1] https://lore.kernel.org/all/[email protected]/
mm/mm_init.c | 10 ++++++++++ 1 file changed, 10 insertions(+)mm/mm_init.c +0
-0@@ -2245,6 +2245,16 @@ void __init init_cma_reserved_pageblock(struct page *page)Quoted 14 lines
mm/mm_init.c void __init init_cma_reserved_pageblock(struct page *page) · line 2257
Quoted 12 lines
mm/mm_init.c +10
-0set_pageblock_migratetype (page,MIGRATE_CMA );set_page_refcounted (page); + +/* pages were reserved and not allocated */ +if (mem_alloc_profiling_enabled ()) { +union codetag_ref *ref =get_page_tag_ref (page); + +if (ref) { +set_codetag_empty (ref); +put_page_tag_ref (ref); + } + }Should we have a helper like
clear_page_tag_ref()that wraps this?
Quoted 5 lines
With this one we have 3 instances of this sequence, so it makes sense to have a helper. I'm going to send a v3 with 2 patches - one introducing
clear_page_tag_ref()and the next one adding this instance.
Thanks for the suggestion, David!
v3 posted at https://lore.kernel.org/all/[email protected]/
Quoted 7 lines
Quoted 7 lines
--
Cheers,David / dhildenb