Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit de5097c2 authored by Ingo Molnar's avatar Ingo Molnar Committed by Ingo Molnar
Browse files

[PATCH] mutex subsystem, more debugging code



more mutex debugging: check for held locks during memory freeing,
task exit, enable sysrq printouts, etc.

Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
Signed-off-by: default avatarArjan van de Ven <arjan@infradead.org>
parent 408894ee
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -222,6 +222,10 @@ void kernel_map_pages(struct page *page, int numpages, int enable)
{
	if (PageHighMem(page))
		return;
	if (!enable)
		mutex_debug_check_no_locks_freed(page_address(page),
						 page_address(page+numpages));

	/* the return value is ignored - the calls cannot fail,
	 * large pages are disabled at boot time.
	 */
+19 −0
Original line number Diff line number Diff line
@@ -153,6 +153,21 @@ static struct sysrq_key_op sysrq_mountro_op = {

/* END SYNC SYSRQ HANDLERS BLOCK */

#ifdef CONFIG_DEBUG_MUTEXES

static void
sysrq_handle_showlocks(int key, struct pt_regs *pt_regs, struct tty_struct *tty)
{
	mutex_debug_show_all_locks();
}

static struct sysrq_key_op sysrq_showlocks_op = {
	.handler	= sysrq_handle_showlocks,
	.help_msg	= "show-all-locks(D)",
	.action_msg	= "Show Locks Held",
};

#endif

/* SHOW SYSRQ HANDLERS BLOCK */

@@ -294,7 +309,11 @@ static struct sysrq_key_op *sysrq_key_table[SYSRQ_KEY_TABLE_LENGTH] = {
#else
/* c */	NULL,
#endif
#ifdef CONFIG_DEBUG_MUTEXES
/* d */ &sysrq_showlocks_op,
#else
/* d */ NULL,
#endif
/* e */	&sysrq_term_op,
/* f */	&sysrq_moom_op,
/* g */	NULL,
+4 −0
Original line number Diff line number Diff line
@@ -13,6 +13,7 @@
#include <linux/rbtree.h>
#include <linux/prio_tree.h>
#include <linux/fs.h>
#include <linux/mutex.h>

struct mempolicy;
struct anon_vma;
@@ -1024,6 +1025,9 @@ static inline void vm_stat_account(struct mm_struct *mm,
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),
						 page_address(page + numpages));
}
#endif

+5 −0
Original line number Diff line number Diff line
@@ -29,6 +29,7 @@
#include <linux/syscalls.h>
#include <linux/signal.h>
#include <linux/cn_proc.h>
#include <linux/mutex.h>

#include <asm/uaccess.h>
#include <asm/unistd.h>
@@ -869,6 +870,10 @@ fastcall NORET_TYPE void do_exit(long code)
	mpol_free(tsk->mempolicy);
	tsk->mempolicy = NULL;
#endif
	/*
	 * If DEBUG_MUTEXES is on, make sure we are holding no locks:
	 */
	mutex_debug_check_no_locks_held(tsk);

	/* PF_DEAD causes final put_task_struct after we schedule. */
	preempt_disable();
+1 −0
Original line number Diff line number Diff line
@@ -4386,6 +4386,7 @@ void show_state(void)
	} while_each_thread(g, p);

	read_unlock(&tasklist_lock);
	mutex_debug_show_all_locks();
}

/**
Loading