kthread_work: remove the unused wait_queue_head
PATCH 1/1 kthread_work: remove the unused wait_queue_head
The wait_queue_head_t done was totally unused since the flush_kthread_work() had been re-implemented. So we removed it including the initialization code. Some LOCKDEP code also depends on this wait_queue_head, so the LOCKDEP code is also cleanup.
--- include/linux/kthread.h | 16 +++++----------- 1 files changed, 5 insertions(+), 11 deletions(-)
include/linux/kthread.h +5 -11
@@ -73,7 +73,6 @@ struct kthread_worker {struct kthread_work {struct list_head node;kthread_work_func_t func; -wait_queue_head_t done;struct kthread_worker *worker; };
@@ -85,7 +84,6 @@ struct kthread_work {#define KTHREAD_WORK_INIT (work, fn) { \ .node = LIST_HEAD_INIT((work).node), \ .func = (fn), \ - .done = __WAIT_QUEUE_HEAD_INITIALIZER((work).done), \ }#define DEFINE_KTHREAD_WORKER (worker) \
@@ -95,24 +93,21 @@ struct kthread_work {struct kthread_work work =KTHREAD_WORK_INIT (work, fn)/* -* kthread_worker.lock and kthread_work.done need their own lockdep class -* keys if they are defined on stack with lockdep enabled. Use the -* following macros when defining them on stack. +* kthread_worker.lock need its own lockdep class key if it is defined +* on stack with lockdep enabled. Use the following macros when defining +* it on stack. */#ifdef CONFIG_LOCKDEP # define KTHREAD_WORKER_INIT_ONSTACK (worker) \ ({ init_kthread_worker(&worker); worker; })# define DEFINE_KTHREAD_WORKER_ONSTACK (worker) \ struct kthread_worker worker = KTHREAD_WORKER_INIT_ONSTACK(worker) -# define KTHREAD_WORK_INIT_ONSTACK (work, fn) \ - ({ init_kthread_work((&work), fn); work; }) -# define DEFINE_KTHREAD_WORK_ONSTACK (work, fn) \ - struct kthread_work work = KTHREAD_WORK_INIT_ONSTACK(work, fn)#else # define DEFINE_KTHREAD_WORKER_ONSTACK (worker) DEFINE_KTHREAD_WORKER(worker) -# define DEFINE_KTHREAD_WORK_ONSTACK (work, fn) DEFINE_KTHREAD_WORK(work, fn)#endif +# define DEFINE_KTHREAD_WORK_ONSTACK (work, fn) DEFINE_KTHREAD_WORK(work, fn) +extern void __init_kthread_worker (struct kthread_worker *worker,const char *name,struct lock_class_key *key);
@@ -127,7 +122,6 @@ extern void __init_kthread_worker(struct kthread_worker *worker,memset ((work),0 ,sizeof (struct kthread_work )); \INIT_LIST_HEAD (&(work)->node); \ (work)->func = (fn); \ -init_waitqueue_head (&(work)->done); \ }while (0 ) int kthread_worker_fn(void *worker_ptr);
Signature · 1 line
1.7.4.4
PATCH 1/1 kthread_work: remove the unused wait_queue_head
Hello,
Hello,
Updated description and dropped DEFINE_KTHREAD_WORK_ONSTACK(). Applied to wq/for-3.17.
Thanks.
------ 8< ------
Quoted 1 line
From
95847e1bd34c0de86039408b24a05f07e788061dMon Sep 17 00:00:00 2001
From: Lai Jiangshan <[email protected]>
Date: Sat, 26 Jul 2014 12:04:00 +0800
Subject: [PATCH] kthread_work: remove the unused wait_queue_head
The wait_queue_head_t kthread_work->done is unused since flush_kthread_work() has been re-implemented. Let's remove it including the initialization code. This makes DEFINE_KTHREAD_WORK_ONSTACK() unnecessary, removed.
tj: Updated description. Removed DEFINE_KTHREAD_WORK_ONSTACK().
--- include/linux/kthread.h | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-)
include/linux/kthread.h +2 -11
@@ -73,7 +73,6 @@ struct kthread_worker {struct kthread_work {struct list_head node;kthread_work_func_t func; -wait_queue_head_t done;struct kthread_worker *worker; };
@@ -85,7 +84,6 @@ struct kthread_work {#define KTHREAD_WORK_INIT (work, fn) { \ .node = LIST_HEAD_INIT((work).node), \ .func = (fn), \ - .done = __WAIT_QUEUE_HEAD_INITIALIZER((work).done), \ }#define DEFINE_KTHREAD_WORKER (worker) \
@@ -95,22 +93,16 @@ struct kthread_work {struct kthread_work work =KTHREAD_WORK_INIT (work, fn)/* -* kthread_worker.lock and kthread_work.done need their own lockdep class -* keys if they are defined on stack with lockdep enabled. Use the -* following macros when defining them on stack. +* kthread_worker.lock needs its own lockdep class key when defined on +* stack with lockdep enabled. Use the following macros in such cases. */#ifdef CONFIG_LOCKDEP # define KTHREAD_WORKER_INIT_ONSTACK (worker) \ ({ init_kthread_worker(&worker); worker; })# define DEFINE_KTHREAD_WORKER_ONSTACK (worker) \ struct kthread_worker worker = KTHREAD_WORKER_INIT_ONSTACK(worker) -# define KTHREAD_WORK_INIT_ONSTACK (work, fn) \ - ({ init_kthread_work((&work), fn); work; }) -# define DEFINE_KTHREAD_WORK_ONSTACK (work, fn) \ - struct kthread_work work = KTHREAD_WORK_INIT_ONSTACK(work, fn)#else # define DEFINE_KTHREAD_WORKER_ONSTACK (worker) DEFINE_KTHREAD_WORKER(worker) -# define DEFINE_KTHREAD_WORK_ONSTACK (work, fn) DEFINE_KTHREAD_WORK(work, fn)#endif extern void __init_kthread_worker(struct kthread_worker *worker,
@@ -127,7 +119,6 @@ extern void __init_kthread_worker(struct kthread_worker *worker,memset ((work),0 ,sizeof (struct kthread_work )); \INIT_LIST_HEAD (&(work)->node); \ (work)->func = (fn); \ -init_waitqueue_head (&(work)->done); \ }while (0 ) int kthread_worker_fn(void *worker_ptr);
Signature · 1 line
1.9.3