Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp1467064pxx; Fri, 30 Oct 2020 10:36:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzs1ls4Vn0pvNUZTcdJ3TkKv3pjHyLstpcuowC8dWOwRJ5b8kpZKh1F2jDynTLEEwjFMyl5 X-Received: by 2002:a17:906:8398:: with SMTP id p24mr3660019ejx.401.1604079379819; Fri, 30 Oct 2020 10:36:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1604079379; cv=none; d=google.com; s=arc-20160816; b=NG86A+541WVruo4cFwHOuLvUjY5FohmqcJi9bTzCJI4D/yOCDJTdgpclzRfj8zWGL1 JJqdtwYmkFmvpk+bTn5wuLSqhKnLUivUNudo1jimEL3KLqT5idQW+UaYfkDx9XjnBg9E F8xmKgTVsvDISq1WXbJzw8WvLteQUXmCXDLtx0I3rgkiqkVnSfAoJiumeeXdNCffw2Wz JErZJZXNLM5oYkZ4YNMWZ+kFrw2Bm1PaZlsW4ilveLExLCfraDZ6SxZRKpUiqKZINMKl woMXmAJnnFCUTopoDht9DfL92o7MNdrDjNWN3rug6HECfzQfDusG6FGuYTvHdQmCigDG cqYA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-disposition:mime-version:message-id :subject:to:from:date:dkim-signature; bh=aXz6PXMABCaK75Cp1e9lZub5YPOLySPyU3fHr8pFIik=; b=SHy4sqStxrMKkpV2jDN3hTrRp9CbaCTjZENtfNWAyl0aszgpB7GYrBRr9gJkMd8CCa z7ILOL8rfpKlE8FZ8MVlsVEcDFIeSi1HKwqn4FEwBWGD7q5JKA7fUgatBXXjpFZOUIOZ 1MeixCVoMZqdQXLLO7bz7w7i2zOQnzctaOj4OfQ5L2JMx0K+wp4Uu5m0520cUQoi6GtC BKJqU+RSkoJM6O73A1dHMRi1v2OE0DXqPHr88dSr7izKONuT5A7eB4RS4ZWmdPWgkXTg cb6rw3vu0H4NwtVhXANsCKnJFxjXI/KkUax+uuPY99WOJJMjcujuzTcN8MbZzjgBggfr DRHQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@163.com header.s=s110527 header.b=NHlZHF6a; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=163.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r26si5374506edi.587.2020.10.30.10.35.55; Fri, 30 Oct 2020 10:36:19 -0700 (PDT) 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; dkim=pass header.i=@163.com header.s=s110527 header.b=NHlZHF6a; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=163.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726860AbgJ3ReY (ORCPT + 99 others); Fri, 30 Oct 2020 13:34:24 -0400 Received: from m12-14.163.com ([220.181.12.14]:52117 "EHLO m12-14.163.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726439AbgJ3ReY (ORCPT ); Fri, 30 Oct 2020 13:34:24 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com; s=s110527; h=Date:From:Subject:Message-ID:MIME-Version; bh=aXz6P XMABCaK75Cp1e9lZub5YPOLySPyU3fHr8pFIik=; b=NHlZHF6ajC5ZsmfROH0tE tpHlFrqSuNp7VrHYz6dnphEEk6GELeAWT4NtWxdH9AcDubHyuVAOndTZigXAmR60 WpF0+f+fzBuFvsgiZkU+iSOxWlrcIFoOfhMvPW/Q0vlkfT5g6am4Y8vcAw3e0dBO yw/O4zm5fB2hWTKraDBnS4= Received: from localhost (unknown [101.86.209.82]) by smtp10 (Coremail) with SMTP id DsCowADHDrMnTpxfuqgeTA--.6732S2; Sat, 31 Oct 2020 01:32:23 +0800 (CST) Date: Sat, 31 Oct 2020 01:32:23 +0800 From: Hui Su To: mingo@redhat.com, peterz@infradead.org, juri.lelli@redhat.com, vincent.guittot@linaro.org, dietmar.eggemann@arm.com, rostedt@goodmis.org, bsegall@google.com, mgorman@suse.de, bristot@redhat.com, linux-kernel@vger.kernel.org Subject: [PATCH] sched: use task_current() instead of 'rq->curr == p' Message-ID: <20201030173223.GA52339@rlk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-CM-TRANSID: DsCowADHDrMnTpxfuqgeTA--.6732S2 X-Coremail-Antispam: 1Uf129KBjvJXoWxAr1rZw4ktrWxury8JFW5ZFb_yoW5Xw45pa 98W3yUJw4kGayjqr18ZFZ5Zr43G3s5X3sIgF1vy3ySyF4rK34Fq3WUtFWa9r1Yvr109r4a vr4qgrW7Kw18KF7anT9S1TB71UUUUU7qnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x07jyT5LUUUUU= X-Originating-IP: [101.86.209.82] X-CM-SenderInfo: xvkbvvri6rljoofrz/1tbitwfNX1aEGOuoxgAAst Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 -- 2.29.0