The patch titled Subject: kmemleak-enable-tracking-for-percpu-pointers-v2 has been added to the -mm mm-unstable branch. Its filename is kmemleak-enable-tracking-for-percpu-pointers-v2.patch This patch will shortly appear at https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/kmemleak-enable-tracking-for-percpu-pointers-v2.patch This patch will later appear in the mm-unstable branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/process/submit-checklist.rst when testing your code *** The -mm tree is included into linux-next via the mm-everything branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm and is updated there every 2-3 working days ------------------------------------------------------ From: Pavel Tikhomirov <ptikhomirov@xxxxxxxxxxxxx> Subject: kmemleak-enable-tracking-for-percpu-pointers-v2 Date: Wed, 31 Jul 2024 10:54:09 +0800 rename confusing scan_pointer to pointer_update_refs and move it just after update_refs Link: https://lkml.kernel.org/r/20240731025526.157529-2-ptikhomirov@xxxxxxxxxxxxx Signed-off-by: Pavel Tikhomirov <ptikhomirov@xxxxxxxxxxxxx> Reviewed-by: Catalin Marinas <catalin.marinas@xxxxxxx> Cc: Wei Yongjun <weiyongjun1@xxxxxxxxxx> Cc: Chen Jun <chenjun102@xxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- mm/kmemleak.c | 48 ++++++++++++++++++++++++------------------------ 1 file changed, 24 insertions(+), 24 deletions(-) --- a/mm/kmemleak.c~kmemleak-enable-tracking-for-percpu-pointers-v2 +++ a/mm/kmemleak.c @@ -1362,28 +1362,7 @@ static void update_refs(struct kmemleak_ } } -/* - * Memory scanning is a long process and it needs to be interruptible. This - * function checks whether such interrupt condition occurred. - */ -static int scan_should_stop(void) -{ - if (!kmemleak_enabled) - return 1; - - /* - * This function may be called from either process or kthread context, - * hence the need to check for both stop conditions. - */ - if (current->mm) - return signal_pending(current); - else - return kthread_should_stop(); - - return 0; -} - -static void scan_pointer(struct kmemleak_object *scanned, +static void pointer_update_refs(struct kmemleak_object *scanned, unsigned long pointer, unsigned int objflags) { struct kmemleak_object *object; @@ -1442,6 +1421,27 @@ static void scan_pointer(struct kmemleak } /* + * Memory scanning is a long process and it needs to be interruptible. This + * function checks whether such interrupt condition occurred. + */ +static int scan_should_stop(void) +{ + if (!kmemleak_enabled) + return 1; + + /* + * This function may be called from either process or kthread context, + * hence the need to check for both stop conditions. + */ + if (current->mm) + return signal_pending(current); + else + return kthread_should_stop(); + + return 0; +} + +/* * Scan a memory block (exclusive range) for valid pointers and add those * found to the gray list. */ @@ -1464,8 +1464,8 @@ static void scan_block(void *_start, voi pointer = *(unsigned long *)kasan_reset_tag((void *)ptr); kasan_enable_current(); - scan_pointer(scanned, pointer, 0); - scan_pointer(scanned, pointer, OBJECT_PERCPU); + pointer_update_refs(scanned, pointer, 0); + pointer_update_refs(scanned, pointer, OBJECT_PERCPU); } raw_spin_unlock_irqrestore(&kmemleak_lock, flags); } _ Patches currently in -mm which might be from ptikhomirov@xxxxxxxxxxxxx are kmemleak-enable-tracking-for-percpu-pointers.patch kmemleak-enable-tracking-for-percpu-pointers-v2.patch kmemleak-test-add-percpu-leak.patch