From: Peter Zijlstra <peterz@infradead.org>
To: Alexander Gordeev <agordeev@redhat.com>
Cc: linux-kernel@vger.kernel.org, Oleg Nesterov <oleg@redhat.com>,
Tejun Heo <tj@kernel.org>
Subject: Re: [PATCH v3 1/2] sched/core: Get rid of 'cpu' argument in wq_worker_sleeping()
Date: Wed, 2 Mar 2016 13:03:16 +0100 [thread overview]
Message-ID: <20160302120316.GD6356@twins.programming.kicks-ass.net> (raw)
In-Reply-To: <3cc0bf6e136c1177c9dd56d567d5e3f76147d456.1456919394.git.agordeev@redhat.com>
This really should also have been Cc'ed to TJ, doing so now.
On Wed, Mar 02, 2016 at 12:53:31PM +0100, Alexander Gordeev wrote:
> Given that wq_worker_sleeping() could only be called for a
> CPU it is running on, we do not need passing a CPU ID as an
> argument.
>
> Suggested-by: Oleg Nesterov <oleg@redhat.com>
> Cc: Oleg Nesterov <oleg@redhat.com>
> Cc: Peter Zijlstra <peterz@infradead.org>
> Signed-off-by: Alexander Gordeev <agordeev@redhat.com>
> ---
> kernel/sched/core.c | 2 +-
> kernel/workqueue.c | 5 ++---
> kernel/workqueue_internal.h | 2 +-
> 3 files changed, 4 insertions(+), 5 deletions(-)
>
> diff --git a/kernel/sched/core.c b/kernel/sched/core.c
> index 423452c..735e87c 100644
> --- a/kernel/sched/core.c
> +++ b/kernel/sched/core.c
> @@ -3183,7 +3183,7 @@ static void __sched notrace __schedule(bool preempt)
> if (prev->flags & PF_WQ_WORKER) {
> struct task_struct *to_wakeup;
>
> - to_wakeup = wq_worker_sleeping(prev, cpu);
> + to_wakeup = wq_worker_sleeping(prev);
> if (to_wakeup)
> try_to_wake_up_local(to_wakeup);
> }
> diff --git a/kernel/workqueue.c b/kernel/workqueue.c
> index 7ff5dc7..2fa8d26 100644
> --- a/kernel/workqueue.c
> +++ b/kernel/workqueue.c
> @@ -858,7 +858,6 @@ void wq_worker_waking_up(struct task_struct *task, int cpu)
> /**
> * wq_worker_sleeping - a worker is going to sleep
> * @task: task going to sleep
> - * @cpu: CPU in question, must be the current CPU number
> *
> * This function is called during schedule() when a busy worker is
> * going to sleep. Worker on the same cpu can be woken up by
> @@ -870,7 +869,7 @@ void wq_worker_waking_up(struct task_struct *task, int cpu)
> * Return:
> * Worker task on @cpu to wake up, %NULL if none.
> */
> -struct task_struct *wq_worker_sleeping(struct task_struct *task, int cpu)
> +struct task_struct *wq_worker_sleeping(struct task_struct *task)
> {
> struct worker *worker = kthread_data(task), *to_wakeup = NULL;
> struct worker_pool *pool;
> @@ -886,7 +885,7 @@ struct task_struct *wq_worker_sleeping(struct task_struct *task, int cpu)
> pool = worker->pool;
>
> /* this can only happen on the local cpu */
> - if (WARN_ON_ONCE(cpu != raw_smp_processor_id() || pool->cpu != cpu))
> + if (WARN_ON_ONCE(pool->cpu != raw_smp_processor_id()))
> return NULL;
>
> /*
> diff --git a/kernel/workqueue_internal.h b/kernel/workqueue_internal.h
> index 4521587..8635417 100644
> --- a/kernel/workqueue_internal.h
> +++ b/kernel/workqueue_internal.h
> @@ -69,6 +69,6 @@ static inline struct worker *current_wq_worker(void)
> * sched/core.c and workqueue.c.
> */
> void wq_worker_waking_up(struct task_struct *task, int cpu);
> -struct task_struct *wq_worker_sleeping(struct task_struct *task, int cpu);
> +struct task_struct *wq_worker_sleeping(struct task_struct *task);
>
> #endif /* _KERNEL_WORKQUEUE_INTERNAL_H */
> --
> 1.8.3.1
>
next prev parent reply other threads:[~2016-03-02 12:03 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-02 11:53 [PATCH v3 0/2] sched/core: Cleanup leftovers in __schedule() Alexander Gordeev
2016-03-02 11:53 ` [PATCH v3 1/2] sched/core: Get rid of 'cpu' argument in wq_worker_sleeping() Alexander Gordeev
2016-03-02 12:03 ` Peter Zijlstra [this message]
2016-03-02 15:28 ` Tejun Heo
2016-03-02 11:53 ` [PATCH v3 2/2] sched/core: Get rid of 'cpu' local variable in __schedule() Alexander Gordeev
2016-03-02 12:05 ` Peter Zijlstra
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20160302120316.GD6356@twins.programming.kicks-ass.net \
--to=peterz@infradead.org \
--cc=agordeev@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=oleg@redhat.com \
--cc=tj@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®