Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp1288214pxf; Fri, 26 Mar 2021 05:13:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzsW3sIE1a4fqAaSO1ZS+ftKwKtLA/46GQg9UTBh230DG+TuUBfPw5Qz/TfpR45N1HX7FlN X-Received: by 2002:aa7:dc15:: with SMTP id b21mr14608755edu.350.1616760783976; Fri, 26 Mar 2021 05:13:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616760783; cv=none; d=google.com; s=arc-20160816; b=Fq2ACejfKsCWZOg09lwpLuDh0ZQ08sCVsxRAHMUAxs3/J1VfAcRegQLUzzbcFjjiS6 +7vxqRzJEJC009GpLqYJCZEVZLDGWvjMD0Qzpn4GPezcWaVyh6FF0LYyPagkeLyJO8fe wRGA28LS38Nld9ZII7HfM+VUlV1Y/j82GvXt+mrwY0G5ptaOZAD+C6rJpsnREx5ZgVM5 DOCbTcul0ELU9PyFQL15jgpQMdKmLdoR/fKlSd9o55WEYT0jP68KoiggtXwHf0AJxuoB hC5GvrWDAyr2Dn3AtrTaTioIQESNOM2yQQXPzcV9vuc6ARSG4enKOmYjqFba/kzels/I 7Dsw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=RK77SB2tBM3ieKstTnbUXg1elQXvbgjDLlOsumK9eLE=; b=ovm/QijzvZZXSd++drlkDXtCzOJ8s982v4C7DIwEbHIwFoBWo/t6zOJjNpA0eE20AA SKqf/y+znleHKLPuotduTUO7WXXk8rEl/DQs/Bt7MYDKg6VqkidGwinvVPsiZI0jUzR6 eJoX8776IZbE0NZ7p9qtWjVqhNPo53rAVe9d1hsxZkSH5H2gzRwkqkys4EHxe8YEhFsd DfI/kvZAFUu23LizKgonIe6lDLBhvPDmceOY1j/JP2KR+jI6gcFhM70Mi/p95SQGiDM/ YQOirVGCfzhX3+YnEdXlL+RzrPhLmH86oFu4wCe+vB64sMfjq1h99MrDYFDWa7i6VbgM EGUg== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ml22si6830764ejb.629.2021.03.26.05.12.41; Fri, 26 Mar 2021 05:13:03 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229945AbhCZMJ2 (ORCPT + 99 others); Fri, 26 Mar 2021 08:09:28 -0400 Received: from foss.arm.com ([217.140.110.172]:58124 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229935AbhCZMI7 (ORCPT ); Fri, 26 Mar 2021 08:08:59 -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 0A88F1476; Fri, 26 Mar 2021 05:08:59 -0700 (PDT) Received: from [192.168.178.6] (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 130723F7D7; Fri, 26 Mar 2021 05:08:56 -0700 (PDT) Subject: Re: [PATCH 9/9] sched,fair: Alternative sched_slice() To: Peter Zijlstra , mingo@kernel.org, mgorman@suse.de, juri.lelli@redhat.com, vincent.guittot@linaro.org, rostedt@goodmis.org, bsegall@google.com, bristot@redhat.com, joshdon@google.com, valentin.schneider@arm.com Cc: linux-kernel@vger.kernel.org, greg@kroah.com References: <20210326103352.603456266@infradead.org> <20210326103935.444833549@infradead.org> From: Dietmar Eggemann Message-ID: <6c36c39a-d2da-a110-3f83-fda70a73a1fd@arm.com> Date: Fri, 26 Mar 2021 13:08:44 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.7.1 MIME-Version: 1.0 In-Reply-To: <20210326103935.444833549@infradead.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 26/03/2021 11:34, Peter Zijlstra wrote: > The current sched_slice() seems to have issues; there's two possible > things that could be improved: > > - the 'nr_running' used for __sched_period() is daft when cgroups are > considered. Using the RQ wide h_nr_running seems like a much more > consistent number. > > - (esp) cgroups can slice it real fine, which makes for easy > over-scheduling, ensure min_gran is what the name says. So ALT_PERIOD considers all runnable CFS tasks now and BASE_SLICE guarantees min_gran as a floor for cgroup (hierarchies) with small weight value(s)? > > Signed-off-by: Peter Zijlstra (Intel) > --- > kernel/sched/fair.c | 15 ++++++++++++++- > kernel/sched/features.h | 3 +++ > 2 files changed, 17 insertions(+), 1 deletion(-) > > --- a/kernel/sched/fair.c > +++ b/kernel/sched/fair.c > @@ -680,7 +680,16 @@ static u64 __sched_period(unsigned long > */ > static u64 sched_slice(struct cfs_rq *cfs_rq, struct sched_entity *se) > { > - u64 slice = __sched_period(cfs_rq->nr_running + !se->on_rq); > + unsigned int nr_running = cfs_rq->nr_running; > + u64 slice; > + > + if (sched_feat(ALT_PERIOD)) > + nr_running = rq_of(cfs_rq)->cfs.h_nr_running; > + > + slice = __sched_period(nr_running + !se->on_rq); > + > + if (sched_feat(BASE_SLICE)) > + slice -= sysctl_sched_min_granularity; > > for_each_sched_entity(se) { > struct load_weight *load; > @@ -697,6 +706,10 @@ static u64 sched_slice(struct cfs_rq *cf > } > slice = __calc_delta(slice, se->load.weight, load); > } > + > + if (sched_feat(BASE_SLICE)) > + slice += sysctl_sched_min_granularity; > + > return slice; > } > > --- a/kernel/sched/features.h > +++ b/kernel/sched/features.h > @@ -90,3 +90,6 @@ SCHED_FEAT(WA_BIAS, true) > */ > SCHED_FEAT(UTIL_EST, true) > SCHED_FEAT(UTIL_EST_FASTUP, true) > + > +SCHED_FEAT(ALT_PERIOD, true) > +SCHED_FEAT(BASE_SLICE, true) > >