Message ID | 20230617074305.1916633-1-linmiaohe@huawei.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp1850700vqr; Sat, 17 Jun 2023 01:23:36 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4Q2uZ5IrpQ5yBqDhvH+u8mmDOEcEb8r84SoqONBg82LltzFaYRrnDrAlZFsmsOpIKnMsg1 X-Received: by 2002:a05:6871:e87:b0:19f:2346:b59d with SMTP id vl7-20020a0568710e8700b0019f2346b59dmr1708714oab.55.1686990215881; Sat, 17 Jun 2023 01:23:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686990215; cv=none; d=google.com; s=arc-20160816; b=um10h54T4ytY5x9rGQQuGFYu5MjqJxU4wLtXYGjurdR8FufaAVsd9BXREtmqcEgYme D91Z9R33Q0i/+OIvg+UKMxSjMZWMN4mGMRHh8G31qWMclv0M+i/sBFnYKhDk9IaC859I F+RJ/s1yPPBVUm16U8gtnLCxewsEGVOhFsnKeyAqs5tDZ3FtP9Z2Kih21+LeUty5saLV ro1tgxMm/hD4emz8wASzSK7C7xlyzrT6D8aa+t/lZRK673iSssMZ1eIdwQVF69jlwwNr 17ZKvemquSRYRGCTnXOHsoSxdKaFuCj56TpJn/LesFpETnT8ntNDQQEI0ExOby+JZJrp CGtQ== 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 :message-id:date:subject:cc:to:from; bh=WXVju0Zc0j6gniX0wKieVhSAOvP2dsEoHsHa+2RyO94=; b=kgSOy8ftF68FJMyYlmXDfm6Z/mxlLISIQIfkJMgqTyOUCWIUgft/mQWN8lao1XRnjD 0hAoTLc/PEXL+m7IVgMPRfpXYzAcDwrdPafxeBrhsV+L1O+xfeKLsoBziSpj0wfL6ODl PMiZC0xYORsytfsh+iOqvv+o0KUpaU5iuqf9tnL2p/Sj/aqdM6uLPztvPquXFOMAQ/Rh wys8xIkwW55nf/oJzjDTDEK9uWwo0RMcZZQTfarVjnDv5PkhZGLLbAV79AtlHEwRkJDv XSswCSZ1CMx/lvs+IT9A6lOg3cl7pZuSQ/erBPmHqL+tZ0ePMps7OrAEiIyAA40BOUS5 gpYg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f10-20020a63de0a000000b00543d2b94731si13857107pgg.479.2023.06.17.01.23.20; Sat, 17 Jun 2023 01:23:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345655AbjFQHnl (ORCPT <rfc822;maxin.john@gmail.com> + 99 others); Sat, 17 Jun 2023 03:43:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50634 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233521AbjFQHnk (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Sat, 17 Jun 2023 03:43:40 -0400 Received: from szxga08-in.huawei.com (szxga08-in.huawei.com [45.249.212.255]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 823BC26BE for <linux-kernel@vger.kernel.org>; Sat, 17 Jun 2023 00:43:38 -0700 (PDT) Received: from canpemm500002.china.huawei.com (unknown [172.30.72.57]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4Qjp1K05GFz18Lq7; Sat, 17 Jun 2023 15:43:33 +0800 (CST) Received: from huawei.com (10.175.104.170) by canpemm500002.china.huawei.com (7.192.104.244) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.23; Sat, 17 Jun 2023 15:43:34 +0800 From: Miaohe Lin <linmiaohe@huawei.com> To: <mingo@redhat.com>, <peterz@infradead.org>, <juri.lelli@redhat.com>, <vincent.guittot@linaro.org> CC: <dietmar.eggemann@arm.com>, <rostedt@goodmis.org>, <bsegall@google.com>, <mgorman@suse.de>, <bristot@redhat.com>, <vschneid@redhat.com>, <linux-kernel@vger.kernel.org>, <linmiaohe@huawei.com> Subject: [PATCH] sched/deadline: Use helper function task_current() Date: Sat, 17 Jun 2023 15:43:05 +0800 Message-ID: <20230617074305.1916633-1-linmiaohe@huawei.com> X-Mailer: git-send-email 2.23.0 MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.175.104.170] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To canpemm500002.china.huawei.com (7.192.104.244) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1768937452572798641?= X-GMAIL-MSGID: =?utf-8?q?1768937452572798641?= |
Series |
sched/deadline: Use helper function task_current()
|
|
Commit Message
Miaohe Lin
June 17, 2023, 7:43 a.m. UTC
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(-)
Comments
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 >
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.
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);