aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/linux/kmemleak.h6
-rw-r--r--mm/kmemleak.c9
-rw-r--r--mm/percpu.c2
3 files changed, 10 insertions, 7 deletions
diff --git a/include/linux/kmemleak.h b/include/linux/kmemleak.h
index e705467ddb47..d0a1f99e24e3 100644
--- a/include/linux/kmemleak.h
+++ b/include/linux/kmemleak.h
@@ -28,7 +28,8 @@
28extern void kmemleak_init(void) __ref; 28extern void kmemleak_init(void) __ref;
29extern void kmemleak_alloc(const void *ptr, size_t size, int min_count, 29extern void kmemleak_alloc(const void *ptr, size_t size, int min_count,
30 gfp_t gfp) __ref; 30 gfp_t gfp) __ref;
31extern void kmemleak_alloc_percpu(const void __percpu *ptr, size_t size) __ref; 31extern void kmemleak_alloc_percpu(const void __percpu *ptr, size_t size,
32 gfp_t gfp) __ref;
32extern void kmemleak_free(const void *ptr) __ref; 33extern void kmemleak_free(const void *ptr) __ref;
33extern void kmemleak_free_part(const void *ptr, size_t size) __ref; 34extern void kmemleak_free_part(const void *ptr, size_t size) __ref;
34extern void kmemleak_free_percpu(const void __percpu *ptr) __ref; 35extern void kmemleak_free_percpu(const void __percpu *ptr) __ref;
@@ -71,7 +72,8 @@ static inline void kmemleak_alloc_recursive(const void *ptr, size_t size,
71 gfp_t gfp) 72 gfp_t gfp)
72{ 73{
73} 74}
74static inline void kmemleak_alloc_percpu(const void __percpu *ptr, size_t size) 75static inline void kmemleak_alloc_percpu(const void __percpu *ptr, size_t size,
76 gfp_t gfp)
75{ 77{
76} 78}
77static inline void kmemleak_free(const void *ptr) 79static inline void kmemleak_free(const void *ptr)
diff --git a/mm/kmemleak.c b/mm/kmemleak.c
index 41df5b8efd25..3716cdb8ba42 100644
--- a/mm/kmemleak.c
+++ b/mm/kmemleak.c
@@ -909,12 +909,13 @@ EXPORT_SYMBOL_GPL(kmemleak_alloc);
909 * kmemleak_alloc_percpu - register a newly allocated __percpu object 909 * kmemleak_alloc_percpu - register a newly allocated __percpu object
910 * @ptr: __percpu pointer to beginning of the object 910 * @ptr: __percpu pointer to beginning of the object
911 * @size: size of the object 911 * @size: size of the object
912 * @gfp: flags used for kmemleak internal memory allocations
912 * 913 *
913 * This function is called from the kernel percpu allocator when a new object 914 * This function is called from the kernel percpu allocator when a new object
914 * (memory block) is allocated (alloc_percpu). It assumes GFP_KERNEL 915 * (memory block) is allocated (alloc_percpu).
915 * allocation.
916 */ 916 */
917void __ref kmemleak_alloc_percpu(const void __percpu *ptr, size_t size) 917void __ref kmemleak_alloc_percpu(const void __percpu *ptr, size_t size,
918 gfp_t gfp)
918{ 919{
919 unsigned int cpu; 920 unsigned int cpu;
920 921
@@ -927,7 +928,7 @@ void __ref kmemleak_alloc_percpu(const void __percpu *ptr, size_t size)
927 if (kmemleak_enabled && ptr && !IS_ERR(ptr)) 928 if (kmemleak_enabled && ptr && !IS_ERR(ptr))
928 for_each_possible_cpu(cpu) 929 for_each_possible_cpu(cpu)
929 create_object((unsigned long)per_cpu_ptr(ptr, cpu), 930 create_object((unsigned long)per_cpu_ptr(ptr, cpu),
930 size, 0, GFP_KERNEL); 931 size, 0, gfp);
931 else if (kmemleak_early_log) 932 else if (kmemleak_early_log)
932 log_early(KMEMLEAK_ALLOC_PERCPU, ptr, size, 0); 933 log_early(KMEMLEAK_ALLOC_PERCPU, ptr, size, 0);
933} 934}
diff --git a/mm/percpu.c b/mm/percpu.c
index dfd02484e8de..2dd74487a0af 100644
--- a/mm/percpu.c
+++ b/mm/percpu.c
@@ -1030,7 +1030,7 @@ area_found:
1030 memset((void *)pcpu_chunk_addr(chunk, cpu, 0) + off, 0, size); 1030 memset((void *)pcpu_chunk_addr(chunk, cpu, 0) + off, 0, size);
1031 1031
1032 ptr = __addr_to_pcpu_ptr(chunk->base_addr + off); 1032 ptr = __addr_to_pcpu_ptr(chunk->base_addr + off);
1033 kmemleak_alloc_percpu(ptr, size); 1033 kmemleak_alloc_percpu(ptr, size, gfp);
1034 return ptr; 1034 return ptr;
1035 1035
1036fail_unlock: 1036fail_unlock: