[patch 02/10] PI-futex: introduce debug_check_no_locks_freed()

From: Ingo Molnar
Date: Sat Mar 25 2006 - 13:45:49 EST



add debug_check_no_locks_freed(), as a central inline to add
bad-lock-free-debugging functionality to.

Signed-off-by: Ingo Molnar <mingo@xxxxxxx>
Signed-off-by: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
Signed-off-by: Arjan van de Ven <arjan@xxxxxxxxxxxxxxx>

----

arch/i386/mm/pageattr.c | 4 ++--
include/linux/mm.h | 10 ++++++++--
mm/page_alloc.c | 4 ++--
mm/slab.c | 2 +-
4 files changed, 13 insertions(+), 7 deletions(-)

Index: linux-pi-futex.mm.q/arch/i386/mm/pageattr.c
===================================================================
--- linux-pi-futex.mm.q.orig/arch/i386/mm/pageattr.c
+++ linux-pi-futex.mm.q/arch/i386/mm/pageattr.c
@@ -229,8 +229,8 @@ void kernel_map_pages(struct page *page,
if (PageHighMem(page))
return;
if (!enable)
- mutex_debug_check_no_locks_freed(page_address(page),
- numpages * PAGE_SIZE);
+ debug_check_no_locks_freed(page_address(page),
+ numpages * PAGE_SIZE);

/* the return value is ignored - the calls cannot fail,
* large pages are disabled at boot time.
Index: linux-pi-futex.mm.q/include/linux/mm.h
===================================================================
--- linux-pi-futex.mm.q.orig/include/linux/mm.h
+++ linux-pi-futex.mm.q/include/linux/mm.h
@@ -1066,13 +1066,19 @@ static inline void vm_stat_account(struc
}
#endif /* CONFIG_PROC_FS */

+static inline void
+debug_check_no_locks_freed(const void *from, unsigned long len)
+{
+ mutex_debug_check_no_locks_freed(from, len);
+}
+
#ifndef CONFIG_DEBUG_PAGEALLOC
static inline void
kernel_map_pages(struct page *page, int numpages, int enable)
{
if (!PageHighMem(page) && !enable)
- mutex_debug_check_no_locks_freed(page_address(page),
- numpages * PAGE_SIZE);
+ debug_check_no_locks_freed(page_address(page),
+ numpages * PAGE_SIZE);
}
#endif

Index: linux-pi-futex.mm.q/mm/page_alloc.c
===================================================================
--- linux-pi-futex.mm.q.orig/mm/page_alloc.c
+++ linux-pi-futex.mm.q/mm/page_alloc.c
@@ -447,8 +447,8 @@ static void __free_pages_ok(struct page

arch_free_page(page, order);
if (!PageHighMem(page))
- mutex_debug_check_no_locks_freed(page_address(page),
- PAGE_SIZE<<order);
+ debug_check_no_locks_freed(page_address(page),
+ PAGE_SIZE<<order);

for (i = 0 ; i < (1 << order) ; ++i)
reserved += free_pages_check(page + i);
Index: linux-pi-futex.mm.q/mm/slab.c
===================================================================
--- linux-pi-futex.mm.q.orig/mm/slab.c
+++ linux-pi-futex.mm.q/mm/slab.c
@@ -3390,7 +3390,7 @@ void kfree(const void *objp)
local_irq_save(flags);
kfree_debugcheck(objp);
c = virt_to_cache(objp);
- mutex_debug_check_no_locks_freed(objp, obj_size(c));
+ debug_check_no_locks_freed(objp, obj_size(c));
__cache_free(c, (void *)objp);
local_irq_restore(flags);
}
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/