From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932700AbdJPW6a (ORCPT ); Mon, 16 Oct 2017 18:58:30 -0400 Received: from mail-pg0-f53.google.com ([74.125.83.53]:48391 "EHLO mail-pg0-f53.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932675AbdJPW61 (ORCPT ); Mon, 16 Oct 2017 18:58:27 -0400 X-Google-Smtp-Source: AOwi7QDyEoCU26UZSPrE6kK9pWfxWLPKPjhKCmoP+er0uaTF6mnNmunBvGZ0HfHn2Bp4eXGdc2Urmw== Date: Mon, 16 Oct 2017 15:58:25 -0700 From: Kees Cook To: Thomas Gleixner Cc: Tejun Heo , Lai Jiangshan , linux-kernel@vger.kernel.org Subject: [PATCH] workqueue: Convert timers to use timer_setup() (part 2) Message-ID: <20171016225825.GA99101@beast> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 Cc: Lai Jiangshan Signed-off-by: Kees Cook --- 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