Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp2410874ybt; Tue, 16 Jun 2020 05:33:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy1TVlcCf4wDYi5edQEdtR88tRKLG1R7k06sPfD2BCPdL6RRxZNhT7VmZs97j1jRJI3ezNV X-Received: by 2002:a50:a687:: with SMTP id e7mr2241172edc.62.1592310824464; Tue, 16 Jun 2020 05:33:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592310824; cv=none; d=google.com; s=arc-20160816; b=guAZPuyyfSW/vkhpCjcCT0TS6D647OABx/yugBORi3gjhhmHBHnTVV+6cKIBmXOYzA p58zA2HzLSWmOypBmsRkbMYYDTgP217ymCJVAZQj3s0QCBC0k+j/vAhOa3P0gt54HW3J iAM8EMAQR9EbWMEC/Lf4QoOoxaiyxetNDEdps030Zx64m/RSul6Aq1VPkyOEBtSYZmT/ jRkxMnUFG5kTiAK/qw17QhgipXBdbMCwAV/DMHlrE1vz1php+QpqCIPrVuvM40Bkzzpt I8xSR7K8QfAEwA+R9O0/mvb3t7MZQQI6gQQzVGnnh9Qq74gRR6Vq7X0f4lgEIpaAbift GpbA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=j/zHOZOAMFj76kOR7RONrkyP6O7E1SxDjrLhobFpBZA=; b=nsFWUYqjV9n7A8CNvjg1sjgmuI0smnuJ5iOmnc6peZuSkDnIYzgxGkrA5KCy5jFNsY XPdcj5UkLJIfkHV5fJP+38cg4FVKgc/IbohyVPUy7ifTXEAe7QXQDhdF71pRK+DUrbZj AXWJbc3wsscNwyUOBDF9b4Nu0gX0XOzNJoWqlPC0qFeLJmVZRqLKndM04ycKEeBbIZer kp+vsVNrUBNaO/mf4IrAvVaT/6COg/npYJMK4CLOrUbF/AVd7Md5T/oSftmlJel2vtGZ Xz4Y0AbFt6H89OLMvvj6JT+0FDhN/Ul5iLcgDp83kRQ4HAtJhoRzevsnanZ5Fag5VYbM 96uA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ez2ibCU8; 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=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a2si9682752edr.468.2020.06.16.05.33.21; Tue, 16 Jun 2020 05:33:44 -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=@linaro.org header.s=google header.b=ez2ibCU8; 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=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728271AbgFPMb3 (ORCPT + 99 others); Tue, 16 Jun 2020 08:31:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44184 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725901AbgFPMb2 (ORCPT ); Tue, 16 Jun 2020 08:31:28 -0400 Received: from mail-lj1-x242.google.com (mail-lj1-x242.google.com [IPv6:2a00:1450:4864:20::242]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EBD7EC08C5C2 for ; Tue, 16 Jun 2020 05:31:27 -0700 (PDT) Received: by mail-lj1-x242.google.com with SMTP id a9so23315623ljn.6 for ; Tue, 16 Jun 2020 05:31:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=j/zHOZOAMFj76kOR7RONrkyP6O7E1SxDjrLhobFpBZA=; b=ez2ibCU8hKHq5wNIe7yKJ1eUfVyW+TNRygAaoyx07hyGkHFoljN5Z+LgpkyDMM0zjQ TjOEyEgTBQQJIrP3rjhfMlZ9Oleo0SJEtlBDvl1N5OwS3zsYtXf48Nw7RhKciaDgZe+f p/wH5yZCHHToT8w3TTxq7HqSWhMkbmx8IkA6gBLmTrXUPqmBEhXxJUwI4FiqXTm1fXDU KIhqBgw5gAnEqLO4s9rg4dfSh1dc363FlSOoHnEJ/lTEVVonGk4LTv79Ct+YyBgT2iQT T3WuQXIAHJfHqcEplChJZruHrWcj0UGtC4HXbGMHmE12AUeZSNd19KLvLZybYCVamTi6 klVg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=j/zHOZOAMFj76kOR7RONrkyP6O7E1SxDjrLhobFpBZA=; b=MEGYEHKE3X1UMDjZ2G4J2KnU+ErSdk93JNkiKAZj3ybi37wuJFuBlRbzRgC7uJUrsd qwIjyu9UxD93UeiOez/asrDyXZVqISAQmYie9jFel/9QI7d957RfVJZxqcDOXZaxiF7X ZQaVeZcIJaei+X8YZw+wRwjmsXHgpgMFvrDEfU36KmjS6TDIp5NN5sdxdypcvVvLKhF3 aNvdzo6DunkNUcGOrVDNjon8Fe5mgY3IScJdjkwbK2ggwSNMvpBNITKeeHUjnowOEXvS wJ/BX18Twpcy9uWQRYUynurACjCuSl9J+qIzqc5keg2TM7asxvWAtpG8E/N5f44BQhMw uFIA== X-Gm-Message-State: AOAM530ZQwTlL/NMBL6XR+jTJu/veXN/NmZGmWcPo7TzG19OK3IimlYS CTg4yqJIVrbGgTZ3aMuIjBcyw6g9b2mj33xUsuBmsg== X-Received: by 2002:a2e:541e:: with SMTP id i30mr1233891ljb.156.1592310686347; Tue, 16 Jun 2020 05:31:26 -0700 (PDT) MIME-Version: 1.0 References: <6f2f195aea48bc50187dfb064aa530ba132be01b.1592230286.git.rocking@linux.alibaba.com> <701eef9a40de93dcf5fe7063fd607bca5db38e05.1592287263.git.rocking@linux.alibaba.com> In-Reply-To: <701eef9a40de93dcf5fe7063fd607bca5db38e05.1592287263.git.rocking@linux.alibaba.com> From: Vincent Guittot Date: Tue, 16 Jun 2020 14:31:15 +0200 Message-ID: Subject: Re: [PATCH v2] sched/fair: Optimize dequeue_task_fair() To: Peng Wang Cc: Ingo Molnar , Peter Zijlstra , Juri Lelli , Dietmar Eggemann , Steven Rostedt , Ben Segall , Mel Gorman , linux-kernel Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 16 Jun 2020 at 08:05, Peng Wang wrote: > > While looking at enqueue_task_fair and dequeue_task_fair, it occurred > to me that dequeue_task_fair can also be optimized as Vincent described > in commit 7d148be69e3a ("sched/fair: Optimize enqueue_task_fair()"). > > When encountering throttled cfs_rq, dequeue_throttle label can ensure > se not to be NULL, and rq->nr_running remains unchanged, so we can also > skip the early balance check. > > Signed-off-by: Peng Wang Reviewed-by: Vincent Guittot > --- > 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 cbcb2f7..05242b7 100644 > --- a/kernel/sched/fair.c > +++ b/kernel/sched/fair.c > @@ -5614,14 +5614,14 @@ 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); > > /* balance early to pull high priority tasks */ > if (unlikely(!was_sched_idle && sched_idle_rq(rq))) > rq->next_balance = jiffies; > > +dequeue_throttle: > util_est_dequeue(&rq->cfs, p, task_sleep); > hrtick_update(rq); > } > -- > 2.9.5 >