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


Groups > linux.kernel > #1345352

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

From Alexander Gordeev <agordeev@redhat.com>
Newsgroups linux.kernel
Subject [PATCH 1/2] sched/core: Get rid of 'cpu' argument in wq_worker_sleeping()
Date 2016-02-28 17:50 +0100
Message-ID <r7cHE-5nd-9@gated-at.bofh.it> (permalink)
References <r7cHD-5nd-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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.

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          | 4 ++--
 kernel/workqueue_internal.h | 2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 9503d59..4e56a4d 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -3257,7 +3257,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..967a1ab 100644
--- a/kernel/workqueue.c
+++ b/kernel/workqueue.c
@@ -870,7 +870,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 +886,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 != 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

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 0/2] sched/core: Cleanup leftovers in __schedule() Alexander Gordeev <agordeev@redhat.com> - 2016-02-28 17:50 +0100
  [PATCH 1/2] sched/core: Get rid of 'cpu' argument in wq_worker_sleeping() Alexander Gordeev <agordeev@redhat.com> - 2016-02-28 17:50 +0100
    Re: [PATCH 1/2] sched/core: Get rid of 'cpu' argument in  wq_worker_sleeping() kbuild test robot <lkp@intel.com> - 2016-02-28 18:50 +0100
    Re: [PATCH 1/2] sched/core: Get rid of 'cpu' argument in  wq_worker_sleeping() Oleg Nesterov <oleg@redhat.com> - 2016-02-29 20:10 +0100

csiph-web