diff options
author | Pavel Emelyanov <xemul@openvz.org> | 2007-10-19 02:40:40 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-10-19 14:53:43 -0400 |
commit | ba25f9dcc4ea6e30839fcab5a5516f2176d5bfed (patch) | |
tree | 3123c03b25dd5c0cd24b6ab4fc16731217838157 /kernel/lockdep.c | |
parent | 9a2e70572e94e21e7ec4186702d045415422bda0 (diff) |
Use helpers to obtain task pid in printks
The task_struct->pid member is going to be deprecated, so start
using the helpers (task_pid_nr/task_pid_vnr/task_pid_nr_ns) in
the kernel.
The first thing to start with is the pid, printed to dmesg - in
this case we may safely use task_pid_nr(). Besides, printks produce
more (much more) than a half of all the explicit pid usage.
[akpm@linux-foundation.org: git-drm went and changed lots of stuff]
Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
Cc: Dave Airlie <airlied@linux.ie>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'kernel/lockdep.c')
-rw-r--r-- | kernel/lockdep.c | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/kernel/lockdep.c b/kernel/lockdep.c index b5392ff7e6a6..55fe0c7cd95f 100644 --- a/kernel/lockdep.c +++ b/kernel/lockdep.c | |||
@@ -511,11 +511,11 @@ static void lockdep_print_held_locks(struct task_struct *curr) | |||
511 | int i, depth = curr->lockdep_depth; | 511 | int i, depth = curr->lockdep_depth; |
512 | 512 | ||
513 | if (!depth) { | 513 | if (!depth) { |
514 | printk("no locks held by %s/%d.\n", curr->comm, curr->pid); | 514 | printk("no locks held by %s/%d.\n", curr->comm, task_pid_nr(curr)); |
515 | return; | 515 | return; |
516 | } | 516 | } |
517 | printk("%d lock%s held by %s/%d:\n", | 517 | printk("%d lock%s held by %s/%d:\n", |
518 | depth, depth > 1 ? "s" : "", curr->comm, curr->pid); | 518 | depth, depth > 1 ? "s" : "", curr->comm, task_pid_nr(curr)); |
519 | 519 | ||
520 | for (i = 0; i < depth; i++) { | 520 | for (i = 0; i < depth; i++) { |
521 | printk(" #%d: ", i); | 521 | printk(" #%d: ", i); |
@@ -904,7 +904,7 @@ print_circular_bug_header(struct lock_list *entry, unsigned int depth) | |||
904 | print_kernel_version(); | 904 | print_kernel_version(); |
905 | printk( "-------------------------------------------------------\n"); | 905 | printk( "-------------------------------------------------------\n"); |
906 | printk("%s/%d is trying to acquire lock:\n", | 906 | printk("%s/%d is trying to acquire lock:\n", |
907 | curr->comm, curr->pid); | 907 | curr->comm, task_pid_nr(curr)); |
908 | print_lock(check_source); | 908 | print_lock(check_source); |
909 | printk("\nbut task is already holding lock:\n"); | 909 | printk("\nbut task is already holding lock:\n"); |
910 | print_lock(check_target); | 910 | print_lock(check_target); |
@@ -1085,7 +1085,7 @@ print_bad_irq_dependency(struct task_struct *curr, | |||
1085 | print_kernel_version(); | 1085 | print_kernel_version(); |
1086 | printk( "------------------------------------------------------\n"); | 1086 | printk( "------------------------------------------------------\n"); |
1087 | printk("%s/%d [HC%u[%lu]:SC%u[%lu]:HE%u:SE%u] is trying to acquire:\n", | 1087 | printk("%s/%d [HC%u[%lu]:SC%u[%lu]:HE%u:SE%u] is trying to acquire:\n", |
1088 | curr->comm, curr->pid, | 1088 | curr->comm, task_pid_nr(curr), |
1089 | curr->hardirq_context, hardirq_count() >> HARDIRQ_SHIFT, | 1089 | curr->hardirq_context, hardirq_count() >> HARDIRQ_SHIFT, |
1090 | curr->softirq_context, softirq_count() >> SOFTIRQ_SHIFT, | 1090 | curr->softirq_context, softirq_count() >> SOFTIRQ_SHIFT, |
1091 | curr->hardirqs_enabled, | 1091 | curr->hardirqs_enabled, |
@@ -1237,7 +1237,7 @@ print_deadlock_bug(struct task_struct *curr, struct held_lock *prev, | |||
1237 | print_kernel_version(); | 1237 | print_kernel_version(); |
1238 | printk( "---------------------------------------------\n"); | 1238 | printk( "---------------------------------------------\n"); |
1239 | printk("%s/%d is trying to acquire lock:\n", | 1239 | printk("%s/%d is trying to acquire lock:\n", |
1240 | curr->comm, curr->pid); | 1240 | curr->comm, task_pid_nr(curr)); |
1241 | print_lock(next); | 1241 | print_lock(next); |
1242 | printk("\nbut task is already holding lock:\n"); | 1242 | printk("\nbut task is already holding lock:\n"); |
1243 | print_lock(prev); | 1243 | print_lock(prev); |
@@ -1641,7 +1641,7 @@ print_usage_bug(struct task_struct *curr, struct held_lock *this, | |||
1641 | usage_str[prev_bit], usage_str[new_bit]); | 1641 | usage_str[prev_bit], usage_str[new_bit]); |
1642 | 1642 | ||
1643 | printk("%s/%d [HC%u[%lu]:SC%u[%lu]:HE%u:SE%u] takes:\n", | 1643 | printk("%s/%d [HC%u[%lu]:SC%u[%lu]:HE%u:SE%u] takes:\n", |
1644 | curr->comm, curr->pid, | 1644 | curr->comm, task_pid_nr(curr), |
1645 | trace_hardirq_context(curr), hardirq_count() >> HARDIRQ_SHIFT, | 1645 | trace_hardirq_context(curr), hardirq_count() >> HARDIRQ_SHIFT, |
1646 | trace_softirq_context(curr), softirq_count() >> SOFTIRQ_SHIFT, | 1646 | trace_softirq_context(curr), softirq_count() >> SOFTIRQ_SHIFT, |
1647 | trace_hardirqs_enabled(curr), | 1647 | trace_hardirqs_enabled(curr), |
@@ -1694,7 +1694,7 @@ print_irq_inversion_bug(struct task_struct *curr, struct lock_class *other, | |||
1694 | print_kernel_version(); | 1694 | print_kernel_version(); |
1695 | printk( "---------------------------------------------------------\n"); | 1695 | printk( "---------------------------------------------------------\n"); |
1696 | printk("%s/%d just changed the state of lock:\n", | 1696 | printk("%s/%d just changed the state of lock:\n", |
1697 | curr->comm, curr->pid); | 1697 | curr->comm, task_pid_nr(curr)); |
1698 | print_lock(this); | 1698 | print_lock(this); |
1699 | if (forwards) | 1699 | if (forwards) |
1700 | printk("but this lock took another, %s-irq-unsafe lock in the past:\n", irqclass); | 1700 | printk("but this lock took another, %s-irq-unsafe lock in the past:\n", irqclass); |
@@ -2487,7 +2487,7 @@ print_unlock_inbalance_bug(struct task_struct *curr, struct lockdep_map *lock, | |||
2487 | printk( "[ BUG: bad unlock balance detected! ]\n"); | 2487 | printk( "[ BUG: bad unlock balance detected! ]\n"); |
2488 | printk( "-------------------------------------\n"); | 2488 | printk( "-------------------------------------\n"); |
2489 | printk("%s/%d is trying to release lock (", | 2489 | printk("%s/%d is trying to release lock (", |
2490 | curr->comm, curr->pid); | 2490 | curr->comm, task_pid_nr(curr)); |
2491 | print_lockdep_cache(lock); | 2491 | print_lockdep_cache(lock); |
2492 | printk(") at:\n"); | 2492 | printk(") at:\n"); |
2493 | print_ip_sym(ip); | 2493 | print_ip_sym(ip); |
@@ -2737,7 +2737,7 @@ print_lock_contention_bug(struct task_struct *curr, struct lockdep_map *lock, | |||
2737 | printk( "[ BUG: bad contention detected! ]\n"); | 2737 | printk( "[ BUG: bad contention detected! ]\n"); |
2738 | printk( "---------------------------------\n"); | 2738 | printk( "---------------------------------\n"); |
2739 | printk("%s/%d is trying to contend lock (", | 2739 | printk("%s/%d is trying to contend lock (", |
2740 | curr->comm, curr->pid); | 2740 | curr->comm, task_pid_nr(curr)); |
2741 | print_lockdep_cache(lock); | 2741 | print_lockdep_cache(lock); |
2742 | printk(") at:\n"); | 2742 | printk(") at:\n"); |
2743 | print_ip_sym(ip); | 2743 | print_ip_sym(ip); |
@@ -3072,7 +3072,7 @@ print_freed_lock_bug(struct task_struct *curr, const void *mem_from, | |||
3072 | printk( "[ BUG: held lock freed! ]\n"); | 3072 | printk( "[ BUG: held lock freed! ]\n"); |
3073 | printk( "-------------------------\n"); | 3073 | printk( "-------------------------\n"); |
3074 | printk("%s/%d is freeing memory %p-%p, with a lock still held there!\n", | 3074 | printk("%s/%d is freeing memory %p-%p, with a lock still held there!\n", |
3075 | curr->comm, curr->pid, mem_from, mem_to-1); | 3075 | curr->comm, task_pid_nr(curr), mem_from, mem_to-1); |
3076 | print_lock(hlock); | 3076 | print_lock(hlock); |
3077 | lockdep_print_held_locks(curr); | 3077 | lockdep_print_held_locks(curr); |
3078 | 3078 | ||
@@ -3125,7 +3125,7 @@ static void print_held_locks_bug(struct task_struct *curr) | |||
3125 | printk( "[ BUG: lock held at task exit time! ]\n"); | 3125 | printk( "[ BUG: lock held at task exit time! ]\n"); |
3126 | printk( "-------------------------------------\n"); | 3126 | printk( "-------------------------------------\n"); |
3127 | printk("%s/%d is exiting with locks still held!\n", | 3127 | printk("%s/%d is exiting with locks still held!\n", |
3128 | curr->comm, curr->pid); | 3128 | curr->comm, task_pid_nr(curr)); |
3129 | lockdep_print_held_locks(curr); | 3129 | lockdep_print_held_locks(curr); |
3130 | 3130 | ||
3131 | printk("\nstack backtrace:\n"); | 3131 | printk("\nstack backtrace:\n"); |