Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1347980 > unrolled thread

[PATCH v3 1/2] sched/core: Get rid of 'cpu' argument in wq_worker_sleeping()

Started byAlexander Gordeev <agordeev@redhat.com>
First post2016-03-02 13:00 +0100
Last post2016-03-02 16:30 +0100
Articles 3 — 3 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH v3 1/2] sched/core: Get rid of 'cpu' argument in wq_worker_sleeping() Alexander Gordeev <agordeev@redhat.com> - 2016-03-02 13:00 +0100
    Re: [PATCH v3 1/2] sched/core: Get rid of 'cpu' argument in  wq_worker_sleeping() Peter Zijlstra <peterz@infradead.org> - 2016-03-02 13:10 +0100
      Re: [PATCH v3 1/2] sched/core: Get rid of 'cpu' argument in  wq_worker_sleeping() Tejun Heo <tj@kernel.org> - 2016-03-02 16:30 +0100

#1347980 — [PATCH v3 1/2] sched/core: Get rid of 'cpu' argument in wq_worker_sleeping()

FromAlexander Gordeev <agordeev@redhat.com>
Date2016-03-02 13:00 +0100
Subject[PATCH v3 1/2] sched/core: Get rid of 'cpu' argument in wq_worker_sleeping()
Message-ID<r8dBD-75k-3@gated-at.bofh.it>
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

[toc] | [next] | [standalone]


#1347989 — Re: [PATCH v3 1/2] sched/core: Get rid of 'cpu' argument in wq_worker_sleeping()

FromPeter Zijlstra <peterz@infradead.org>
Date2016-03-02 13:10 +0100
SubjectRe: [PATCH v3 1/2] sched/core: Get rid of 'cpu' argument in wq_worker_sleeping()
Message-ID<r8dLk-7nZ-15@gated-at.bofh.it>
In reply to#1347980
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
> 

[toc] | [prev] | [next] | [standalone]


#1348154 — Re: [PATCH v3 1/2] sched/core: Get rid of 'cpu' argument in wq_worker_sleeping()

FromTejun Heo <tj@kernel.org>
Date2016-03-02 16:30 +0100
SubjectRe: [PATCH v3 1/2] sched/core: Get rid of 'cpu' argument in wq_worker_sleeping()
Message-ID<r8gST-14i-41@gated-at.bofh.it>
In reply to#1347989
On Wed, Mar 02, 2016 at 01:03:16PM +0100, Peter Zijlstra wrote:
> 
> 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>

Acked-by: Tejun Heo <tj@kernel.org>

I'll route this through wq/for-4.6.

Thanks.

-- 
tejun

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web