aboutsummaryrefslogtreecommitdiffstats
path: root/mm/kmemleak.c
diff options
context:
space:
mode:
authorCatalin Marinas <catalin.marinas@arm.com>2009-08-27 09:29:16 -0400
committerCatalin Marinas <catalin.marinas@arm.com>2009-08-27 09:29:16 -0400
commita6186d89c913b176e7339f37a4ec6ccb38b2c5c0 (patch)
tree0639a35036063c1a5f05c68817fbb4c49aeb2bd9 /mm/kmemleak.c
parent189d84ed54bbb05aac5b24d9d784d86c4d37f807 (diff)
kmemleak: Mark the early log buffer as __initdata
This buffer isn't needed after kmemleak was initialised so it can be freed together with the .init.data section. This patch also marks functions conditionally accessing the early log variables with __ref. Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Diffstat (limited to 'mm/kmemleak.c')
-rw-r--r--mm/kmemleak.c26
1 files changed, 14 insertions, 12 deletions
diff --git a/mm/kmemleak.c b/mm/kmemleak.c
index c977f7a2f0e4..576c0a4cec52 100644
--- a/mm/kmemleak.c
+++ b/mm/kmemleak.c
@@ -232,8 +232,9 @@ struct early_log {
232}; 232};
233 233
234/* early logging buffer and current position */ 234/* early logging buffer and current position */
235static struct early_log early_log[CONFIG_DEBUG_KMEMLEAK_EARLY_LOG_SIZE]; 235static struct early_log
236static int crt_early_log; 236 early_log[CONFIG_DEBUG_KMEMLEAK_EARLY_LOG_SIZE] __initdata;
237static int crt_early_log __initdata;
237 238
238static void kmemleak_disable(void); 239static void kmemleak_disable(void);
239 240
@@ -718,8 +719,8 @@ static void object_no_scan(unsigned long ptr)
718 * Log an early kmemleak_* call to the early_log buffer. These calls will be 719 * Log an early kmemleak_* call to the early_log buffer. These calls will be
719 * processed later once kmemleak is fully initialized. 720 * processed later once kmemleak is fully initialized.
720 */ 721 */
721static void log_early(int op_type, const void *ptr, size_t size, 722static void __init log_early(int op_type, const void *ptr, size_t size,
722 int min_count, unsigned long offset, size_t length) 723 int min_count, unsigned long offset, size_t length)
723{ 724{
724 unsigned long flags; 725 unsigned long flags;
725 struct early_log *log; 726 struct early_log *log;
@@ -751,7 +752,8 @@ static void log_early(int op_type, const void *ptr, size_t size,
751 * kernel allocators when a new block is allocated (kmem_cache_alloc, kmalloc, 752 * kernel allocators when a new block is allocated (kmem_cache_alloc, kmalloc,
752 * vmalloc etc.). 753 * vmalloc etc.).
753 */ 754 */
754void kmemleak_alloc(const void *ptr, size_t size, int min_count, gfp_t gfp) 755void __ref kmemleak_alloc(const void *ptr, size_t size, int min_count,
756 gfp_t gfp)
755{ 757{
756 pr_debug("%s(0x%p, %zu, %d)\n", __func__, ptr, size, min_count); 758 pr_debug("%s(0x%p, %zu, %d)\n", __func__, ptr, size, min_count);
757 759
@@ -766,7 +768,7 @@ EXPORT_SYMBOL_GPL(kmemleak_alloc);
766 * Memory freeing function callback. This function is called from the kernel 768 * Memory freeing function callback. This function is called from the kernel
767 * allocators when a block is freed (kmem_cache_free, kfree, vfree etc.). 769 * allocators when a block is freed (kmem_cache_free, kfree, vfree etc.).
768 */ 770 */
769void kmemleak_free(const void *ptr) 771void __ref kmemleak_free(const void *ptr)
770{ 772{
771 pr_debug("%s(0x%p)\n", __func__, ptr); 773 pr_debug("%s(0x%p)\n", __func__, ptr);
772 774
@@ -781,7 +783,7 @@ EXPORT_SYMBOL_GPL(kmemleak_free);
781 * Partial memory freeing function callback. This function is usually called 783 * Partial memory freeing function callback. This function is usually called
782 * from bootmem allocator when (part of) a memory block is freed. 784 * from bootmem allocator when (part of) a memory block is freed.
783 */ 785 */
784void kmemleak_free_part(const void *ptr, size_t size) 786void __ref kmemleak_free_part(const void *ptr, size_t size)
785{ 787{
786 pr_debug("%s(0x%p)\n", __func__, ptr); 788 pr_debug("%s(0x%p)\n", __func__, ptr);
787 789
@@ -796,7 +798,7 @@ EXPORT_SYMBOL_GPL(kmemleak_free_part);
796 * Mark an already allocated memory block as a false positive. This will cause 798 * Mark an already allocated memory block as a false positive. This will cause
797 * the block to no longer be reported as leak and always be scanned. 799 * the block to no longer be reported as leak and always be scanned.
798 */ 800 */
799void kmemleak_not_leak(const void *ptr) 801void __ref kmemleak_not_leak(const void *ptr)
800{ 802{
801 pr_debug("%s(0x%p)\n", __func__, ptr); 803 pr_debug("%s(0x%p)\n", __func__, ptr);
802 804
@@ -812,7 +814,7 @@ EXPORT_SYMBOL(kmemleak_not_leak);
812 * corresponding block is not a leak and does not contain any references to 814 * corresponding block is not a leak and does not contain any references to
813 * other allocated memory blocks. 815 * other allocated memory blocks.
814 */ 816 */
815void kmemleak_ignore(const void *ptr) 817void __ref kmemleak_ignore(const void *ptr)
816{ 818{
817 pr_debug("%s(0x%p)\n", __func__, ptr); 819 pr_debug("%s(0x%p)\n", __func__, ptr);
818 820
@@ -826,8 +828,8 @@ EXPORT_SYMBOL(kmemleak_ignore);
826/* 828/*
827 * Limit the range to be scanned in an allocated memory block. 829 * Limit the range to be scanned in an allocated memory block.
828 */ 830 */
829void kmemleak_scan_area(const void *ptr, unsigned long offset, size_t length, 831void __ref kmemleak_scan_area(const void *ptr, unsigned long offset,
830 gfp_t gfp) 832 size_t length, gfp_t gfp)
831{ 833{
832 pr_debug("%s(0x%p)\n", __func__, ptr); 834 pr_debug("%s(0x%p)\n", __func__, ptr);
833 835
@@ -841,7 +843,7 @@ EXPORT_SYMBOL(kmemleak_scan_area);
841/* 843/*
842 * Inform kmemleak not to scan the given memory block. 844 * Inform kmemleak not to scan the given memory block.
843 */ 845 */
844void kmemleak_no_scan(const void *ptr) 846void __ref kmemleak_no_scan(const void *ptr)
845{ 847{
846 pr_debug("%s(0x%p)\n", __func__, ptr); 848 pr_debug("%s(0x%p)\n", __func__, ptr);
847 849