* [PATCH] sched/deadline: Use helper function task_current()
@ 2023-06-17 7:43 Miaohe Lin
2023-06-17 12:26 ` Peter Zijlstra
0 siblings, 1 reply; 3+ messages in thread
From: Miaohe Lin @ 2023-06-17 7:43 UTC (permalink / raw)
To: mingo, peterz, juri.lelli, vincent.guittot
Cc: dietmar.eggemann, rostedt, bsegall, mgorman, bristot, vschneid,
linux-kernel, linmiaohe
Use helper function task_current() to check whether task is currently
running on the runqueue. No functional change intended.
Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>
---
kernel/sched/deadline.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c
index f827067ad03b..23284229e16b 100644
--- a/kernel/sched/deadline.c
+++ b/kernel/sched/deadline.c
@@ -2424,7 +2424,7 @@ static void pull_dl_task(struct rq *this_rq)
*/
if (p && dl_time_before(p->dl.deadline, dmin) &&
dl_task_is_earliest_deadline(p, this_rq)) {
- WARN_ON(p == src_rq->curr);
+ WARN_ON(task_current(src_rq, p));
WARN_ON(!task_on_rq_queued(p));
/*
@@ -2636,7 +2636,7 @@ static void switched_to_dl(struct rq *rq, struct task_struct *p)
return;
}
- if (rq->curr != p) {
+ if (!task_current(rq, p)) {
#ifdef CONFIG_SMP
if (p->nr_cpus_allowed > 1 && rq->dl.overloaded)
deadline_queue_push_tasks(rq);
--
2.27.0
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] sched/deadline: Use helper function task_current()
2023-06-17 7:43 [PATCH] sched/deadline: Use helper function task_current() Miaohe Lin
@ 2023-06-17 12:26 ` Peter Zijlstra
2023-06-19 1:49 ` Miaohe Lin
0 siblings, 1 reply; 3+ messages in thread
From: Peter Zijlstra @ 2023-06-17 12:26 UTC (permalink / raw)
To: Miaohe Lin
Cc: mingo, juri.lelli, vincent.guittot, dietmar.eggemann, rostedt,
bsegall, mgorman, bristot, vschneid, linux-kernel
On Sat, Jun 17, 2023 at 03:43:05PM +0800, Miaohe Lin wrote:
> Use helper function task_current() to check whether task is currently
> running on the runqueue. No functional change intended.
Why though? this makes no sense. Please leave perfectly fine code alone.
> Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>
> ---
> kernel/sched/deadline.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c
> index f827067ad03b..23284229e16b 100644
> --- a/kernel/sched/deadline.c
> +++ b/kernel/sched/deadline.c
> @@ -2424,7 +2424,7 @@ static void pull_dl_task(struct rq *this_rq)
> */
> if (p && dl_time_before(p->dl.deadline, dmin) &&
> dl_task_is_earliest_deadline(p, this_rq)) {
> - WARN_ON(p == src_rq->curr);
> + WARN_ON(task_current(src_rq, p));
> WARN_ON(!task_on_rq_queued(p));
>
> /*
> @@ -2636,7 +2636,7 @@ static void switched_to_dl(struct rq *rq, struct task_struct *p)
> return;
> }
>
> - if (rq->curr != p) {
> + if (!task_current(rq, p)) {
> #ifdef CONFIG_SMP
> if (p->nr_cpus_allowed > 1 && rq->dl.overloaded)
> deadline_queue_push_tasks(rq);
> --
> 2.27.0
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] sched/deadline: Use helper function task_current()
2023-06-17 12:26 ` Peter Zijlstra
@ 2023-06-19 1:49 ` Miaohe Lin
0 siblings, 0 replies; 3+ messages in thread
From: Miaohe Lin @ 2023-06-19 1:49 UTC (permalink / raw)
To: Peter Zijlstra
Cc: mingo, juri.lelli, vincent.guittot, dietmar.eggemann, rostedt,
bsegall, mgorman, bristot, vschneid, linux-kernel
On 2023/6/17 20:26, Peter Zijlstra wrote:
> On Sat, Jun 17, 2023 at 03:43:05PM +0800, Miaohe Lin wrote:
>> Use helper function task_current() to check whether task is currently
>> running on the runqueue. No functional change intended.
>
> Why though? this makes no sense. Please leave perfectly fine code alone.
IMHO, it would improve the code readability if we use helper function/macro instead
of open code it directly. If this is unwanted change, I will drop this patch. :)
Thanks.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-06-19 1:49 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-17 7:43 [PATCH] sched/deadline: Use helper function task_current() Miaohe Lin
2023-06-17 12:26 ` Peter Zijlstra
2023-06-19 1:49 ` Miaohe Lin
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®