[PATCH] codetag: debug: mark codetags for cma pages as empty

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Hao Ge <gehao@xxxxxxxxxx>

Here are some warnning

[    1.342603] ------------[ cut here ]------------
[    1.342608] alloc_tag was not set
[    1.342623] WARNING: CPU: 0 PID: 1 at ./include/linux/alloc_tag.h:130 __free_pages+0x1a4/0x1b4
[    1.342633] Modules linked in:
[    1.342639] CPU: 0 UID: 0 PID: 1 Comm: swapper/0 Not tainted 6.11.0-rc3+ #12
[    1.342645] pstate: 60400005 (nZCv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--)
[    1.342650] pc : __free_pages+0x1a4/0x1b4
[    1.342654] lr : __free_pages+0x1a4/0x1b4
[    1.342658] sp : ffff8000833dbcb0
[    1.342661] x29: ffff8000833dbcb0 x28: ffff000b34d9dac0 x27: ffff80008175f000
[    1.342669] x26: 00000000000fc000 x25: ffff800082ac6028 x24: ffff80008252e000
[    1.342675] x23: ffff0000c0660000 x22: 0000000000000000 x21: 0000000000000009
[    1.342681] x20: 0000000000000000 x19: fffffd7fc3ac0000 x18: ffffffffffffffff
[    1.342688] x17: ffff80008105bf68 x16: ffff800081841bb4 x15: 0720072007200720
[    1.342694] x14: 0720072007200720 x13: 0720072007200720 x12: 0720072007200720
[    1.342700] x11: 0720072007200720 x10: 0720072007200720 x9 : 0720072007200720
[    1.342706] x8 : 0720072007200720 x7 : ffff80008237bad0 x6 : c0000000ffff7fff
[    1.342712] x5 : ffff80008237ba78 x4 : ffff8000820bbad0 x3 : 0000000000000001
[    1.342719] x2 : 13c63f521095dc00 x1 : 13c63f521095dc00 x0 : 0000000000000000
[    1.342725] Call trace:
[    1.342728]  __free_pages+0x1a4/0x1b4
[    1.342732]  init_cma_reserved_pageblock+0x5c/0xac
[    1.342739]  cma_init_reserved_areas+0x2b4/0x3f4
[    1.342744]  do_one_initcall+0x54/0x368
[    1.342749]  kernel_init_freeable+0x23c/0x450
[    1.342755]  kernel_init+0x2c/0x144
[    1.342760]  ret_from_fork+0x10/0x20
[    1.342764] ---[ end trace 0000000000000000 ]---

To avoid debug warnings while freeing cma pages which were not
allocated with usual allocators, mark their codetags as empty before
freeing.

Reference commit d224eb0287fb ("codetag: debug: mark codetags
for reserved pages as empty")

Fixes: 4b8736964640 ("mm/slab: add allocation accounting into slab allocation and free paths")
Signed-off-by: Hao Ge <gehao@xxxxxxxxxx>
---
 mm/mm_init.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/mm/mm_init.c b/mm/mm_init.c
index 75c3bd42799b..d7d40a8d738f 100644
--- a/mm/mm_init.c
+++ b/mm/mm_init.c
@@ -2243,6 +2243,16 @@ void __init init_cma_reserved_pageblock(struct page *page)
 		set_page_count(p, 0);
 	} while (++p, --i);
 
+	/* 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);
+		}
+	}
+
 	set_pageblock_migratetype(page, MIGRATE_CMA);
 	set_page_refcounted(page);
 	__free_pages(page, pageblock_order);
-- 
2.25.1





[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux