Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 17471
b: refs/heads/master
c: de5097c
h: refs/heads/master
i:
  17469: 03bd85e
  17467: d27381c
  17463: dbf1711
  17455: cf9e976
  17439: 47b7d68
  17407: bd354ad
v: v3
  • Loading branch information
Ingo Molnar authored and Ingo Molnar committed Jan 9, 2006
1 parent f07c19e commit c8f5f37
Show file tree
Hide file tree
Showing 8 changed files with 38 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 408894ee4dd4debfdedd472eb4d8414892fc90f6
refs/heads/master: de5097c2e73f826302cd8957c225b3725e0c7553
4 changes: 4 additions & 0 deletions trunk/arch/i386/mm/pageattr.c
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*/
Expand Down
19 changes: 19 additions & 0 deletions trunk/drivers/char/sysrq.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */

Expand Down Expand Up @@ -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,
Expand Down
4 changes: 4 additions & 0 deletions trunk/include/linux/mm.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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

Expand Down
5 changes: 5 additions & 0 deletions trunk/kernel/exit.c
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down Expand Up @@ -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();
Expand Down
1 change: 1 addition & 0 deletions trunk/kernel/sched.c
Original file line number Diff line number Diff line change
Expand Up @@ -4386,6 +4386,7 @@ void show_state(void)
} while_each_thread(g, p);

read_unlock(&tasklist_lock);
mutex_debug_show_all_locks();
}

/**
Expand Down
3 changes: 3 additions & 0 deletions trunk/mm/page_alloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -415,6 +415,9 @@ static void __free_pages_ok(struct page *page, unsigned int order)
int reserved = 0;

arch_free_page(page, order);
if (!PageHighMem(page))
mutex_debug_check_no_locks_freed(page_address(page),
page_address(page+(1<<order)));

#ifndef CONFIG_MMU
for (i = 1 ; i < (1 << order) ; ++i)
Expand Down
1 change: 1 addition & 0 deletions trunk/mm/slab.c
Original file line number Diff line number Diff line change
Expand Up @@ -3071,6 +3071,7 @@ void kfree(const void *objp)
local_irq_save(flags);
kfree_debugcheck(objp);
c = page_get_cache(virt_to_page(objp));
mutex_debug_check_no_locks_freed(objp, objp+obj_reallen(c));
__cache_free(c, (void *)objp);
local_irq_restore(flags);
}
Expand Down

0 comments on commit c8f5f37

Please sign in to comment.