Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 158110
b: refs/heads/master
c: ef68102
h: refs/heads/master
v: v3
  • Loading branch information
Ming Lei authored and Peter Zijlstra committed Jul 24, 2009
1 parent 22a3af6 commit 7efc747
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 28 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 24208ca76707581a097c01a73fd63781e73d3404
refs/heads/master: ef681026ff85c49b7399ceec3eb62bbbcce605e8
52 changes: 25 additions & 27 deletions trunk/kernel/lockdep.c
Original file line number Diff line number Diff line change
Expand Up @@ -1115,61 +1115,59 @@ static noinline int print_bfs_bug(int ret)
return 0;
}

unsigned long __lockdep_count_forward_deps(struct lock_class *class,
unsigned int depth)
static int noop_count(struct lock_list *entry, void *data)
{
struct lock_list *entry;
unsigned long ret = 1;
(*(unsigned long *)data)++;
return 0;
}

if (lockdep_dependency_visit(class, depth))
return 0;
unsigned long __lockdep_count_forward_deps(struct lock_list *this)
{
unsigned long count = 0;
struct lock_list *uninitialized_var(target_entry);

/*
* Recurse this class's dependency list:
*/
list_for_each_entry(entry, &class->locks_after, entry)
ret += __lockdep_count_forward_deps(entry->class, depth + 1);
__bfs_forwards(this, (void *)&count, noop_count, &target_entry);

return ret;
return count;
}

unsigned long lockdep_count_forward_deps(struct lock_class *class)
{
unsigned long ret, flags;
struct lock_list this;

this.parent = NULL;
this.class = class;

local_irq_save(flags);
__raw_spin_lock(&lockdep_lock);
ret = __lockdep_count_forward_deps(class, 0);
ret = __lockdep_count_forward_deps(&this);
__raw_spin_unlock(&lockdep_lock);
local_irq_restore(flags);

return ret;
}

unsigned long __lockdep_count_backward_deps(struct lock_class *class,
unsigned int depth)
unsigned long __lockdep_count_backward_deps(struct lock_list *this)
{
struct lock_list *entry;
unsigned long ret = 1;
unsigned long count = 0;
struct lock_list *uninitialized_var(target_entry);

if (lockdep_dependency_visit(class, depth))
return 0;
/*
* Recurse this class's dependency list:
*/
list_for_each_entry(entry, &class->locks_before, entry)
ret += __lockdep_count_backward_deps(entry->class, depth + 1);
__bfs_backwards(this, (void *)&count, noop_count, &target_entry);

return ret;
return count;
}

unsigned long lockdep_count_backward_deps(struct lock_class *class)
{
unsigned long ret, flags;
struct lock_list this;

this.parent = NULL;
this.class = class;

local_irq_save(flags);
__raw_spin_lock(&lockdep_lock);
ret = __lockdep_count_backward_deps(class, 0);
ret = __lockdep_count_backward_deps(&this);
__raw_spin_unlock(&lockdep_lock);
local_irq_restore(flags);

Expand Down

0 comments on commit 7efc747

Please sign in to comment.