* [PATCH] workqueue: Convert timers to use timer_setup() (part 2)
@ 2017-10-16 22:58 Kees Cook
2017-10-18 13:33 ` Tejun Heo
2017-10-18 15:07 ` [tip:timers/core] " tip-bot for Kees Cook
0 siblings, 2 replies; 3+ messages in thread
From: Kees Cook @ 2017-10-16 22:58 UTC (permalink / raw)
To: Thomas Gleixner; +Cc: Tejun Heo, Lai Jiangshan, linux-kernel
In preparation for unconditionally passing the struct timer_list pointer
to all timer callbacks, switch to using the new timer_setup() and
from_timer() to pass the timer pointer explicitly. (The prior workqueue
patch missed a few timers.)
Cc: Tejun Heo <tj@kernel.org>
Cc: Lai Jiangshan <jiangshanlai@gmail.com>
Signed-off-by: Kees Cook <keescook@chromium.org>
---
kernel/workqueue.c | 14 ++++++--------
1 file changed, 6 insertions(+), 8 deletions(-)
diff --git a/kernel/workqueue.c b/kernel/workqueue.c
index 0fca63fab060..3b67c0a0df16 100644
--- a/kernel/workqueue.c
+++ b/kernel/workqueue.c
@@ -1832,9 +1832,9 @@ static void destroy_worker(struct worker *worker)
wake_up_process(worker->task);
}
-static void idle_worker_timeout(unsigned long __pool)
+static void idle_worker_timeout(struct timer_list *t)
{
- struct worker_pool *pool = (void *)__pool;
+ struct worker_pool *pool = from_timer(pool, t, idle_timer);
spin_lock_irq(&pool->lock);
@@ -1880,9 +1880,9 @@ static void send_mayday(struct work_struct *work)
}
}
-static void pool_mayday_timeout(unsigned long __pool)
+static void pool_mayday_timeout(struct timer_list *t)
{
- struct worker_pool *pool = (void *)__pool;
+ struct worker_pool *pool = from_timer(pool, t, mayday_timer);
struct work_struct *work;
spin_lock_irq(&pool->lock);
@@ -3235,11 +3235,9 @@ static int init_worker_pool(struct worker_pool *pool)
INIT_LIST_HEAD(&pool->idle_list);
hash_init(pool->busy_hash);
- setup_deferrable_timer(&pool->idle_timer, idle_worker_timeout,
- (unsigned long)pool);
+ timer_setup(&pool->idle_timer, idle_worker_timeout, TIMER_DEFERRABLE);
- setup_timer(&pool->mayday_timer, pool_mayday_timeout,
- (unsigned long)pool);
+ timer_setup(&pool->mayday_timer, pool_mayday_timeout, 0);
mutex_init(&pool->attach_mutex);
INIT_LIST_HEAD(&pool->workers);
--
2.7.4
--
Kees Cook
Pixel Security
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] workqueue: Convert timers to use timer_setup() (part 2)
2017-10-16 22:58 [PATCH] workqueue: Convert timers to use timer_setup() (part 2) Kees Cook
@ 2017-10-18 13:33 ` Tejun Heo
2017-10-18 15:07 ` [tip:timers/core] " tip-bot for Kees Cook
1 sibling, 0 replies; 3+ messages in thread
From: Tejun Heo @ 2017-10-18 13:33 UTC (permalink / raw)
To: Kees Cook; +Cc: Thomas Gleixner, Lai Jiangshan, linux-kernel
On Mon, Oct 16, 2017 at 03:58:25PM -0700, Kees Cook wrote:
> In preparation for unconditionally passing the struct timer_list pointer
> to all timer callbacks, switch to using the new timer_setup() and
> from_timer() to pass the timer pointer explicitly. (The prior workqueue
> patch missed a few timers.)
>
> Cc: Tejun Heo <tj@kernel.org>
> Cc: Lai Jiangshan <jiangshanlai@gmail.com>
> Signed-off-by: Kees Cook <keescook@chromium.org>
Acked-by: Tejun Heo <tj@kernel.org>
Please feel free to route with other timer patches.
Thanks.
--
tejun
^ permalink raw reply [flat|nested] 3+ messages in thread
* [tip:timers/core] workqueue: Convert timers to use timer_setup() (part 2)
2017-10-16 22:58 [PATCH] workqueue: Convert timers to use timer_setup() (part 2) Kees Cook
2017-10-18 13:33 ` Tejun Heo
@ 2017-10-18 15:07 ` tip-bot for Kees Cook
1 sibling, 0 replies; 3+ messages in thread
From: tip-bot for Kees Cook @ 2017-10-18 15:07 UTC (permalink / raw)
To: linux-tip-commits
Cc: jiangshanlai, tj, hpa, keescook, linux-kernel, mingo, tglx
Commit-ID: 32a6c7233c41216f5dd41fc7bf100eedb1063dfc
Gitweb: https://git.kernel.org/tip/32a6c7233c41216f5dd41fc7bf100eedb1063dfc
Author: Kees Cook <keescook@chromium.org>
AuthorDate: Mon, 16 Oct 2017 15:58:25 -0700
Committer: Thomas Gleixner <tglx@linutronix.de>
CommitDate: Wed, 18 Oct 2017 17:04:25 +0200
workqueue: Convert timers to use timer_setup() (part 2)
In preparation for unconditionally passing the struct timer_list pointer
to all timer callbacks, switch to using the new timer_setup() and
from_timer() to pass the timer pointer explicitly. (The prior workqueue
patch missed a few timers.)
Signed-off-by: Kees Cook <keescook@chromium.org>
Acked-by: Tejun Heo <tj@kernel.org>
Cc: Lai Jiangshan <jiangshanlai@gmail.com>
Link: https://lkml.kernel.org/r/20171016225825.GA99101@beast
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
---
kernel/workqueue.c | 14 ++++++--------
1 file changed, 6 insertions(+), 8 deletions(-)
diff --git a/kernel/workqueue.c b/kernel/workqueue.c
index c77fdf6..6e5eed58 100644
--- a/kernel/workqueue.c
+++ b/kernel/workqueue.c
@@ -1831,9 +1831,9 @@ static void destroy_worker(struct worker *worker)
wake_up_process(worker->task);
}
-static void idle_worker_timeout(unsigned long __pool)
+static void idle_worker_timeout(struct timer_list *t)
{
- struct worker_pool *pool = (void *)__pool;
+ struct worker_pool *pool = from_timer(pool, t, idle_timer);
spin_lock_irq(&pool->lock);
@@ -1879,9 +1879,9 @@ static void send_mayday(struct work_struct *work)
}
}
-static void pool_mayday_timeout(unsigned long __pool)
+static void pool_mayday_timeout(struct timer_list *t)
{
- struct worker_pool *pool = (void *)__pool;
+ struct worker_pool *pool = from_timer(pool, t, mayday_timer);
struct work_struct *work;
spin_lock_irq(&pool->lock);
@@ -3241,11 +3241,9 @@ static int init_worker_pool(struct worker_pool *pool)
INIT_LIST_HEAD(&pool->idle_list);
hash_init(pool->busy_hash);
- setup_deferrable_timer(&pool->idle_timer, idle_worker_timeout,
- (unsigned long)pool);
+ timer_setup(&pool->idle_timer, idle_worker_timeout, TIMER_DEFERRABLE);
- setup_timer(&pool->mayday_timer, pool_mayday_timeout,
- (unsigned long)pool);
+ timer_setup(&pool->mayday_timer, pool_mayday_timeout, 0);
mutex_init(&pool->manager_arb);
mutex_init(&pool->attach_mutex);
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-10-18 15:10 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-10-16 22:58 [PATCH] workqueue: Convert timers to use timer_setup() (part 2) Kees Cook
2017-10-18 13:33 ` Tejun Heo
2017-10-18 15:07 ` [tip:timers/core] " tip-bot for Kees Cook
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).