diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2013-11-14 02:30:30 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2013-11-14 02:30:30 -0500 |
commit | 5e30025a319910695f5010dc0fb53a23299da14d (patch) | |
tree | 4292bcf78de221c7de1774ccf5ad0ac5a9315c26 /kernel | |
parent | 7971e23a66c94f1b9bd2d64a3e86dfbfa8c60121 (diff) | |
parent | 90d3839b90fe379557dae4a44735a6af78f42885 (diff) |
Merge branch 'core-locking-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull core locking changes from Ingo Molnar:
"The biggest changes:
- add lockdep support for seqcount/seqlocks structures, this
unearthed both bugs and required extra annotation.
- move the various kernel locking primitives to the new
kernel/locking/ directory"
* 'core-locking-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (21 commits)
block: Use u64_stats_init() to initialize seqcounts
locking/lockdep: Mark __lockdep_count_forward_deps() as static
lockdep/proc: Fix lock-time avg computation
locking/doc: Update references to kernel/mutex.c
ipv6: Fix possible ipv6 seqlock deadlock
cpuset: Fix potential deadlock w/ set_mems_allowed
seqcount: Add lockdep functionality to seqcount/seqlock structures
net: Explicitly initialize u64_stats_sync structures for lockdep
locking: Move the percpu-rwsem code to kernel/locking/
locking: Move the lglocks code to kernel/locking/
locking: Move the rwsem code to kernel/locking/
locking: Move the rtmutex code to kernel/locking/
locking: Move the semaphore core to kernel/locking/
locking: Move the spinlock code to kernel/locking/
locking: Move the lockdep code to kernel/locking/
locking: Move the mutex code to kernel/locking/
hung_task debugging: Add tracepoint to report the hang
x86/locking/kconfig: Update paravirt spinlock Kconfig description
lockstat: Report avg wait and hold times
lockdep, x86/alternatives: Drop ancient lockdep fixup message
...
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/Makefile | 22 | ||||
-rw-r--r-- | kernel/futex.c | 2 | ||||
-rw-r--r-- | kernel/hung_task.c | 6 | ||||
-rw-r--r-- | kernel/locking/Makefile | 25 | ||||
-rw-r--r-- | kernel/locking/lglock.c (renamed from kernel/lglock.c) | 0 | ||||
-rw-r--r-- | kernel/locking/lockdep.c (renamed from kernel/lockdep.c) | 4 | ||||
-rw-r--r-- | kernel/locking/lockdep_internals.h (renamed from kernel/lockdep_internals.h) | 0 | ||||
-rw-r--r-- | kernel/locking/lockdep_proc.c (renamed from kernel/lockdep_proc.c) | 15 | ||||
-rw-r--r-- | kernel/locking/lockdep_states.h (renamed from kernel/lockdep_states.h) | 0 | ||||
-rw-r--r-- | kernel/locking/mutex-debug.c (renamed from kernel/mutex-debug.c) | 0 | ||||
-rw-r--r-- | kernel/locking/mutex-debug.h (renamed from kernel/mutex-debug.h) | 0 | ||||
-rw-r--r-- | kernel/locking/mutex.c (renamed from kernel/mutex.c) | 2 | ||||
-rw-r--r-- | kernel/locking/mutex.h (renamed from kernel/mutex.h) | 0 | ||||
-rw-r--r-- | kernel/locking/percpu-rwsem.c | 165 | ||||
-rw-r--r-- | kernel/locking/rtmutex-debug.c (renamed from kernel/rtmutex-debug.c) | 0 | ||||
-rw-r--r-- | kernel/locking/rtmutex-debug.h (renamed from kernel/rtmutex-debug.h) | 0 | ||||
-rw-r--r-- | kernel/locking/rtmutex-tester.c (renamed from kernel/rtmutex-tester.c) | 0 | ||||
-rw-r--r-- | kernel/locking/rtmutex.c (renamed from kernel/rtmutex.c) | 0 | ||||
-rw-r--r-- | kernel/locking/rtmutex.h (renamed from kernel/rtmutex.h) | 0 | ||||
-rw-r--r-- | kernel/locking/rtmutex_common.h (renamed from kernel/rtmutex_common.h) | 0 | ||||
-rw-r--r-- | kernel/locking/rwsem-spinlock.c | 296 | ||||
-rw-r--r-- | kernel/locking/rwsem-xadd.c | 293 | ||||
-rw-r--r-- | kernel/locking/rwsem.c (renamed from kernel/rwsem.c) | 0 | ||||
-rw-r--r-- | kernel/locking/semaphore.c (renamed from kernel/semaphore.c) | 0 | ||||
-rw-r--r-- | kernel/locking/spinlock.c (renamed from kernel/spinlock.c) | 0 | ||||
-rw-r--r-- | kernel/locking/spinlock_debug.c | 302 | ||||
-rw-r--r-- | kernel/rcu/tree_plugin.h | 2 | ||||
-rw-r--r-- | kernel/sysctl.c | 5 |
28 files changed, 1107 insertions, 32 deletions
diff --git a/kernel/Makefile b/kernel/Makefile index a4d1aa8da9bc..09a9c94f42bd 100644 --- a/kernel/Makefile +++ b/kernel/Makefile | |||
@@ -7,22 +7,19 @@ obj-y = fork.o exec_domain.o panic.o \ | |||
7 | sysctl.o sysctl_binary.o capability.o ptrace.o timer.o user.o \ | 7 | sysctl.o sysctl_binary.o capability.o ptrace.o timer.o user.o \ |
8 | signal.o sys.o kmod.o workqueue.o pid.o task_work.o \ | 8 | signal.o sys.o kmod.o workqueue.o pid.o task_work.o \ |
9 | extable.o params.o posix-timers.o \ | 9 | extable.o params.o posix-timers.o \ |
10 | kthread.o sys_ni.o posix-cpu-timers.o mutex.o \ | 10 | kthread.o sys_ni.o posix-cpu-timers.o \ |
11 | hrtimer.o rwsem.o nsproxy.o semaphore.o \ | 11 | hrtimer.o nsproxy.o \ |
12 | notifier.o ksysfs.o cred.o reboot.o \ | 12 | notifier.o ksysfs.o cred.o reboot.o \ |
13 | async.o range.o groups.o lglock.o smpboot.o | 13 | async.o range.o groups.o smpboot.o |
14 | 14 | ||
15 | ifdef CONFIG_FUNCTION_TRACER | 15 | ifdef CONFIG_FUNCTION_TRACER |
16 | # Do not trace debug files and internal ftrace files | 16 | # Do not trace debug files and internal ftrace files |
17 | CFLAGS_REMOVE_lockdep.o = -pg | ||
18 | CFLAGS_REMOVE_lockdep_proc.o = -pg | ||
19 | CFLAGS_REMOVE_mutex-debug.o = -pg | ||
20 | CFLAGS_REMOVE_rtmutex-debug.o = -pg | ||
21 | CFLAGS_REMOVE_cgroup-debug.o = -pg | 17 | CFLAGS_REMOVE_cgroup-debug.o = -pg |
22 | CFLAGS_REMOVE_irq_work.o = -pg | 18 | CFLAGS_REMOVE_irq_work.o = -pg |
23 | endif | 19 | endif |
24 | 20 | ||
25 | obj-y += sched/ | 21 | obj-y += sched/ |
22 | obj-y += locking/ | ||
26 | obj-y += power/ | 23 | obj-y += power/ |
27 | obj-y += printk/ | 24 | obj-y += printk/ |
28 | obj-y += cpu/ | 25 | obj-y += cpu/ |
@@ -34,26 +31,15 @@ obj-$(CONFIG_FREEZER) += freezer.o | |||
34 | obj-$(CONFIG_PROFILING) += profile.o | 31 | obj-$(CONFIG_PROFILING) += profile.o |
35 | obj-$(CONFIG_STACKTRACE) += stacktrace.o | 32 | obj-$(CONFIG_STACKTRACE) += stacktrace.o |
36 | obj-y += time/ | 33 | obj-y += time/ |
37 | obj-$(CONFIG_DEBUG_MUTEXES) += mutex-debug.o | ||
38 | obj-$(CONFIG_LOCKDEP) += lockdep.o | ||
39 | ifeq ($(CONFIG_PROC_FS),y) | ||
40 | obj-$(CONFIG_LOCKDEP) += lockdep_proc.o | ||
41 | endif | ||
42 | obj-$(CONFIG_FUTEX) += futex.o | 34 | obj-$(CONFIG_FUTEX) += futex.o |
43 | ifeq ($(CONFIG_COMPAT),y) | 35 | ifeq ($(CONFIG_COMPAT),y) |
44 | obj-$(CONFIG_FUTEX) += futex_compat.o | 36 | obj-$(CONFIG_FUTEX) += futex_compat.o |
45 | endif | 37 | endif |
46 | obj-$(CONFIG_RT_MUTEXES) += rtmutex.o | ||
47 | obj-$(CONFIG_DEBUG_RT_MUTEXES) += rtmutex-debug.o | ||
48 | obj-$(CONFIG_RT_MUTEX_TESTER) += rtmutex-tester.o | ||
49 | obj-$(CONFIG_GENERIC_ISA_DMA) += dma.o | 38 | obj-$(CONFIG_GENERIC_ISA_DMA) += dma.o |
50 | obj-$(CONFIG_SMP) += smp.o | 39 | obj-$(CONFIG_SMP) += smp.o |
51 | ifneq ($(CONFIG_SMP),y) | 40 | ifneq ($(CONFIG_SMP),y) |
52 | obj-y += up.o | 41 | obj-y += up.o |
53 | endif | 42 | endif |
54 | obj-$(CONFIG_SMP) += spinlock.o | ||
55 | obj-$(CONFIG_DEBUG_SPINLOCK) += spinlock.o | ||
56 | obj-$(CONFIG_PROVE_LOCKING) += spinlock.o | ||
57 | obj-$(CONFIG_UID16) += uid16.o | 43 | obj-$(CONFIG_UID16) += uid16.o |
58 | obj-$(CONFIG_MODULES) += module.o | 44 | obj-$(CONFIG_MODULES) += module.o |
59 | obj-$(CONFIG_MODULE_SIG) += module_signing.o modsign_pubkey.o modsign_certificate.o | 45 | obj-$(CONFIG_MODULE_SIG) += module_signing.o modsign_pubkey.o modsign_certificate.o |
diff --git a/kernel/futex.c b/kernel/futex.c index c3a1a55a5214..80ba086f021d 100644 --- a/kernel/futex.c +++ b/kernel/futex.c | |||
@@ -66,7 +66,7 @@ | |||
66 | 66 | ||
67 | #include <asm/futex.h> | 67 | #include <asm/futex.h> |
68 | 68 | ||
69 | #include "rtmutex_common.h" | 69 | #include "locking/rtmutex_common.h" |
70 | 70 | ||
71 | int __read_mostly futex_cmpxchg_enabled; | 71 | int __read_mostly futex_cmpxchg_enabled; |
72 | 72 | ||
diff --git a/kernel/hung_task.c b/kernel/hung_task.c index 3e97fb126e6b..8807061ca004 100644 --- a/kernel/hung_task.c +++ b/kernel/hung_task.c | |||
@@ -16,11 +16,12 @@ | |||
16 | #include <linux/export.h> | 16 | #include <linux/export.h> |
17 | #include <linux/sysctl.h> | 17 | #include <linux/sysctl.h> |
18 | #include <linux/utsname.h> | 18 | #include <linux/utsname.h> |
19 | #include <trace/events/sched.h> | ||
19 | 20 | ||
20 | /* | 21 | /* |
21 | * The number of tasks checked: | 22 | * The number of tasks checked: |
22 | */ | 23 | */ |
23 | unsigned long __read_mostly sysctl_hung_task_check_count = PID_MAX_LIMIT; | 24 | int __read_mostly sysctl_hung_task_check_count = PID_MAX_LIMIT; |
24 | 25 | ||
25 | /* | 26 | /* |
26 | * Limit number of tasks checked in a batch. | 27 | * Limit number of tasks checked in a batch. |
@@ -92,6 +93,9 @@ static void check_hung_task(struct task_struct *t, unsigned long timeout) | |||
92 | t->last_switch_count = switch_count; | 93 | t->last_switch_count = switch_count; |
93 | return; | 94 | return; |
94 | } | 95 | } |
96 | |||
97 | trace_sched_process_hang(t); | ||
98 | |||
95 | if (!sysctl_hung_task_warnings) | 99 | if (!sysctl_hung_task_warnings) |
96 | return; | 100 | return; |
97 | sysctl_hung_task_warnings--; | 101 | sysctl_hung_task_warnings--; |
diff --git a/kernel/locking/Makefile b/kernel/locking/Makefile new file mode 100644 index 000000000000..baab8e5e7f66 --- /dev/null +++ b/kernel/locking/Makefile | |||
@@ -0,0 +1,25 @@ | |||
1 | |||
2 | obj-y += mutex.o semaphore.o rwsem.o lglock.o | ||
3 | |||
4 | ifdef CONFIG_FUNCTION_TRACER | ||
5 | CFLAGS_REMOVE_lockdep.o = -pg | ||
6 | CFLAGS_REMOVE_lockdep_proc.o = -pg | ||
7 | CFLAGS_REMOVE_mutex-debug.o = -pg | ||
8 | CFLAGS_REMOVE_rtmutex-debug.o = -pg | ||
9 | endif | ||
10 | |||
11 | obj-$(CONFIG_DEBUG_MUTEXES) += mutex-debug.o | ||
12 | obj-$(CONFIG_LOCKDEP) += lockdep.o | ||
13 | ifeq ($(CONFIG_PROC_FS),y) | ||
14 | obj-$(CONFIG_LOCKDEP) += lockdep_proc.o | ||
15 | endif | ||
16 | obj-$(CONFIG_SMP) += spinlock.o | ||
17 | obj-$(CONFIG_PROVE_LOCKING) += spinlock.o | ||
18 | obj-$(CONFIG_RT_MUTEXES) += rtmutex.o | ||
19 | obj-$(CONFIG_DEBUG_RT_MUTEXES) += rtmutex-debug.o | ||
20 | obj-$(CONFIG_RT_MUTEX_TESTER) += rtmutex-tester.o | ||
21 | obj-$(CONFIG_DEBUG_SPINLOCK) += spinlock.o | ||
22 | obj-$(CONFIG_DEBUG_SPINLOCK) += spinlock_debug.o | ||
23 | obj-$(CONFIG_RWSEM_GENERIC_SPINLOCK) += rwsem-spinlock.o | ||
24 | obj-$(CONFIG_RWSEM_XCHGADD_ALGORITHM) += rwsem-xadd.o | ||
25 | obj-$(CONFIG_PERCPU_RWSEM) += percpu-rwsem.o | ||
diff --git a/kernel/lglock.c b/kernel/locking/lglock.c index 86ae2aebf004..86ae2aebf004 100644 --- a/kernel/lglock.c +++ b/kernel/locking/lglock.c | |||
diff --git a/kernel/lockdep.c b/kernel/locking/lockdep.c index 4e8e14c34e42..576ba756a32d 100644 --- a/kernel/lockdep.c +++ b/kernel/locking/lockdep.c | |||
@@ -1232,7 +1232,7 @@ static int noop_count(struct lock_list *entry, void *data) | |||
1232 | return 0; | 1232 | return 0; |
1233 | } | 1233 | } |
1234 | 1234 | ||
1235 | unsigned long __lockdep_count_forward_deps(struct lock_list *this) | 1235 | static unsigned long __lockdep_count_forward_deps(struct lock_list *this) |
1236 | { | 1236 | { |
1237 | unsigned long count = 0; | 1237 | unsigned long count = 0; |
1238 | struct lock_list *uninitialized_var(target_entry); | 1238 | struct lock_list *uninitialized_var(target_entry); |
@@ -1258,7 +1258,7 @@ unsigned long lockdep_count_forward_deps(struct lock_class *class) | |||
1258 | return ret; | 1258 | return ret; |
1259 | } | 1259 | } |
1260 | 1260 | ||
1261 | unsigned long __lockdep_count_backward_deps(struct lock_list *this) | 1261 | static unsigned long __lockdep_count_backward_deps(struct lock_list *this) |
1262 | { | 1262 | { |
1263 | unsigned long count = 0; | 1263 | unsigned long count = 0; |
1264 | struct lock_list *uninitialized_var(target_entry); | 1264 | struct lock_list *uninitialized_var(target_entry); |
diff --git a/kernel/lockdep_internals.h b/kernel/locking/lockdep_internals.h index 4f560cfedc8f..4f560cfedc8f 100644 --- a/kernel/lockdep_internals.h +++ b/kernel/locking/lockdep_internals.h | |||
diff --git a/kernel/lockdep_proc.c b/kernel/locking/lockdep_proc.c index b2c71c5873e4..ef43ac4bafb5 100644 --- a/kernel/lockdep_proc.c +++ b/kernel/locking/lockdep_proc.c | |||
@@ -421,6 +421,7 @@ static void seq_lock_time(struct seq_file *m, struct lock_time *lt) | |||
421 | seq_time(m, lt->min); | 421 | seq_time(m, lt->min); |
422 | seq_time(m, lt->max); | 422 | seq_time(m, lt->max); |
423 | seq_time(m, lt->total); | 423 | seq_time(m, lt->total); |
424 | seq_time(m, lt->nr ? div_s64(lt->total, lt->nr) : 0); | ||
424 | } | 425 | } |
425 | 426 | ||
426 | static void seq_stats(struct seq_file *m, struct lock_stat_data *data) | 427 | static void seq_stats(struct seq_file *m, struct lock_stat_data *data) |
@@ -518,20 +519,20 @@ static void seq_stats(struct seq_file *m, struct lock_stat_data *data) | |||
518 | } | 519 | } |
519 | if (i) { | 520 | if (i) { |
520 | seq_puts(m, "\n"); | 521 | seq_puts(m, "\n"); |
521 | seq_line(m, '.', 0, 40 + 1 + 10 * (14 + 1)); | 522 | seq_line(m, '.', 0, 40 + 1 + 12 * (14 + 1)); |
522 | seq_puts(m, "\n"); | 523 | seq_puts(m, "\n"); |
523 | } | 524 | } |
524 | } | 525 | } |
525 | 526 | ||
526 | static void seq_header(struct seq_file *m) | 527 | static void seq_header(struct seq_file *m) |
527 | { | 528 | { |
528 | seq_printf(m, "lock_stat version 0.3\n"); | 529 | seq_puts(m, "lock_stat version 0.4\n"); |
529 | 530 | ||
530 | if (unlikely(!debug_locks)) | 531 | if (unlikely(!debug_locks)) |
531 | seq_printf(m, "*WARNING* lock debugging disabled!! - possibly due to a lockdep warning\n"); | 532 | seq_printf(m, "*WARNING* lock debugging disabled!! - possibly due to a lockdep warning\n"); |
532 | 533 | ||
533 | seq_line(m, '-', 0, 40 + 1 + 10 * (14 + 1)); | 534 | seq_line(m, '-', 0, 40 + 1 + 12 * (14 + 1)); |
534 | seq_printf(m, "%40s %14s %14s %14s %14s %14s %14s %14s %14s " | 535 | seq_printf(m, "%40s %14s %14s %14s %14s %14s %14s %14s %14s %14s %14s " |
535 | "%14s %14s\n", | 536 | "%14s %14s\n", |
536 | "class name", | 537 | "class name", |
537 | "con-bounces", | 538 | "con-bounces", |
@@ -539,12 +540,14 @@ static void seq_header(struct seq_file *m) | |||
539 | "waittime-min", | 540 | "waittime-min", |
540 | "waittime-max", | 541 | "waittime-max", |
541 | "waittime-total", | 542 | "waittime-total", |
543 | "waittime-avg", | ||
542 | "acq-bounces", | 544 | "acq-bounces", |
543 | "acquisitions", | 545 | "acquisitions", |
544 | "holdtime-min", | 546 | "holdtime-min", |
545 | "holdtime-max", | 547 | "holdtime-max", |
546 | "holdtime-total"); | 548 | "holdtime-total", |
547 | seq_line(m, '-', 0, 40 + 1 + 10 * (14 + 1)); | 549 | "holdtime-avg"); |
550 | seq_line(m, '-', 0, 40 + 1 + 12 * (14 + 1)); | ||
548 | seq_printf(m, "\n"); | 551 | seq_printf(m, "\n"); |
549 | } | 552 | } |
550 | 553 | ||
diff --git a/kernel/lockdep_states.h b/kernel/locking/lockdep_states.h index 995b0cc2b84c..995b0cc2b84c 100644 --- a/kernel/lockdep_states.h +++ b/kernel/locking/lockdep_states.h | |||
diff --git a/kernel/mutex-debug.c b/kernel/locking/mutex-debug.c index 7e3443fe1f48..7e3443fe1f48 100644 --- a/kernel/mutex-debug.c +++ b/kernel/locking/mutex-debug.c | |||
diff --git a/kernel/mutex-debug.h b/kernel/locking/mutex-debug.h index 0799fd3e4cfa..0799fd3e4cfa 100644 --- a/kernel/mutex-debug.h +++ b/kernel/locking/mutex-debug.h | |||
diff --git a/kernel/mutex.c b/kernel/locking/mutex.c index d24105b1b794..4dd6e4c219de 100644 --- a/kernel/mutex.c +++ b/kernel/locking/mutex.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * kernel/mutex.c | 2 | * kernel/locking/mutex.c |
3 | * | 3 | * |
4 | * Mutexes: blocking mutual exclusion locks | 4 | * Mutexes: blocking mutual exclusion locks |
5 | * | 5 | * |
diff --git a/kernel/mutex.h b/kernel/locking/mutex.h index 4115fbf83b12..4115fbf83b12 100644 --- a/kernel/mutex.h +++ b/kernel/locking/mutex.h | |||
diff --git a/kernel/locking/percpu-rwsem.c b/kernel/locking/percpu-rwsem.c new file mode 100644 index 000000000000..652a8ee8efe9 --- /dev/null +++ b/kernel/locking/percpu-rwsem.c | |||
@@ -0,0 +1,165 @@ | |||
1 | #include <linux/atomic.h> | ||
2 | #include <linux/rwsem.h> | ||
3 | #include <linux/percpu.h> | ||
4 | #include <linux/wait.h> | ||
5 | #include <linux/lockdep.h> | ||
6 | #include <linux/percpu-rwsem.h> | ||
7 | #include <linux/rcupdate.h> | ||
8 | #include <linux/sched.h> | ||
9 | #include <linux/errno.h> | ||
10 | |||
11 | int __percpu_init_rwsem(struct percpu_rw_semaphore *brw, | ||
12 | const char *name, struct lock_class_key *rwsem_key) | ||
13 | { | ||
14 | brw->fast_read_ctr = alloc_percpu(int); | ||
15 | if (unlikely(!brw->fast_read_ctr)) | ||
16 | return -ENOMEM; | ||
17 | |||
18 | /* ->rw_sem represents the whole percpu_rw_semaphore for lockdep */ | ||
19 | __init_rwsem(&brw->rw_sem, name, rwsem_key); | ||
20 | atomic_set(&brw->write_ctr, 0); | ||
21 | atomic_set(&brw->slow_read_ctr, 0); | ||
22 | init_waitqueue_head(&brw->write_waitq); | ||
23 | return 0; | ||
24 | } | ||
25 | |||
26 | void percpu_free_rwsem(struct percpu_rw_semaphore *brw) | ||
27 | { | ||
28 | free_percpu(brw->fast_read_ctr); | ||
29 | brw->fast_read_ctr = NULL; /* catch use after free bugs */ | ||
30 | } | ||
31 | |||
32 | /* | ||
33 | * This is the fast-path for down_read/up_read, it only needs to ensure | ||
34 | * there is no pending writer (atomic_read(write_ctr) == 0) and inc/dec the | ||
35 | * fast per-cpu counter. The writer uses synchronize_sched_expedited() to | ||
36 | * serialize with the preempt-disabled section below. | ||
37 | * | ||
38 | * The nontrivial part is that we should guarantee acquire/release semantics | ||
39 | * in case when | ||
40 | * | ||
41 | * R_W: down_write() comes after up_read(), the writer should see all | ||
42 | * changes done by the reader | ||
43 | * or | ||
44 | * W_R: down_read() comes after up_write(), the reader should see all | ||
45 | * changes done by the writer | ||
46 | * | ||
47 | * If this helper fails the callers rely on the normal rw_semaphore and | ||
48 | * atomic_dec_and_test(), so in this case we have the necessary barriers. | ||
49 | * | ||
50 | * But if it succeeds we do not have any barriers, atomic_read(write_ctr) or | ||
51 | * __this_cpu_add() below can be reordered with any LOAD/STORE done by the | ||
52 | * reader inside the critical section. See the comments in down_write and | ||
53 | * up_write below. | ||
54 | */ | ||
55 | static bool update_fast_ctr(struct percpu_rw_semaphore *brw, unsigned int val) | ||
56 | { | ||
57 | bool success = false; | ||
58 | |||
59 | preempt_disable(); | ||
60 | if (likely(!atomic_read(&brw->write_ctr))) { | ||
61 | __this_cpu_add(*brw->fast_read_ctr, val); | ||
62 | success = true; | ||
63 | } | ||
64 | preempt_enable(); | ||
65 | |||
66 | return success; | ||
67 | } | ||
68 | |||
69 | /* | ||
70 | * Like the normal down_read() this is not recursive, the writer can | ||
71 | * come after the first percpu_down_read() and create the deadlock. | ||
72 | * | ||
73 | * Note: returns with lock_is_held(brw->rw_sem) == T for lockdep, | ||
74 | * percpu_up_read() does rwsem_release(). This pairs with the usage | ||
75 | * of ->rw_sem in percpu_down/up_write(). | ||
76 | */ | ||
77 | void percpu_down_read(struct percpu_rw_semaphore *brw) | ||
78 | { | ||
79 | might_sleep(); | ||
80 | if (likely(update_fast_ctr(brw, +1))) { | ||
81 | rwsem_acquire_read(&brw->rw_sem.dep_map, 0, 0, _RET_IP_); | ||
82 | return; | ||
83 | } | ||
84 | |||
85 | down_read(&brw->rw_sem); | ||
86 | atomic_inc(&brw->slow_read_ctr); | ||
87 | /* avoid up_read()->rwsem_release() */ | ||
88 | __up_read(&brw->rw_sem); | ||
89 | } | ||
90 | |||
91 | void percpu_up_read(struct percpu_rw_semaphore *brw) | ||
92 | { | ||
93 | rwsem_release(&brw->rw_sem.dep_map, 1, _RET_IP_); | ||
94 | |||
95 | if (likely(update_fast_ctr(brw, -1))) | ||
96 | return; | ||
97 | |||
98 | /* false-positive is possible but harmless */ | ||
99 | if (atomic_dec_and_test(&brw->slow_read_ctr)) | ||
100 | wake_up_all(&brw->write_waitq); | ||
101 | } | ||
102 | |||
103 | static int clear_fast_ctr(struct percpu_rw_semaphore *brw) | ||
104 | { | ||
105 | unsigned int sum = 0; | ||
106 | int cpu; | ||
107 | |||
108 | for_each_possible_cpu(cpu) { | ||
109 | sum += per_cpu(*brw->fast_read_ctr, cpu); | ||
110 | per_cpu(*brw->fast_read_ctr, cpu) = 0; | ||
111 | } | ||
112 | |||
113 | return sum; | ||
114 | } | ||
115 | |||
116 | /* | ||
117 | * A writer increments ->write_ctr to force the readers to switch to the | ||
118 | * slow mode, note the atomic_read() check in update_fast_ctr(). | ||
119 | * | ||
120 | * After that the readers can only inc/dec the slow ->slow_read_ctr counter, | ||
121 | * ->fast_read_ctr is stable. Once the writer moves its sum into the slow | ||
122 | * counter it represents the number of active readers. | ||
123 | * | ||
124 | * Finally the writer takes ->rw_sem for writing and blocks the new readers, | ||
125 | * then waits until the slow counter becomes zero. | ||
126 | */ | ||
127 | void percpu_down_write(struct percpu_rw_semaphore *brw) | ||
128 | { | ||
129 | /* tell update_fast_ctr() there is a pending writer */ | ||
130 | atomic_inc(&brw->write_ctr); | ||
131 | /* | ||
132 | * 1. Ensures that write_ctr != 0 is visible to any down_read/up_read | ||
133 | * so that update_fast_ctr() can't succeed. | ||
134 | * | ||
135 | * 2. Ensures we see the result of every previous this_cpu_add() in | ||
136 | * update_fast_ctr(). | ||
137 | * | ||
138 | * 3. Ensures that if any reader has exited its critical section via | ||
139 | * fast-path, it executes a full memory barrier before we return. | ||
140 | * See R_W case in the comment above update_fast_ctr(). | ||
141 | */ | ||
142 | synchronize_sched_expedited(); | ||
143 | |||
144 | /* exclude other writers, and block the new readers completely */ | ||
145 | down_write(&brw->rw_sem); | ||
146 | |||
147 | /* nobody can use fast_read_ctr, move its sum into slow_read_ctr */ | ||
148 | atomic_add(clear_fast_ctr(brw), &brw->slow_read_ctr); | ||
149 | |||
150 | /* wait for all readers to complete their percpu_up_read() */ | ||
151 | wait_event(brw->write_waitq, !atomic_read(&brw->slow_read_ctr)); | ||
152 | } | ||
153 | |||
154 | void percpu_up_write(struct percpu_rw_semaphore *brw) | ||
155 | { | ||
156 | /* release the lock, but the readers can't use the fast-path */ | ||
157 | up_write(&brw->rw_sem); | ||
158 | /* | ||
159 | * Insert the barrier before the next fast-path in down_read, | ||
160 | * see W_R case in the comment above update_fast_ctr(). | ||
161 | */ | ||
162 | synchronize_sched_expedited(); | ||
163 | /* the last writer unblocks update_fast_ctr() */ | ||
164 | atomic_dec(&brw->write_ctr); | ||
165 | } | ||
diff --git a/kernel/rtmutex-debug.c b/kernel/locking/rtmutex-debug.c index 13b243a323fa..13b243a323fa 100644 --- a/kernel/rtmutex-debug.c +++ b/kernel/locking/rtmutex-debug.c | |||
diff --git a/kernel/rtmutex-debug.h b/kernel/locking/rtmutex-debug.h index 14193d596d78..14193d596d78 100644 --- a/kernel/rtmutex-debug.h +++ b/kernel/locking/rtmutex-debug.h | |||
diff --git a/kernel/rtmutex-tester.c b/kernel/locking/rtmutex-tester.c index 1d96dd0d93c1..1d96dd0d93c1 100644 --- a/kernel/rtmutex-tester.c +++ b/kernel/locking/rtmutex-tester.c | |||
diff --git a/kernel/rtmutex.c b/kernel/locking/rtmutex.c index 0dd6aec1cb6a..0dd6aec1cb6a 100644 --- a/kernel/rtmutex.c +++ b/kernel/locking/rtmutex.c | |||
diff --git a/kernel/rtmutex.h b/kernel/locking/rtmutex.h index a1a1dd06421d..a1a1dd06421d 100644 --- a/kernel/rtmutex.h +++ b/kernel/locking/rtmutex.h | |||
diff --git a/kernel/rtmutex_common.h b/kernel/locking/rtmutex_common.h index 53a66c85261b..53a66c85261b 100644 --- a/kernel/rtmutex_common.h +++ b/kernel/locking/rtmutex_common.h | |||
diff --git a/kernel/locking/rwsem-spinlock.c b/kernel/locking/rwsem-spinlock.c new file mode 100644 index 000000000000..9be8a9144978 --- /dev/null +++ b/kernel/locking/rwsem-spinlock.c | |||
@@ -0,0 +1,296 @@ | |||
1 | /* rwsem-spinlock.c: R/W semaphores: contention handling functions for | ||
2 | * generic spinlock implementation | ||
3 | * | ||
4 | * Copyright (c) 2001 David Howells (dhowells@redhat.com). | ||
5 | * - Derived partially from idea by Andrea Arcangeli <andrea@suse.de> | ||
6 | * - Derived also from comments by Linus | ||
7 | */ | ||
8 | #include <linux/rwsem.h> | ||
9 | #include <linux/sched.h> | ||
10 | #include <linux/export.h> | ||
11 | |||
12 | enum rwsem_waiter_type { | ||
13 | RWSEM_WAITING_FOR_WRITE, | ||
14 | RWSEM_WAITING_FOR_READ | ||
15 | }; | ||
16 | |||
17 | struct rwsem_waiter { | ||
18 | struct list_head list; | ||
19 | struct task_struct *task; | ||
20 | enum rwsem_waiter_type type; | ||
21 | }; | ||
22 | |||
23 | int rwsem_is_locked(struct rw_semaphore *sem) | ||
24 | { | ||
25 | int ret = 1; | ||
26 | unsigned long flags; | ||
27 | |||
28 | if (raw_spin_trylock_irqsave(&sem->wait_lock, flags)) { | ||
29 | ret = (sem->activity != 0); | ||
30 | raw_spin_unlock_irqrestore(&sem->wait_lock, flags); | ||
31 | } | ||
32 | return ret; | ||
33 | } | ||
34 | EXPORT_SYMBOL(rwsem_is_locked); | ||
35 | |||
36 | /* | ||
37 | * initialise the semaphore | ||
38 | */ | ||
39 | void __init_rwsem(struct rw_semaphore *sem, const char *name, | ||
40 | struct lock_class_key *key) | ||
41 | { | ||
42 | #ifdef CONFIG_DEBUG_LOCK_ALLOC | ||
43 | /* | ||
44 | * Make sure we are not reinitializing a held semaphore: | ||
45 | */ | ||
46 | debug_check_no_locks_freed((void *)sem, sizeof(*sem)); | ||
47 | lockdep_init_map(&sem->dep_map, name, key, 0); | ||
48 | #endif | ||
49 | sem->activity = 0; | ||
50 | raw_spin_lock_init(&sem->wait_lock); | ||
51 | INIT_LIST_HEAD(&sem->wait_list); | ||
52 | } | ||
53 | EXPORT_SYMBOL(__init_rwsem); | ||
54 | |||
55 | /* | ||
56 | * handle the lock release when processes blocked on it that can now run | ||
57 | * - if we come here, then: | ||
58 | * - the 'active count' _reached_ zero | ||
59 | * - the 'waiting count' is non-zero | ||
60 | * - the spinlock must be held by the caller | ||
61 | * - woken process blocks are discarded from the list after having task zeroed | ||
62 | * - writers are only woken if wakewrite is non-zero | ||
63 | */ | ||
64 | static inline struct rw_semaphore * | ||
65 | __rwsem_do_wake(struct rw_semaphore *sem, int wakewrite) | ||
66 | { | ||
67 | struct rwsem_waiter *waiter; | ||
68 | struct task_struct *tsk; | ||
69 | int woken; | ||
70 | |||
71 | waiter = list_entry(sem->wait_list.next, struct rwsem_waiter, list); | ||
72 | |||
73 | if (waiter->type == RWSEM_WAITING_FOR_WRITE) { | ||
74 | if (wakewrite) | ||
75 | /* Wake up a writer. Note that we do not grant it the | ||
76 | * lock - it will have to acquire it when it runs. */ | ||
77 | wake_up_process(waiter->task); | ||
78 | goto out; | ||
79 | } | ||
80 | |||
81 | /* grant an infinite number of read locks to the front of the queue */ | ||
82 | woken = 0; | ||
83 | do { | ||
84 | struct list_head *next = waiter->list.next; | ||
85 | |||
86 | list_del(&waiter->list); | ||
87 | tsk = waiter->task; | ||
88 | smp_mb(); | ||
89 | waiter->task = NULL; | ||
90 | wake_up_process(tsk); | ||
91 | put_task_struct(tsk); | ||
92 | woken++; | ||
93 | if (next == &sem->wait_list) | ||
94 | break; | ||
95 | waiter = list_entry(next, struct rwsem_waiter, list); | ||
96 | } while (waiter->type != RWSEM_WAITING_FOR_WRITE); | ||
97 | |||
98 | sem->activity += woken; | ||
99 | |||
100 | out: | ||
101 | return sem; | ||
102 | } | ||
103 | |||
104 | /* | ||
105 | * wake a single writer | ||
106 | */ | ||
107 | static inline struct rw_semaphore * | ||
108 | __rwsem_wake_one_writer(struct rw_semaphore *sem) | ||
109 | { | ||
110 | struct rwsem_waiter *waiter; | ||
111 | |||
112 | waiter = list_entry(sem->wait_list.next, struct rwsem_waiter, list); | ||
113 | wake_up_process(waiter->task); | ||
114 | |||
115 | return sem; | ||
116 | } | ||
117 | |||
118 | /* | ||
119 | * get a read lock on the semaphore | ||
120 | */ | ||
121 | void __sched __down_read(struct rw_semaphore *sem) | ||
122 | { | ||
123 | struct rwsem_waiter waiter; | ||
124 | struct task_struct *tsk; | ||
125 | unsigned long flags; | ||
126 | |||
127 | raw_spin_lock_irqsave(&sem->wait_lock, flags); | ||
128 | |||
129 | if (sem->activity >= 0 && list_empty(&sem->wait_list)) { | ||
130 | /* granted */ | ||
131 | sem->activity++; | ||
132 | raw_spin_unlock_irqrestore(&sem->wait_lock, flags); | ||
133 | goto out; | ||
134 | } | ||
135 | |||
136 | tsk = current; | ||
137 | set_task_state(tsk, TASK_UNINTERRUPTIBLE); | ||
138 | |||
139 | /* set up my own style of waitqueue */ | ||
140 | waiter.task = tsk; | ||
141 | waiter.type = RWSEM_WAITING_FOR_READ; | ||
142 | get_task_struct(tsk); | ||
143 | |||
144 | list_add_tail(&waiter.list, &sem->wait_list); | ||
145 | |||
146 | /* we don't need to touch the semaphore struct anymore */ | ||
147 | raw_spin_unlock_irqrestore(&sem->wait_lock, flags); | ||
148 | |||
149 | /* wait to be given the lock */ | ||
150 | for (;;) { | ||
151 | if (!waiter.task) | ||
152 | break; | ||
153 | schedule(); | ||
154 | set_task_state(tsk, TASK_UNINTERRUPTIBLE); | ||
155 | } | ||
156 | |||
157 | tsk->state = TASK_RUNNING; | ||
158 | out: | ||
159 | ; | ||
160 | } | ||
161 | |||
162 | /* | ||
163 | * trylock for reading -- returns 1 if successful, 0 if contention | ||
164 | */ | ||
165 | int __down_read_trylock(struct rw_semaphore *sem) | ||
166 | { | ||
167 | unsigned long flags; | ||
168 | int ret = 0; | ||
169 | |||
170 | |||
171 | raw_spin_lock_irqsave(&sem->wait_lock, flags); | ||
172 | |||
173 | if (sem->activity >= 0 && list_empty(&sem->wait_list)) { | ||
174 | /* granted */ | ||
175 | sem->activity++; | ||
176 | ret = 1; | ||
177 | } | ||
178 | |||
179 | raw_spin_unlock_irqrestore(&sem->wait_lock, flags); | ||
180 | |||
181 | return ret; | ||
182 | } | ||
183 | |||
184 | /* | ||
185 | * get a write lock on the semaphore | ||
186 | */ | ||
187 | void __sched __down_write_nested(struct rw_semaphore *sem, int subclass) | ||
188 | { | ||
189 | struct rwsem_waiter waiter; | ||
190 | struct task_struct *tsk; | ||
191 | unsigned long flags; | ||
192 | |||
193 | raw_spin_lock_irqsave(&sem->wait_lock, flags); | ||
194 | |||
195 | /* set up my own style of waitqueue */ | ||
196 | tsk = current; | ||
197 | waiter.task = tsk; | ||
198 | waiter.type = RWSEM_WAITING_FOR_WRITE; | ||
199 | list_add_tail(&waiter.list, &sem->wait_list); | ||
200 | |||
201 | /* wait for someone to release the lock */ | ||
202 | for (;;) { | ||
203 | /* | ||
204 | * That is the key to support write lock stealing: allows the | ||
205 | * task already on CPU to get the lock soon rather than put | ||
206 | * itself into sleep and waiting for system woke it or someone | ||
207 | * else in the head of the wait list up. | ||
208 | */ | ||
209 | if (sem->activity == 0) | ||
210 | break; | ||
211 | set_task_state(tsk, TASK_UNINTERRUPTIBLE); | ||
212 | raw_spin_unlock_irqrestore(&sem->wait_lock, flags); | ||
213 | schedule(); | ||
214 | raw_spin_lock_irqsave(&sem->wait_lock, flags); | ||
215 | } | ||
216 | /* got the lock */ | ||
217 | sem->activity = -1; | ||
218 | list_del(&waiter.list); | ||
219 | |||
220 | raw_spin_unlock_irqrestore(&sem->wait_lock, flags); | ||
221 | } | ||
222 | |||
223 | void __sched __down_write(struct rw_semaphore *sem) | ||
224 | { | ||
225 | __down_write_nested(sem, 0); | ||
226 | } | ||
227 | |||
228 | /* | ||
229 | * trylock for writing -- returns 1 if successful, 0 if contention | ||
230 | */ | ||
231 | int __down_write_trylock(struct rw_semaphore *sem) | ||
232 | { | ||
233 | unsigned long flags; | ||
234 | int ret = 0; | ||
235 | |||
236 | raw_spin_lock_irqsave(&sem->wait_lock, flags); | ||
237 | |||
238 | if (sem->activity == 0) { | ||
239 | /* got the lock */ | ||
240 | sem->activity = -1; | ||
241 | ret = 1; | ||
242 | } | ||
243 | |||
244 | raw_spin_unlock_irqrestore(&sem->wait_lock, flags); | ||
245 | |||
246 | return ret; | ||
247 | } | ||
248 | |||
249 | /* | ||
250 | * release a read lock on the semaphore | ||
251 | */ | ||
252 | void __up_read(struct rw_semaphore *sem) | ||
253 | { | ||
254 | unsigned long flags; | ||
255 | |||
256 | raw_spin_lock_irqsave(&sem->wait_lock, flags); | ||
257 | |||
258 | if (--sem->activity == 0 && !list_empty(&sem->wait_list)) | ||
259 | sem = __rwsem_wake_one_writer(sem); | ||
260 | |||
261 | raw_spin_unlock_irqrestore(&sem->wait_lock, flags); | ||
262 | } | ||
263 | |||
264 | /* | ||
265 | * release a write lock on the semaphore | ||
266 | */ | ||
267 | void __up_write(struct rw_semaphore *sem) | ||
268 | { | ||
269 | unsigned long flags; | ||
270 | |||
271 | raw_spin_lock_irqsave(&sem->wait_lock, flags); | ||
272 | |||
273 | sem->activity = 0; | ||
274 | if (!list_empty(&sem->wait_list)) | ||
275 | sem = __rwsem_do_wake(sem, 1); | ||
276 | |||
277 | raw_spin_unlock_irqrestore(&sem->wait_lock, flags); | ||
278 | } | ||
279 | |||
280 | /* | ||
281 | * downgrade a write lock into a read lock | ||
282 | * - just wake up any readers at the front of the queue | ||
283 | */ | ||
284 | void __downgrade_write(struct rw_semaphore *sem) | ||
285 | { | ||
286 | unsigned long flags; | ||
287 | |||
288 | raw_spin_lock_irqsave(&sem->wait_lock, flags); | ||
289 | |||
290 | sem->activity = 1; | ||
291 | if (!list_empty(&sem->wait_list)) | ||
292 | sem = __rwsem_do_wake(sem, 0); | ||
293 | |||
294 | raw_spin_unlock_irqrestore(&sem->wait_lock, flags); | ||
295 | } | ||
296 | |||
diff --git a/kernel/locking/rwsem-xadd.c b/kernel/locking/rwsem-xadd.c new file mode 100644 index 000000000000..19c5fa95e0b4 --- /dev/null +++ b/kernel/locking/rwsem-xadd.c | |||
@@ -0,0 +1,293 @@ | |||
1 | /* rwsem.c: R/W semaphores: contention handling functions | ||
2 | * | ||
3 | * Written by David Howells (dhowells@redhat.com). | ||
4 | * Derived from arch/i386/kernel/semaphore.c | ||
5 | * | ||
6 | * Writer lock-stealing by Alex Shi <alex.shi@intel.com> | ||
7 | * and Michel Lespinasse <walken@google.com> | ||
8 | */ | ||
9 | #include <linux/rwsem.h> | ||
10 | #include <linux/sched.h> | ||
11 | #include <linux/init.h> | ||
12 | #include <linux/export.h> | ||
13 | |||
14 | /* | ||
15 | * Initialize an rwsem: | ||
16 | */ | ||
17 | void __init_rwsem(struct rw_semaphore *sem, const char *name, | ||
18 | struct lock_class_key *key) | ||
19 | { | ||
20 | #ifdef CONFIG_DEBUG_LOCK_ALLOC | ||
21 | /* | ||
22 | * Make sure we are not reinitializing a held semaphore: | ||
23 | */ | ||
24 | debug_check_no_locks_freed((void *)sem, sizeof(*sem)); | ||
25 | lockdep_init_map(&sem->dep_map, name, key, 0); | ||
26 | #endif | ||
27 | sem->count = RWSEM_UNLOCKED_VALUE; | ||
28 | raw_spin_lock_init(&sem->wait_lock); | ||
29 | INIT_LIST_HEAD(&sem->wait_list); | ||
30 | } | ||
31 | |||
32 | EXPORT_SYMBOL(__init_rwsem); | ||
33 | |||
34 | enum rwsem_waiter_type { | ||
35 | RWSEM_WAITING_FOR_WRITE, | ||
36 | RWSEM_WAITING_FOR_READ | ||
37 | }; | ||
38 | |||
39 | struct rwsem_waiter { | ||
40 | struct list_head list; | ||
41 | struct task_struct *task; | ||
42 | enum rwsem_waiter_type type; | ||
43 | }; | ||
44 | |||
45 | enum rwsem_wake_type { | ||
46 | RWSEM_WAKE_ANY, /* Wake whatever's at head of wait list */ | ||
47 | RWSEM_WAKE_READERS, /* Wake readers only */ | ||
48 | RWSEM_WAKE_READ_OWNED /* Waker thread holds the read lock */ | ||
49 | }; | ||
50 | |||
51 | /* | ||
52 | * handle the lock release when processes blocked on it that can now run | ||
53 | * - if we come here from up_xxxx(), then: | ||
54 | * - the 'active part' of count (&0x0000ffff) reached 0 (but may have changed) | ||
55 | * - the 'waiting part' of count (&0xffff0000) is -ve (and will still be so) | ||
56 | * - there must be someone on the queue | ||
57 | * - the spinlock must be held by the caller | ||
58 | * - woken process blocks are discarded from the list after having task zeroed | ||
59 | * - writers are only woken if downgrading is false | ||
60 | */ | ||
61 | static struct rw_semaphore * | ||
62 | __rwsem_do_wake(struct rw_semaphore *sem, enum rwsem_wake_type wake_type) | ||
63 | { | ||
64 | struct rwsem_waiter *waiter; | ||
65 | struct task_struct *tsk; | ||
66 | struct list_head *next; | ||
67 | long oldcount, woken, loop, adjustment; | ||
68 | |||
69 | waiter = list_entry(sem->wait_list.next, struct rwsem_waiter, list); | ||
70 | if (waiter->type == RWSEM_WAITING_FOR_WRITE) { | ||
71 | if (wake_type == RWSEM_WAKE_ANY) | ||
72 | /* Wake writer at the front of the queue, but do not | ||
73 | * grant it the lock yet as we want other writers | ||
74 | * to be able to steal it. Readers, on the other hand, | ||
75 | * will block as they will notice the queued writer. | ||
76 | */ | ||
77 | wake_up_process(waiter->task); | ||
78 | goto out; | ||
79 | } | ||
80 | |||
81 | /* Writers might steal the lock before we grant it to the next reader. | ||
82 | * We prefer to do the first reader grant before counting readers | ||
83 | * so we can bail out early if a writer stole the lock. | ||
84 | */ | ||
85 | adjustment = 0; | ||
86 | if (wake_type != RWSEM_WAKE_READ_OWNED) { | ||
87 | adjustment = RWSEM_ACTIVE_READ_BIAS; | ||
88 | try_reader_grant: | ||
89 | oldcount = rwsem_atomic_update(adjustment, sem) - adjustment; | ||
90 | if (unlikely(oldcount < RWSEM_WAITING_BIAS)) { | ||
91 | /* A writer stole the lock. Undo our reader grant. */ | ||
92 | if (rwsem_atomic_update(-adjustment, sem) & | ||
93 | RWSEM_ACTIVE_MASK) | ||
94 | goto out; | ||
95 | /* Last active locker left. Retry waking readers. */ | ||
96 | goto try_reader_grant; | ||
97 | } | ||
98 | } | ||
99 | |||
100 | /* Grant an infinite number of read locks to the readers at the front | ||
101 | * of the queue. Note we increment the 'active part' of the count by | ||
102 | * the number of readers before waking any processes up. | ||
103 | */ | ||
104 | woken = 0; | ||
105 | do { | ||
106 | woken++; | ||
107 | |||
108 | if (waiter->list.next == &sem->wait_list) | ||
109 | break; | ||
110 | |||
111 | waiter = list_entry(waiter->list.next, | ||
112 | struct rwsem_waiter, list); | ||
113 | |||
114 | } while (waiter->type != RWSEM_WAITING_FOR_WRITE); | ||
115 | |||
116 | adjustment = woken * RWSEM_ACTIVE_READ_BIAS - adjustment; | ||
117 | if (waiter->type != RWSEM_WAITING_FOR_WRITE) | ||
118 | /* hit end of list above */ | ||
119 | adjustment -= RWSEM_WAITING_BIAS; | ||
120 | |||
121 | if (adjustment) | ||
122 | rwsem_atomic_add(adjustment, sem); | ||
123 | |||
124 | next = sem->wait_list.next; | ||
125 | loop = woken; | ||
126 | do { | ||
127 | waiter = list_entry(next, struct rwsem_waiter, list); | ||
128 | next = waiter->list.next; | ||
129 | tsk = waiter->task; | ||
130 | smp_mb(); | ||
131 | waiter->task = NULL; | ||
132 | wake_up_process(tsk); | ||
133 | put_task_struct(tsk); | ||
134 | } while (--loop); | ||
135 | |||
136 | sem->wait_list.next = next; | ||
137 | next->prev = &sem->wait_list; | ||
138 | |||
139 | out: | ||
140 | return sem; | ||
141 | } | ||
142 | |||
143 | /* | ||
144 | * wait for the read lock to be granted | ||
145 | */ | ||
146 | struct rw_semaphore __sched *rwsem_down_read_failed(struct rw_semaphore *sem) | ||
147 | { | ||
148 | long count, adjustment = -RWSEM_ACTIVE_READ_BIAS; | ||
149 | struct rwsem_waiter waiter; | ||
150 | struct task_struct *tsk = current; | ||
151 | |||
152 | /* set up my own style of waitqueue */ | ||
153 | waiter.task = tsk; | ||
154 | waiter.type = RWSEM_WAITING_FOR_READ; | ||
155 | get_task_struct(tsk); | ||
156 | |||
157 | raw_spin_lock_irq(&sem->wait_lock); | ||
158 | if (list_empty(&sem->wait_list)) | ||
159 | adjustment += RWSEM_WAITING_BIAS; | ||
160 | list_add_tail(&waiter.list, &sem->wait_list); | ||
161 | |||
162 | /* we're now waiting on the lock, but no longer actively locking */ | ||
163 | count = rwsem_atomic_update(adjustment, sem); | ||
164 | |||
165 | /* If there are no active locks, wake the front queued process(es). | ||
166 | * | ||
167 | * If there are no writers and we are first in the queue, | ||
168 | * wake our own waiter to join the existing active readers ! | ||
169 | */ | ||
170 | if (count == RWSEM_WAITING_BIAS || | ||
171 | (count > RWSEM_WAITING_BIAS && | ||
172 | adjustment != -RWSEM_ACTIVE_READ_BIAS)) | ||
173 | sem = __rwsem_do_wake(sem, RWSEM_WAKE_ANY); | ||
174 | |||
175 | raw_spin_unlock_irq(&sem->wait_lock); | ||
176 | |||
177 | /* wait to be given the lock */ | ||
178 | while (true) { | ||
179 | set_task_state(tsk, TASK_UNINTERRUPTIBLE); | ||
180 | if (!waiter.task) | ||
181 | break; | ||
182 | schedule(); | ||
183 | } | ||
184 | |||
185 | tsk->state = TASK_RUNNING; | ||
186 | |||
187 | return sem; | ||
188 | } | ||
189 | |||
190 | /* | ||
191 | * wait until we successfully acquire the write lock | ||
192 | */ | ||
193 | struct rw_semaphore __sched *rwsem_down_write_failed(struct rw_semaphore *sem) | ||
194 | { | ||
195 | long count, adjustment = -RWSEM_ACTIVE_WRITE_BIAS; | ||
196 | struct rwsem_waiter waiter; | ||
197 | struct task_struct *tsk = current; | ||
198 | |||
199 | /* set up my own style of waitqueue */ | ||
200 | waiter.task = tsk; | ||
201 | waiter.type = RWSEM_WAITING_FOR_WRITE; | ||
202 | |||
203 | raw_spin_lock_irq(&sem->wait_lock); | ||
204 | if (list_empty(&sem->wait_list)) | ||
205 | adjustment += RWSEM_WAITING_BIAS; | ||
206 | list_add_tail(&waiter.list, &sem->wait_list); | ||
207 | |||
208 | /* we're now waiting on the lock, but no longer actively locking */ | ||
209 | count = rwsem_atomic_update(adjustment, sem); | ||
210 | |||
211 | /* If there were already threads queued before us and there are no | ||
212 | * active writers, the lock must be read owned; so we try to wake | ||
213 | * any read locks that were queued ahead of us. */ | ||
214 | if (count > RWSEM_WAITING_BIAS && | ||
215 | adjustment == -RWSEM_ACTIVE_WRITE_BIAS) | ||
216 | sem = __rwsem_do_wake(sem, RWSEM_WAKE_READERS); | ||
217 | |||
218 | /* wait until we successfully acquire the lock */ | ||
219 | set_task_state(tsk, TASK_UNINTERRUPTIBLE); | ||
220 | while (true) { | ||
221 | if (!(count & RWSEM_ACTIVE_MASK)) { | ||
222 | /* Try acquiring the write lock. */ | ||
223 | count = RWSEM_ACTIVE_WRITE_BIAS; | ||
224 | if (!list_is_singular(&sem->wait_list)) | ||
225 | count += RWSEM_WAITING_BIAS; | ||
226 | |||
227 | if (sem->count == RWSEM_WAITING_BIAS && | ||
228 | cmpxchg(&sem->count, RWSEM_WAITING_BIAS, count) == | ||
229 | RWSEM_WAITING_BIAS) | ||
230 | break; | ||
231 | } | ||
232 | |||
233 | raw_spin_unlock_irq(&sem->wait_lock); | ||
234 | |||
235 | /* Block until there are no active lockers. */ | ||
236 | do { | ||
237 | schedule(); | ||
238 | set_task_state(tsk, TASK_UNINTERRUPTIBLE); | ||
239 | } while ((count = sem->count) & RWSEM_ACTIVE_MASK); | ||
240 | |||
241 | raw_spin_lock_irq(&sem->wait_lock); | ||
242 | } | ||
243 | |||
244 | list_del(&waiter.list); | ||
245 | raw_spin_unlock_irq(&sem->wait_lock); | ||
246 | tsk->state = TASK_RUNNING; | ||
247 | |||
248 | return sem; | ||
249 | } | ||
250 | |||
251 | /* | ||
252 | * handle waking up a waiter on the semaphore | ||
253 | * - up_read/up_write has decremented the active part of count if we come here | ||
254 | */ | ||
255 | struct rw_semaphore *rwsem_wake(struct rw_semaphore *sem) | ||
256 | { | ||
257 | unsigned long flags; | ||
258 | |||
259 | raw_spin_lock_irqsave(&sem->wait_lock, flags); | ||
260 | |||
261 | /* do nothing if list empty */ | ||
262 | if (!list_empty(&sem->wait_list)) | ||
263 | sem = __rwsem_do_wake(sem, RWSEM_WAKE_ANY); | ||
264 | |||
265 | raw_spin_unlock_irqrestore(&sem->wait_lock, flags); | ||
266 | |||
267 | return sem; | ||
268 | } | ||
269 | |||
270 | /* | ||
271 | * downgrade a write lock into a read lock | ||
272 | * - caller incremented waiting part of count and discovered it still negative | ||
273 | * - just wake up any readers at the front of the queue | ||
274 | */ | ||
275 | struct rw_semaphore *rwsem_downgrade_wake(struct rw_semaphore *sem) | ||
276 | { | ||
277 | unsigned long flags; | ||
278 | |||
279 | raw_spin_lock_irqsave(&sem->wait_lock, flags); | ||
280 | |||
281 | /* do nothing if list empty */ | ||
282 | if (!list_empty(&sem->wait_list)) | ||
283 | sem = __rwsem_do_wake(sem, RWSEM_WAKE_READ_OWNED); | ||
284 | |||
285 | raw_spin_unlock_irqrestore(&sem->wait_lock, flags); | ||
286 | |||
287 | return sem; | ||
288 | } | ||
289 | |||
290 | EXPORT_SYMBOL(rwsem_down_read_failed); | ||
291 | EXPORT_SYMBOL(rwsem_down_write_failed); | ||
292 | EXPORT_SYMBOL(rwsem_wake); | ||
293 | EXPORT_SYMBOL(rwsem_downgrade_wake); | ||
diff --git a/kernel/rwsem.c b/kernel/locking/rwsem.c index cfff1435bdfb..cfff1435bdfb 100644 --- a/kernel/rwsem.c +++ b/kernel/locking/rwsem.c | |||
diff --git a/kernel/semaphore.c b/kernel/locking/semaphore.c index 6815171a4fff..6815171a4fff 100644 --- a/kernel/semaphore.c +++ b/kernel/locking/semaphore.c | |||
diff --git a/kernel/spinlock.c b/kernel/locking/spinlock.c index 4b082b5cac9e..4b082b5cac9e 100644 --- a/kernel/spinlock.c +++ b/kernel/locking/spinlock.c | |||
diff --git a/kernel/locking/spinlock_debug.c b/kernel/locking/spinlock_debug.c new file mode 100644 index 000000000000..0374a596cffa --- /dev/null +++ b/kernel/locking/spinlock_debug.c | |||
@@ -0,0 +1,302 @@ | |||
1 | /* | ||
2 | * Copyright 2005, Red Hat, Inc., Ingo Molnar | ||
3 | * Released under the General Public License (GPL). | ||
4 | * | ||
5 | * This file contains the spinlock/rwlock implementations for | ||
6 | * DEBUG_SPINLOCK. | ||
7 | */ | ||
8 | |||
9 | #include <linux/spinlock.h> | ||
10 | #include <linux/nmi.h> | ||
11 | #include <linux/interrupt.h> | ||
12 | #include <linux/debug_locks.h> | ||
13 | #include <linux/delay.h> | ||
14 | #include <linux/export.h> | ||
15 | |||
16 | void __raw_spin_lock_init(raw_spinlock_t *lock, const char *name, | ||
17 | struct lock_class_key *key) | ||
18 | { | ||
19 | #ifdef CONFIG_DEBUG_LOCK_ALLOC | ||
20 | /* | ||
21 | * Make sure we are not reinitializing a held lock: | ||
22 | */ | ||
23 | debug_check_no_locks_freed((void *)lock, sizeof(*lock)); | ||
24 | lockdep_init_map(&lock->dep_map, name, key, 0); | ||
25 | #endif | ||
26 | lock->raw_lock = (arch_spinlock_t)__ARCH_SPIN_LOCK_UNLOCKED; | ||
27 | lock->magic = SPINLOCK_MAGIC; | ||
28 | lock->owner = SPINLOCK_OWNER_INIT; | ||
29 | lock->owner_cpu = -1; | ||
30 | } | ||
31 | |||
32 | EXPORT_SYMBOL(__raw_spin_lock_init); | ||
33 | |||
34 | void __rwlock_init(rwlock_t *lock, const char *name, | ||
35 | struct lock_class_key *key) | ||
36 | { | ||
37 | #ifdef CONFIG_DEBUG_LOCK_ALLOC | ||
38 | /* | ||
39 | * Make sure we are not reinitializing a held lock: | ||
40 | */ | ||
41 | debug_check_no_locks_freed((void *)lock, sizeof(*lock)); | ||
42 | lockdep_init_map(&lock->dep_map, name, key, 0); | ||
43 | #endif | ||
44 | lock->raw_lock = (arch_rwlock_t) __ARCH_RW_LOCK_UNLOCKED; | ||
45 | lock->magic = RWLOCK_MAGIC; | ||
46 | lock->owner = SPINLOCK_OWNER_INIT; | ||
47 | lock->owner_cpu = -1; | ||
48 | } | ||
49 | |||
50 | EXPORT_SYMBOL(__rwlock_init); | ||
51 | |||
52 | static void spin_dump(raw_spinlock_t *lock, const char *msg) | ||
53 | { | ||
54 | struct task_struct *owner = NULL; | ||
55 | |||
56 | if (lock->owner && lock->owner != SPINLOCK_OWNER_INIT) | ||
57 | owner = lock->owner; | ||
58 | printk(KERN_EMERG "BUG: spinlock %s on CPU#%d, %s/%d\n", | ||
59 | msg, raw_smp_processor_id(), | ||
60 | current->comm, task_pid_nr(current)); | ||
61 | printk(KERN_EMERG " lock: %pS, .magic: %08x, .owner: %s/%d, " | ||
62 | ".owner_cpu: %d\n", | ||
63 | lock, lock->magic, | ||
64 | owner ? owner->comm : "<none>", | ||
65 | owner ? task_pid_nr(owner) : -1, | ||
66 | lock->owner_cpu); | ||
67 | dump_stack(); | ||
68 | } | ||
69 | |||
70 | static void spin_bug(raw_spinlock_t *lock, const char *msg) | ||
71 | { | ||
72 | if (!debug_locks_off()) | ||
73 | return; | ||
74 | |||
75 | spin_dump(lock, msg); | ||
76 | } | ||
77 | |||
78 | #define SPIN_BUG_ON(cond, lock, msg) if (unlikely(cond)) spin_bug(lock, msg) | ||
79 | |||
80 | static inline void | ||
81 | debug_spin_lock_before(raw_spinlock_t *lock) | ||
82 | { | ||
83 | SPIN_BUG_ON(lock->magic != SPINLOCK_MAGIC, lock, "bad magic"); | ||
84 | SPIN_BUG_ON(lock->owner == current, lock, "recursion"); | ||
85 | SPIN_BUG_ON(lock->owner_cpu == raw_smp_processor_id(), | ||
86 | lock, "cpu recursion"); | ||
87 | } | ||
88 | |||
89 | static inline void debug_spin_lock_after(raw_spinlock_t *lock) | ||
90 | { | ||
91 | lock->owner_cpu = raw_smp_processor_id(); | ||
92 | lock->owner = current; | ||
93 | } | ||
94 | |||
95 | static inline void debug_spin_unlock(raw_spinlock_t *lock) | ||
96 | { | ||
97 | SPIN_BUG_ON(lock->magic != SPINLOCK_MAGIC, lock, "bad magic"); | ||
98 | SPIN_BUG_ON(!raw_spin_is_locked(lock), lock, "already unlocked"); | ||
99 | SPIN_BUG_ON(lock->owner != current, lock, "wrong owner"); | ||
100 | SPIN_BUG_ON(lock->owner_cpu != raw_smp_processor_id(), | ||
101 | lock, "wrong CPU"); | ||
102 | lock->owner = SPINLOCK_OWNER_INIT; | ||
103 | lock->owner_cpu = -1; | ||
104 | } | ||
105 | |||
106 | static void __spin_lock_debug(raw_spinlock_t *lock) | ||
107 | { | ||
108 | u64 i; | ||
109 | u64 loops = loops_per_jiffy * HZ; | ||
110 | |||
111 | for (i = 0; i < loops; i++) { | ||
112 | if (arch_spin_trylock(&lock->raw_lock)) | ||
113 | return; | ||
114 | __delay(1); | ||
115 | } | ||
116 | /* lockup suspected: */ | ||
117 | spin_dump(lock, "lockup suspected"); | ||
118 | #ifdef CONFIG_SMP | ||
119 | trigger_all_cpu_backtrace(); | ||
120 | #endif | ||
121 | |||
122 | /* | ||
123 | * The trylock above was causing a livelock. Give the lower level arch | ||
124 | * specific lock code a chance to acquire the lock. We have already | ||
125 | * printed a warning/backtrace at this point. The non-debug arch | ||
126 | * specific code might actually succeed in acquiring the lock. If it is | ||
127 | * not successful, the end-result is the same - there is no forward | ||
128 | * progress. | ||
129 | */ | ||
130 | arch_spin_lock(&lock->raw_lock); | ||
131 | } | ||
132 | |||
133 | void do_raw_spin_lock(raw_spinlock_t *lock) | ||
134 | { | ||
135 | debug_spin_lock_before(lock); | ||
136 | if (unlikely(!arch_spin_trylock(&lock->raw_lock))) | ||
137 | __spin_lock_debug(lock); | ||
138 | debug_spin_lock_after(lock); | ||
139 | } | ||
140 | |||
141 | int do_raw_spin_trylock(raw_spinlock_t *lock) | ||
142 | { | ||
143 | int ret = arch_spin_trylock(&lock->raw_lock); | ||
144 | |||
145 | if (ret) | ||
146 | debug_spin_lock_after(lock); | ||
147 | #ifndef CONFIG_SMP | ||
148 | /* | ||
149 | * Must not happen on UP: | ||
150 | */ | ||
151 | SPIN_BUG_ON(!ret, lock, "trylock failure on UP"); | ||
152 | #endif | ||
153 | return ret; | ||
154 | } | ||
155 | |||
156 | void do_raw_spin_unlock(raw_spinlock_t *lock) | ||
157 | { | ||
158 | debug_spin_unlock(lock); | ||
159 | arch_spin_unlock(&lock->raw_lock); | ||
160 | } | ||
161 | |||
162 | static void rwlock_bug(rwlock_t *lock, const char *msg) | ||
163 | { | ||
164 | if (!debug_locks_off()) | ||
165 | return; | ||
166 | |||
167 | printk(KERN_EMERG "BUG: rwlock %s on CPU#%d, %s/%d, %p\n", | ||
168 | msg, raw_smp_processor_id(), current->comm, | ||
169 | task_pid_nr(current), lock); | ||
170 | dump_stack(); | ||
171 | } | ||
172 | |||
173 | #define RWLOCK_BUG_ON(cond, lock, msg) if (unlikely(cond)) rwlock_bug(lock, msg) | ||
174 | |||
175 | #if 0 /* __write_lock_debug() can lock up - maybe this can too? */ | ||
176 | static void __read_lock_debug(rwlock_t *lock) | ||
177 | { | ||
178 | u64 i; | ||
179 | u64 loops = loops_per_jiffy * HZ; | ||
180 | int print_once = 1; | ||
181 | |||
182 | for (;;) { | ||
183 | for (i = 0; i < loops; i++) { | ||
184 | if (arch_read_trylock(&lock->raw_lock)) | ||
185 | return; | ||
186 | __delay(1); | ||
187 | } | ||
188 | /* lockup suspected: */ | ||
189 | if (print_once) { | ||
190 | print_once = 0; | ||
191 | printk(KERN_EMERG "BUG: read-lock lockup on CPU#%d, " | ||
192 | "%s/%d, %p\n", | ||
193 | raw_smp_processor_id(), current->comm, | ||
194 | current->pid, lock); | ||
195 | dump_stack(); | ||
196 | } | ||
197 | } | ||
198 | } | ||
199 | #endif | ||
200 | |||
201 | void do_raw_read_lock(rwlock_t *lock) | ||
202 | { | ||
203 | RWLOCK_BUG_ON(lock->magic != RWLOCK_MAGIC, lock, "bad magic"); | ||
204 | arch_read_lock(&lock->raw_lock); | ||
205 | } | ||
206 | |||
207 | int do_raw_read_trylock(rwlock_t *lock) | ||
208 | { | ||
209 | int ret = arch_read_trylock(&lock->raw_lock); | ||
210 | |||
211 | #ifndef CONFIG_SMP | ||
212 | /* | ||
213 | * Must not happen on UP: | ||
214 | */ | ||
215 | RWLOCK_BUG_ON(!ret, lock, "trylock failure on UP"); | ||
216 | #endif | ||
217 | return ret; | ||
218 | } | ||
219 | |||
220 | void do_raw_read_unlock(rwlock_t *lock) | ||
221 | { | ||
222 | RWLOCK_BUG_ON(lock->magic != RWLOCK_MAGIC, lock, "bad magic"); | ||
223 | arch_read_unlock(&lock->raw_lock); | ||
224 | } | ||
225 | |||
226 | static inline void debug_write_lock_before(rwlock_t *lock) | ||
227 | { | ||
228 | RWLOCK_BUG_ON(lock->magic != RWLOCK_MAGIC, lock, "bad magic"); | ||
229 | RWLOCK_BUG_ON(lock->owner == current, lock, "recursion"); | ||
230 | RWLOCK_BUG_ON(lock->owner_cpu == raw_smp_processor_id(), | ||
231 | lock, "cpu recursion"); | ||
232 | } | ||
233 | |||
234 | static inline void debug_write_lock_after(rwlock_t *lock) | ||
235 | { | ||
236 | lock->owner_cpu = raw_smp_processor_id(); | ||
237 | lock->owner = current; | ||
238 | } | ||
239 | |||
240 | static inline void debug_write_unlock(rwlock_t *lock) | ||
241 | { | ||
242 | RWLOCK_BUG_ON(lock->magic != RWLOCK_MAGIC, lock, "bad magic"); | ||
243 | RWLOCK_BUG_ON(lock->owner != current, lock, "wrong owner"); | ||
244 | RWLOCK_BUG_ON(lock->owner_cpu != raw_smp_processor_id(), | ||
245 | lock, "wrong CPU"); | ||
246 | lock->owner = SPINLOCK_OWNER_INIT; | ||
247 | lock->owner_cpu = -1; | ||
248 | } | ||
249 | |||
250 | #if 0 /* This can cause lockups */ | ||
251 | static void __write_lock_debug(rwlock_t *lock) | ||
252 | { | ||
253 | u64 i; | ||
254 | u64 loops = loops_per_jiffy * HZ; | ||
255 | int print_once = 1; | ||
256 | |||
257 | for (;;) { | ||
258 | for (i = 0; i < loops; i++) { | ||
259 | if (arch_write_trylock(&lock->raw_lock)) | ||
260 | return; | ||
261 | __delay(1); | ||
262 | } | ||
263 | /* lockup suspected: */ | ||
264 | if (print_once) { | ||
265 | print_once = 0; | ||
266 | printk(KERN_EMERG "BUG: write-lock lockup on CPU#%d, " | ||
267 | "%s/%d, %p\n", | ||
268 | raw_smp_processor_id(), current->comm, | ||
269 | current->pid, lock); | ||
270 | dump_stack(); | ||
271 | } | ||
272 | } | ||
273 | } | ||
274 | #endif | ||
275 | |||
276 | void do_raw_write_lock(rwlock_t *lock) | ||
277 | { | ||
278 | debug_write_lock_before(lock); | ||
279 | arch_write_lock(&lock->raw_lock); | ||
280 | debug_write_lock_after(lock); | ||
281 | } | ||
282 | |||
283 | int do_raw_write_trylock(rwlock_t *lock) | ||
284 | { | ||
285 | int ret = arch_write_trylock(&lock->raw_lock); | ||
286 | |||
287 | if (ret) | ||
288 | debug_write_lock_after(lock); | ||
289 | #ifndef CONFIG_SMP | ||
290 | /* | ||
291 | * Must not happen on UP: | ||
292 | */ | ||
293 | RWLOCK_BUG_ON(!ret, lock, "trylock failure on UP"); | ||
294 | #endif | ||
295 | return ret; | ||
296 | } | ||
297 | |||
298 | void do_raw_write_unlock(rwlock_t *lock) | ||
299 | { | ||
300 | debug_write_unlock(lock); | ||
301 | arch_write_unlock(&lock->raw_lock); | ||
302 | } | ||
diff --git a/kernel/rcu/tree_plugin.h b/kernel/rcu/tree_plugin.h index 3822ac0c4b27..6abb03dff5c0 100644 --- a/kernel/rcu/tree_plugin.h +++ b/kernel/rcu/tree_plugin.h | |||
@@ -1133,7 +1133,7 @@ void exit_rcu(void) | |||
1133 | 1133 | ||
1134 | #ifdef CONFIG_RCU_BOOST | 1134 | #ifdef CONFIG_RCU_BOOST |
1135 | 1135 | ||
1136 | #include "../rtmutex_common.h" | 1136 | #include "../locking/rtmutex_common.h" |
1137 | 1137 | ||
1138 | #ifdef CONFIG_RCU_TRACE | 1138 | #ifdef CONFIG_RCU_TRACE |
1139 | 1139 | ||
diff --git a/kernel/sysctl.c b/kernel/sysctl.c index d37d9dd8f463..34a604726d0b 100644 --- a/kernel/sysctl.c +++ b/kernel/sysctl.c | |||
@@ -969,9 +969,10 @@ static struct ctl_table kern_table[] = { | |||
969 | { | 969 | { |
970 | .procname = "hung_task_check_count", | 970 | .procname = "hung_task_check_count", |
971 | .data = &sysctl_hung_task_check_count, | 971 | .data = &sysctl_hung_task_check_count, |
972 | .maxlen = sizeof(unsigned long), | 972 | .maxlen = sizeof(int), |
973 | .mode = 0644, | 973 | .mode = 0644, |
974 | .proc_handler = proc_doulongvec_minmax, | 974 | .proc_handler = proc_dointvec_minmax, |
975 | .extra1 = &zero, | ||
975 | }, | 976 | }, |
976 | { | 977 | { |
977 | .procname = "hung_task_timeout_secs", | 978 | .procname = "hung_task_timeout_secs", |