Skip to content

Commit 470c25f

Browse files
committed
mm: percpu: use kmemleak_ignore_phys() instead of kmemleak_free()
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2151065 commit a317ebc Author: Patrick Wang <patrick.wang.shcn@gmail.com> Date: Tue, 5 Jul 2022 19:31:58 +0800 mm: percpu: use kmemleak_ignore_phys() instead of kmemleak_free() Kmemleak recently added a rbtree to store the objects allocted with physical address. Those objects can't be freed with kmemleak_free(). According to the comments, percpu allocations are tracked by kmemleak separately. Kmemleak_free() was used to avoid the unnecessary tracking. If kmemleak_free() fails, those objects would be scanned by kmemleak, which is unnecessary but shouldn't lead to other effects. Use kmemleak_ignore_phys() instead of kmemleak_free() for those objects. Link: https://lkml.kernel.org/r/20220705113158.127600-1-patrick.wang.shcn@gmail.com Fixes: 0c24e06 ("mm: kmemleak: add rbtree and store physical address for objects allocated with PA") Signed-off-by: Patrick Wang <patrick.wang.shcn@gmail.com> Cc: Dennis Zhou <dennis@kernel.org> Cc: Tejun Heo <tj@kernel.org> Cc: Christoph Lameter <cl@linux.com> Cc: Catalin Marinas <catalin.marinas@arm.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Waiman Long <longman@redhat.com>
1 parent 421c8f5 commit 470c25f

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

mm/percpu.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3103,7 +3103,7 @@ int __init pcpu_embed_first_chunk(size_t reserved_size, size_t dyn_size,
31033103
goto out_free_areas;
31043104
}
31053105
/* kmemleak tracks the percpu allocations separately */
3106-
kmemleak_free(ptr);
3106+
kmemleak_ignore_phys(__pa(ptr));
31073107
areas[group] = ptr;
31083108

31093109
base = min(ptr, base);
@@ -3303,7 +3303,7 @@ int __init pcpu_page_first_chunk(size_t reserved_size, pcpu_fc_cpu_to_node_fn_t
33033303
goto enomem;
33043304
}
33053305
/* kmemleak tracks the percpu allocations separately */
3306-
kmemleak_free(ptr);
3306+
kmemleak_ignore_phys(__pa(ptr));
33073307
pages[j++] = virt_to_page(ptr);
33083308
}
33093309
}
@@ -3416,7 +3416,7 @@ void __init setup_per_cpu_areas(void)
34163416
if (!ai || !fc)
34173417
panic("Failed to allocate memory for percpu areas.");
34183418
/* kmemleak tracks the percpu allocations separately */
3419-
kmemleak_free(fc);
3419+
kmemleak_ignore_phys(__pa(fc));
34203420

34213421
ai->dyn_size = unit_size;
34223422
ai->unit_size = unit_size;

0 commit comments

Comments
 (0)