Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp582828pxa; Tue, 11 Aug 2020 09:58:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxtarVOOokfb7SUnGphbWzD063cUcz4kv9y81WOUHmzuNIpB5cNryj51iq/6hpRXBjcc8hL X-Received: by 2002:aa7:de15:: with SMTP id h21mr27340153edv.23.1597165126406; Tue, 11 Aug 2020 09:58:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597165126; cv=none; d=google.com; s=arc-20160816; b=sFkGCdEeM73U0B8Bo6zEYkmh7ayzIhvFkTpXUV3bYl8s9E/L60Gv7rbHo5y1fuRisy eG3pQDqQ0Yce2k159om1Cbp025CsZpyuDHxfC1+kUn+Mn5JeQZNHlUTBw4pxko3mPW4y pa0IaXia5qMXqOogFVlx0kKf+WMiAzMYwf2rv4yoX7RhzmlEY2Bvs/b78zF3zDOGhcXn hvR2xrl4iCux+KTdH+CQaOS1DIr5a7yEBY9FPHU/fmAiVY1Jc3ucRA1jfyk+o4MePwYT P3TBZd2hgahGTHR0SLa58BqOfgnn32USHfL7sLnUYdnL4enDu/A3GmqvAADBJluDj2j8 qs6A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=0P3mxaF1cqOKWIVVIBJkjZ1W3mf0q20gtr7R5w44f3o=; b=0BQ65mJQxVvI6QxgdlL5S2dsJxO4LUjlqh1pQu6tLcsdAckI9kJGu5fFHajTncm6xn lJW0ujmD9VLbGiTvAiIM92Yy7AAOXZlTasTBYw+iE8UyhaAEOJo3D2l4cCBo4pfCyQSw uPVhRUfPM+d2EqwU2nFbByWNp2AJkU8A/IQILyIfbFkzKw7V3VYaDtqjQ++xeQGZ4VA3 bFAhYOWdcsqOzrH8JoP8v++YsbBCQnwRcWAbMqDXFb2LSjWqO5RD5x/zYwwmjSsNFe6t C8gOX2GuZoKLWEOXNxbrbTXCNbRJQLRSyQkifQbI4qx0ZjHOnETquSOG36jxbA82V39U yomQ== 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 dg15si14204624edb.524.2020.08.11.09.58.23; Tue, 11 Aug 2020 09:58:46 -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; 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 S1729157AbgHKQzO (ORCPT + 99 others); Tue, 11 Aug 2020 12:55:14 -0400 Received: from foss.arm.com ([217.140.110.172]:38962 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728962AbgHKQzO (ORCPT ); Tue, 11 Aug 2020 12:55:14 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id C9D5E31B; Tue, 11 Aug 2020 09:55:13 -0700 (PDT) Received: from [192.168.178.2] (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id BCB0E3F22E; Tue, 11 Aug 2020 09:55:07 -0700 (PDT) Subject: Re: [PATCH] sched/fair: Optimize dequeue_task_fair() To: Jiang Biao , mingo@redhat.com, peterz@infradead.org, juri.lelli@redhat.com, vincent.guittot@linaro.org Cc: rostedt@goodmis.org, bsegall@google.com, mgorman@suse.de, linux-kernel@vger.kernel.org, Jiang Biao References: <20200811084310.27130-1-benbjiang@tencent.com> From: Dietmar Eggemann Message-ID: <9a2ddb2d-4c9a-a85d-cba2-0956b6d953c0@arm.com> Date: Tue, 11 Aug 2020 18:55:05 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <20200811084310.27130-1-benbjiang@tencent.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 11/08/2020 10:43, Jiang Biao wrote: > Similar optimization as what has been done in commit, > 7d148be69e3a(sched/fair: Optimize enqueue_task_fair()) > > dequeue_task_fair jumps to dequeue_throttle label when cfs_rq_of(se) is > throttled which means that se can't be NULL. We can move the label after > the if (!se) statement and remove the if(!se) statment as se is always > NULL when reaching this point. > > Besides, trying to keep the same pattern with enqueue_task_fair can make > it more readable. > > Signed-off-by: Jiang Biao > --- > kernel/sched/fair.c | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > > diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c > index 04fa8dbcfa4d..cbbeafdfa8b7 100644 > --- a/kernel/sched/fair.c > +++ b/kernel/sched/fair.c > @@ -5618,10 +5618,10 @@ static void dequeue_task_fair(struct rq *rq, struct task_struct *p, int flags) > > } > > -dequeue_throttle: > - if (!se) > - sub_nr_running(rq, 1); > + /* At this point se is NULL and we are at root level*/ > + sub_nr_running(rq, 1); > > +dequeue_throttle: > /* balance early to pull high priority tasks */ > if (unlikely(!was_sched_idle && sched_idle_rq(rq))) > rq->next_balance = jiffies; There is already a similar patch in master. 423d02e1463b - sched/fair: Optimize dequeue_task_fair() (2020-06-25 Peng Wang)