Received: by 2002:a05:6a10:2785:0:0:0:0 with SMTP id ia5csp750468pxb; Wed, 13 Jan 2021 15:20:32 -0800 (PST) X-Google-Smtp-Source: ABdhPJyv1Ic9bbsrIMmAyY4nurQQU+hQ/o0WUvwYiZD+uqmSyanEars2YfrHyqggvbX2uMN+Dgd2 X-Received: by 2002:a05:6402:190a:: with SMTP id e10mr3705141edz.110.1610580032318; Wed, 13 Jan 2021 15:20:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610580032; cv=none; d=google.com; s=arc-20160816; b=tpvbEWIZQbbuXU5pdaR4yFj0r32UyFsX262VCvgjZ5ybOXM8kEynwQGwOqMSk0fySy yUkEj+8VuG3Y8AOV7V31o/TNOgEuOKsGsyqxEGk1Iu2luyBibElYUcsYayzS8U7Qo0PB w5vN7s1/HiusSspAHsT7Kj/jMA1mBEVcyHfpewn0FGI2SaVfuuifLUsul0GxdWi1jqxn ac8BdrRtrGeQ+ren5QhoPi8C5NT+aUZ1anbQNZ+eOxL48473qUl7Xo2qoAxVPgOGpVVR dCzD9DNAOOlUSde0Mmahg4z2LmE9saaFOny9/94INoRWQInw59xHs+On0KwBWzUn55c1 CTZw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date; bh=XCy7hpLx2HUb3EqNcAWdeLTHUiGLLgWLgQajaQtHCmU=; b=IAduD0gS3PMVAM2IWsO8SK24EMDeLFoaSodqsnoppBR/azBjZ2klTPMMTGpyTDgv1q De0KvVEYdi58MHUDo+mc+/d/Dk6fgqqLV1UVRg4yYK8v6GnLBdTel1oYH3Nt7AwB1O0H 1cWb15bDCbSgmwVo9kvxhTWu0Mp+WnEbZMEftneVn/gl2BE9hA7fFFRnF0xrAEqF4xEX RBvAnXuiPtjqwBIZ/hs3pSNBX0QSqD3qS0LfFJVM6V/CwAK3BLvgByjbUubjTJhINYDH vmvE+pBcOiRVV93ggCx449ANj/Vf1SxBHnaQBEGj+TZAqFjEjzmPMA45qvTHecxvVteZ rNHQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c14si1979378edr.53.2021.01.13.15.20.08; Wed, 13 Jan 2021 15:20:32 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729338AbhAMXOm (ORCPT + 99 others); Wed, 13 Jan 2021 18:14:42 -0500 Received: from mail.kernel.org ([198.145.29.99]:46250 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729378AbhAMWj5 (ORCPT ); Wed, 13 Jan 2021 17:39:57 -0500 Received: from gandalf.local.home (cpe-66-24-58-225.stny.res.rr.com [66.24.58.225]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 204BD23136; Wed, 13 Jan 2021 22:38:45 +0000 (UTC) Date: Wed, 13 Jan 2021 17:38:43 -0500 From: Steven Rostedt To: peterz@infradead.org Cc: Hui Su , mingo@redhat.com, juri.lelli@redhat.com, vincent.guittot@linaro.org, dietmar.eggemann@arm.com, bsegall@google.com, mgorman@suse.de, bristot@redhat.com, linux-kernel@vger.kernel.org Subject: Re: [PATCH] sched: use task_current() instead of 'rq->curr == p' Message-ID: <20210113173843.19227a86@gandalf.local.home> In-Reply-To: <20201030173223.GA52339@rlk> References: <20201030173223.GA52339@rlk> X-Mailer: Claws Mail 3.17.8 (GTK+ 2.24.33; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Peter, This is a simple clean up patch that makes sense to me. Want to take it? Reviewed-by: Steven Rostedt (VMware) -- Steve On Sat, 31 Oct 2020 01:32:23 +0800 Hui Su wrote: > We have supplied the macro: 'task_current()', and we should > all use task_current() instaed of 'rq->curr == p', > which is more readable. > > No functional change. > > Signed-off-by: Hui Su > --- > kernel/sched/deadline.c | 2 +- > kernel/sched/debug.c | 2 +- > kernel/sched/fair.c | 6 +++--- > kernel/sched/rt.c | 2 +- > 4 files changed, 6 insertions(+), 6 deletions(-) > > diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c > index f232305dcefe..3b335be97952 100644 > --- a/kernel/sched/deadline.c > +++ b/kernel/sched/deadline.c > @@ -2474,7 +2474,7 @@ static void switched_to_dl(struct rq *rq, struct task_struct *p) > static void prio_changed_dl(struct rq *rq, struct task_struct *p, > int oldprio) > { > - if (task_on_rq_queued(p) || rq->curr == p) { > + if (task_on_rq_queued(p) || task_current(rq, p)) { > #ifdef CONFIG_SMP > /* > * This might be too much, but unfortunately > diff --git a/kernel/sched/debug.c b/kernel/sched/debug.c > index 0655524700d2..1ca554f10901 100644 > --- a/kernel/sched/debug.c > +++ b/kernel/sched/debug.c > @@ -486,7 +486,7 @@ static char *task_group_path(struct task_group *tg) > static void > print_task(struct seq_file *m, struct rq *rq, struct task_struct *p) > { > - if (rq->curr == p) > + if (task_current(rq, p)) > SEQ_printf(m, ">R"); > else > SEQ_printf(m, " %c", task_state_to_char(p)); > diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c > index 290f9e38378c..c3e3ae76302e 100644 > --- a/kernel/sched/fair.c > +++ b/kernel/sched/fair.c > @@ -5399,7 +5399,7 @@ static void hrtick_start_fair(struct rq *rq, struct task_struct *p) > s64 delta = slice - ran; > > if (delta < 0) { > - if (rq->curr == p) > + if (task_current(rq, p)) > resched_curr(rq); > return; > } > @@ -10740,7 +10740,7 @@ prio_changed_fair(struct rq *rq, struct task_struct *p, int oldprio) > * our priority decreased, or if we are not currently running on > * this runqueue and our priority is higher than the current's > */ > - if (rq->curr == p) { > + if (task_current(rq, p)) { > if (p->prio > oldprio) > resched_curr(rq); > } else > @@ -10873,7 +10873,7 @@ static void switched_to_fair(struct rq *rq, struct task_struct *p) > * kick off the schedule if running, otherwise just see > * if we can still preempt the current task. > */ > - if (rq->curr == p) > + if (task_current(rq, p)) > resched_curr(rq); > else > check_preempt_curr(rq, p, 0); > diff --git a/kernel/sched/rt.c b/kernel/sched/rt.c > index 49ec096a8aa1..cd615aace14c 100644 > --- a/kernel/sched/rt.c > +++ b/kernel/sched/rt.c > @@ -2317,7 +2317,7 @@ prio_changed_rt(struct rq *rq, struct task_struct *p, int oldprio) > if (!task_on_rq_queued(p)) > return; > > - if (rq->curr == p) { > + if (task_current(rq, p)) { > #ifdef CONFIG_SMP > /* > * If our priority decreases while running, we