diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2010-12-24 15:59:09 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-12-24 15:59:09 -0500 |
commit | a4790c9457ae973d598bbd5ce58f9eaa2dd1576b (patch) | |
tree | 997c23d8182567d1b294022d81f9a315b2a642ef | |
parent | 08da5a32b7789289f48f3037b64df2945b5dafc2 (diff) | |
parent | bcbea798f8f1492052c23ceb4fbc2a96013a3865 (diff) |
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/percpu
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/percpu:
percpu: print out alloc information with KERN_DEBUG instead of KERN_INFO
kthread_work: make lockdep happy
-rw-r--r-- | include/linux/kthread.h | 45 | ||||
-rw-r--r-- | kernel/kthread.c | 11 | ||||
-rw-r--r-- | mm/percpu.c | 2 |
3 files changed, 47 insertions, 11 deletions
diff --git a/include/linux/kthread.h b/include/linux/kthread.h index 685ea65eb803..ce0775aa64c3 100644 --- a/include/linux/kthread.h +++ b/include/linux/kthread.h | |||
@@ -81,16 +81,41 @@ struct kthread_work { | |||
81 | #define DEFINE_KTHREAD_WORK(work, fn) \ | 81 | #define DEFINE_KTHREAD_WORK(work, fn) \ |
82 | struct kthread_work work = KTHREAD_WORK_INIT(work, fn) | 82 | struct kthread_work work = KTHREAD_WORK_INIT(work, fn) |
83 | 83 | ||
84 | static inline void init_kthread_worker(struct kthread_worker *worker) | 84 | /* |
85 | { | 85 | * kthread_worker.lock and kthread_work.done need their own lockdep class |
86 | *worker = (struct kthread_worker)KTHREAD_WORKER_INIT(*worker); | 86 | * keys if they are defined on stack with lockdep enabled. Use the |
87 | } | 87 | * following macros when defining them on stack. |
88 | 88 | */ | |
89 | static inline void init_kthread_work(struct kthread_work *work, | 89 | #ifdef CONFIG_LOCKDEP |
90 | kthread_work_func_t fn) | 90 | # define KTHREAD_WORKER_INIT_ONSTACK(worker) \ |
91 | { | 91 | ({ init_kthread_worker(&worker); worker; }) |
92 | *work = (struct kthread_work)KTHREAD_WORK_INIT(*work, fn); | 92 | # define DEFINE_KTHREAD_WORKER_ONSTACK(worker) \ |
93 | } | 93 | struct kthread_worker worker = KTHREAD_WORKER_INIT_ONSTACK(worker) |
94 | # define KTHREAD_WORK_INIT_ONSTACK(work, fn) \ | ||
95 | ({ init_kthread_work((&work), fn); work; }) | ||
96 | # define DEFINE_KTHREAD_WORK_ONSTACK(work, fn) \ | ||
97 | struct kthread_work work = KTHREAD_WORK_INIT_ONSTACK(work, fn) | ||
98 | #else | ||
99 | # define DEFINE_KTHREAD_WORKER_ONSTACK(worker) DEFINE_KTHREAD_WORKER(worker) | ||
100 | # define DEFINE_KTHREAD_WORK_ONSTACK(work, fn) DEFINE_KTHREAD_WORK(work, fn) | ||
101 | #endif | ||
102 | |||
103 | extern void __init_kthread_worker(struct kthread_worker *worker, | ||
104 | const char *name, struct lock_class_key *key); | ||
105 | |||
106 | #define init_kthread_worker(worker) \ | ||
107 | do { \ | ||
108 | static struct lock_class_key __key; \ | ||
109 | __init_kthread_worker((worker), "("#worker")->lock", &__key); \ | ||
110 | } while (0) | ||
111 | |||
112 | #define init_kthread_work(work, fn) \ | ||
113 | do { \ | ||
114 | memset((work), 0, sizeof(struct kthread_work)); \ | ||
115 | INIT_LIST_HEAD(&(work)->node); \ | ||
116 | (work)->func = (fn); \ | ||
117 | init_waitqueue_head(&(work)->done); \ | ||
118 | } while (0) | ||
94 | 119 | ||
95 | int kthread_worker_fn(void *worker_ptr); | 120 | int kthread_worker_fn(void *worker_ptr); |
96 | 121 | ||
diff --git a/kernel/kthread.c b/kernel/kthread.c index 2dc3786349d1..ca61bbdd44b2 100644 --- a/kernel/kthread.c +++ b/kernel/kthread.c | |||
@@ -265,6 +265,17 @@ int kthreadd(void *unused) | |||
265 | return 0; | 265 | return 0; |
266 | } | 266 | } |
267 | 267 | ||
268 | void __init_kthread_worker(struct kthread_worker *worker, | ||
269 | const char *name, | ||
270 | struct lock_class_key *key) | ||
271 | { | ||
272 | spin_lock_init(&worker->lock); | ||
273 | lockdep_set_class_and_name(&worker->lock, key, name); | ||
274 | INIT_LIST_HEAD(&worker->work_list); | ||
275 | worker->task = NULL; | ||
276 | } | ||
277 | EXPORT_SYMBOL_GPL(__init_kthread_worker); | ||
278 | |||
268 | /** | 279 | /** |
269 | * kthread_worker_fn - kthread function to process kthread_worker | 280 | * kthread_worker_fn - kthread function to process kthread_worker |
270 | * @worker_ptr: pointer to initialized kthread_worker | 281 | * @worker_ptr: pointer to initialized kthread_worker |
diff --git a/mm/percpu.c b/mm/percpu.c index efe816856a9d..02ba91230b99 100644 --- a/mm/percpu.c +++ b/mm/percpu.c | |||
@@ -1268,7 +1268,7 @@ int __init pcpu_setup_first_chunk(const struct pcpu_alloc_info *ai, | |||
1268 | 1268 | ||
1269 | /* we're done parsing the input, undefine BUG macro and dump config */ | 1269 | /* we're done parsing the input, undefine BUG macro and dump config */ |
1270 | #undef PCPU_SETUP_BUG_ON | 1270 | #undef PCPU_SETUP_BUG_ON |
1271 | pcpu_dump_alloc_info(KERN_INFO, ai); | 1271 | pcpu_dump_alloc_info(KERN_DEBUG, ai); |
1272 | 1272 | ||
1273 | pcpu_nr_groups = ai->nr_groups; | 1273 | pcpu_nr_groups = ai->nr_groups; |
1274 | pcpu_group_offsets = group_offsets; | 1274 | pcpu_group_offsets = group_offsets; |