Skip to content

Commit 9b7f659

Browse files
Alexander Gordeevhtejun
authored andcommitted
sched/core: Get rid of 'cpu' argument in wq_worker_sleeping()
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> Signed-off-by: Tejun Heo <tj@kernel.org>
1 parent 23217b4 commit 9b7f659

File tree

3 files changed

+4
-5
lines changed

3 files changed

+4
-5
lines changed

kernel/sched/core.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3257,7 +3257,7 @@ static void __sched notrace __schedule(bool preempt)
32573257
if (prev->flags & PF_WQ_WORKER) {
32583258
struct task_struct *to_wakeup;
32593259

3260-
to_wakeup = wq_worker_sleeping(prev, cpu);
3260+
to_wakeup = wq_worker_sleeping(prev);
32613261
if (to_wakeup)
32623262
try_to_wake_up_local(to_wakeup);
32633263
}

kernel/workqueue.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -858,7 +858,6 @@ void wq_worker_waking_up(struct task_struct *task, int cpu)
858858
/**
859859
* wq_worker_sleeping - a worker is going to sleep
860860
* @task: task going to sleep
861-
* @cpu: CPU in question, must be the current CPU number
862861
*
863862
* This function is called during schedule() when a busy worker is
864863
* 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)
870869
* Return:
871870
* Worker task on @cpu to wake up, %NULL if none.
872871
*/
873-
struct task_struct *wq_worker_sleeping(struct task_struct *task, int cpu)
872+
struct task_struct *wq_worker_sleeping(struct task_struct *task)
874873
{
875874
struct worker *worker = kthread_data(task), *to_wakeup = NULL;
876875
struct worker_pool *pool;
@@ -886,7 +885,7 @@ struct task_struct *wq_worker_sleeping(struct task_struct *task, int cpu)
886885
pool = worker->pool;
887886

888887
/* this can only happen on the local cpu */
889-
if (WARN_ON_ONCE(cpu != raw_smp_processor_id() || pool->cpu != cpu))
888+
if (WARN_ON_ONCE(pool->cpu != raw_smp_processor_id()))
890889
return NULL;
891890

892891
/*

kernel/workqueue_internal.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,6 @@ static inline struct worker *current_wq_worker(void)
6969
* sched/core.c and workqueue.c.
7070
*/
7171
void wq_worker_waking_up(struct task_struct *task, int cpu);
72-
struct task_struct *wq_worker_sleeping(struct task_struct *task, int cpu);
72+
struct task_struct *wq_worker_sleeping(struct task_struct *task);
7373

7474
#endif /* _KERNEL_WORKQUEUE_INTERNAL_H */

0 commit comments

Comments
 (0)