* [PATCH] linux/kthread.h: remove unused macros
@ 2022-03-14 14:53 Rasmus Villemoes
2022-03-14 16:02 ` Tejun Heo
2022-03-15 9:18 ` Petr Mladek
0 siblings, 2 replies; 3+ messages in thread
From: Rasmus Villemoes @ 2022-03-14 14:53 UTC (permalink / raw)
To: Eric W. Biederman, Andrew Morton, Petr Mladek, David Hildenbrand,
Yafang Shao, Cai Huoqing
Cc: Tejun Heo, Rasmus Villemoes, linux-kernel
Ever since these macros were introduced in commit b56c0d8937e6
("kthread: implement kthread_worker"), there has been precisely one
user (commit 4d115420707a, "NVMe: Async IO queue deletion"), and that
user went away in 2016 with db3cbfff5bcc ("NVMe: IO queue deletion
re-write").
Apart from being unused, these macros are also awkward to use (which
may contribute to them not being used): Having a way to statically (or
on-stack) allocating the storage for the struct kthread_worker itself
doesn't help much, since obviously one needs to have some code for
actually _spawning_ the worker thread, which must have error
checking. And these days we have the kthread_create_worker() interface
which both allocates the struct kthread_worker and spawns the kthread.
Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
---
include/linux/kthread.h | 22 ----------------------
1 file changed, 22 deletions(-)
diff --git a/include/linux/kthread.h b/include/linux/kthread.h
index 3df4ea04716f..de5d75bafd66 100644
--- a/include/linux/kthread.h
+++ b/include/linux/kthread.h
@@ -141,12 +141,6 @@ struct kthread_delayed_work {
struct timer_list timer;
};
-#define KTHREAD_WORKER_INIT(worker) { \
- .lock = __RAW_SPIN_LOCK_UNLOCKED((worker).lock), \
- .work_list = LIST_HEAD_INIT((worker).work_list), \
- .delayed_work_list = LIST_HEAD_INIT((worker).delayed_work_list),\
- }
-
#define KTHREAD_WORK_INIT(work, fn) { \
.node = LIST_HEAD_INIT((work).node), \
.func = (fn), \
@@ -158,9 +152,6 @@ struct kthread_delayed_work {
TIMER_IRQSAFE), \
}
-#define DEFINE_KTHREAD_WORKER(worker) \
- struct kthread_worker worker = KTHREAD_WORKER_INIT(worker)
-
#define DEFINE_KTHREAD_WORK(work, fn) \
struct kthread_work work = KTHREAD_WORK_INIT(work, fn)
@@ -168,19 +159,6 @@ struct kthread_delayed_work {
struct kthread_delayed_work dwork = \
KTHREAD_DELAYED_WORK_INIT(dwork, fn)
-/*
- * 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) \
- ({ kthread_init_worker(&worker); worker; })
-# define DEFINE_KTHREAD_WORKER_ONSTACK(worker) \
- struct kthread_worker worker = KTHREAD_WORKER_INIT_ONSTACK(worker)
-#else
-# define DEFINE_KTHREAD_WORKER_ONSTACK(worker) DEFINE_KTHREAD_WORKER(worker)
-#endif
-
extern void __kthread_init_worker(struct kthread_worker *worker,
const char *name, struct lock_class_key *key);
--
2.31.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] linux/kthread.h: remove unused macros
2022-03-14 14:53 [PATCH] linux/kthread.h: remove unused macros Rasmus Villemoes
@ 2022-03-14 16:02 ` Tejun Heo
2022-03-15 9:18 ` Petr Mladek
1 sibling, 0 replies; 3+ messages in thread
From: Tejun Heo @ 2022-03-14 16:02 UTC (permalink / raw)
To: Rasmus Villemoes
Cc: Eric W. Biederman, Andrew Morton, Petr Mladek, David Hildenbrand,
Yafang Shao, Cai Huoqing, linux-kernel
On Mon, Mar 14, 2022 at 03:53:42PM +0100, Rasmus Villemoes wrote:
> Ever since these macros were introduced in commit b56c0d8937e6
> ("kthread: implement kthread_worker"), there has been precisely one
> user (commit 4d115420707a, "NVMe: Async IO queue deletion"), and that
> user went away in 2016 with db3cbfff5bcc ("NVMe: IO queue deletion
> re-write").
>
> Apart from being unused, these macros are also awkward to use (which
> may contribute to them not being used): Having a way to statically (or
> on-stack) allocating the storage for the struct kthread_worker itself
> doesn't help much, since obviously one needs to have some code for
> actually _spawning_ the worker thread, which must have error
> checking. And these days we have the kthread_create_worker() interface
> which both allocates the struct kthread_worker and spawns the kthread.
>
> Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Acked-by: Tejun Heo <tj@kernel.org>
Thanks.
--
tejun
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] linux/kthread.h: remove unused macros
2022-03-14 14:53 [PATCH] linux/kthread.h: remove unused macros Rasmus Villemoes
2022-03-14 16:02 ` Tejun Heo
@ 2022-03-15 9:18 ` Petr Mladek
1 sibling, 0 replies; 3+ messages in thread
From: Petr Mladek @ 2022-03-15 9:18 UTC (permalink / raw)
To: Rasmus Villemoes
Cc: Eric W. Biederman, Andrew Morton, David Hildenbrand, Yafang Shao,
Cai Huoqing, Tejun Heo, linux-kernel
On Mon 2022-03-14 15:53:42, Rasmus Villemoes wrote:
> Ever since these macros were introduced in commit b56c0d8937e6
> ("kthread: implement kthread_worker"), there has been precisely one
> user (commit 4d115420707a, "NVMe: Async IO queue deletion"), and that
> user went away in 2016 with db3cbfff5bcc ("NVMe: IO queue deletion
> re-write").
>
> Apart from being unused, these macros are also awkward to use (which
> may contribute to them not being used): Having a way to statically (or
> on-stack) allocating the storage for the struct kthread_worker itself
> doesn't help much, since obviously one needs to have some code for
> actually _spawning_ the worker thread, which must have error
> checking. And these days we have the kthread_create_worker() interface
> which both allocates the struct kthread_worker and spawns the kthread.
>
> Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Makes sense.
Acked-by: Petr Mladek <pmladek@suse.com>
Best Regards,
Petr
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-03-15 9:18 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-14 14:53 [PATCH] linux/kthread.h: remove unused macros Rasmus Villemoes
2022-03-14 16:02 ` Tejun Heo
2022-03-15 9:18 ` Petr Mladek
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).