Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp968928ybe; Thu, 5 Sep 2019 08:28:51 -0700 (PDT) X-Google-Smtp-Source: APXvYqygXYje5JQS8tmS8IOOUJNgQO53k8EpzjFUt34xBaSadxO/b6m/+Cmt3i+Ex6uTAAAfXUzi X-Received: by 2002:aa7:908b:: with SMTP id i11mr4570865pfa.199.1567697330973; Thu, 05 Sep 2019 08:28:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567697330; cv=none; d=google.com; s=arc-20160816; b=CBMWTqPBwoz6w5/VljArE8Xk3qk4yV9o+5yaWpd9gsZBLMZSTUZJyBrV4SD0YQW05O Aw0ck3yvj7brNa5FL62C2w8Scvex9PTTLo518VbQ2ChpojcKEvOdCSjccd0q8vzQEsdr FAC7pD+Lr2CUEHquUzxJ/FdDihNabDkgbBgXfZScqBmuMZSOmmhG06Ckk2ks5ePcwJF+ xj2qi4xI7ybNnkS4LePpDkceBTHzVoDC/TVcnekcAzvwn2c6cUHF4I9n4f+5fXjAIpUT FLoJAlFRd8cxfgP5mqoxwPVakDtWWM94nqmtgvFTsx9qbECvPndleSqgenWbOpMx+qRd l97g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:in-reply-to :subject:cc:to:from:user-agent:references; bh=WLLl7OgtIzUB7LrXVW0pMfPymvKRjRWqJNROtI1fd88=; b=wVgZ65KJgqOBAvBK6wsAXqaIH6gppaFWSjThFfHrGuZv9F7FmdYkIYU9cOShuzMauH eJGR4aX7XvhzdZ4dmZfXV21JxQmHThggrXSnnI8dB4CCAUYUEPB5q1j3GxmfN5D1/nAy cKYAwaQDo6GuRvE5WiXaiazgRcfkCPdDLnuY77rCBedXxgDBy9HN4yOmFQ9AFQUsuGbX PN8TpkISOattJUsmoq1m2IwtfFjXmzfEX87grjd+hHJJ/iD6yNWsW4QyjNYKUyccLKDd 0Gh85GNABT9InWd4E5+XT0SZYv38w1KhoBDfipIQ2XVtnIzNWpTuy04lQ1OPUPwmN23e hVtQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y10si2283776plk.291.2019.09.05.08.28.33; Thu, 05 Sep 2019 08:28:50 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388486AbfIELa5 (ORCPT + 99 others); Thu, 5 Sep 2019 07:30:57 -0400 Received: from foss.arm.com ([217.140.110.172]:42704 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725921AbfIELa5 (ORCPT ); Thu, 5 Sep 2019 07:30:57 -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 83FFF28; Thu, 5 Sep 2019 04:30:56 -0700 (PDT) Received: from e110439-lin (e110439-lin.cambridge.arm.com [10.1.194.43]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id B3B0E3F718; Thu, 5 Sep 2019 04:30:54 -0700 (PDT) References: <20190830174944.21741-1-subhra.mazumdar@oracle.com> <20190830174944.21741-2-subhra.mazumdar@oracle.com> <20190905083127.GA2332@hirez.programming.kicks-ass.net> <87r24v2i14.fsf@arm.com> <20190905104616.GD2332@hirez.programming.kicks-ass.net> <20190905111346.2w6kuqrdvaqvgilu@e107158-lin.cambridge.arm.com> User-agent: mu4e 1.3.3; emacs 26.2 From: Patrick Bellasi To: Qais Yousef Cc: Peter Zijlstra , Subhra Mazumdar , linux-kernel@vger.kernel.org, mingo@redhat.com, tglx@linutronix.de, steven.sistare@oracle.com, dhaval.giani@oracle.com, daniel.lezcano@linaro.org, vincent.guittot@linaro.org, viresh.kumar@linaro.org, tim.c.chen@linux.intel.com, mgorman@techsingularity.net, parth@linux.ibm.com Subject: Re: [RFC PATCH 1/9] sched,cgroup: Add interface for latency-nice In-reply-to: <20190905111346.2w6kuqrdvaqvgilu@e107158-lin.cambridge.arm.com> Date: Thu, 05 Sep 2019 12:30:52 +0100 Message-ID: <87h85r2d5f.fsf@arm.com> MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Sep 05, 2019 at 12:13:47 +0100, Qais Yousef wrote... > On 09/05/19 12:46, Peter Zijlstra wrote: >> On Thu, Sep 05, 2019 at 10:45:27AM +0100, Patrick Bellasi wrote: >> >> > > From just reading the above, I would expect it to have the range >> > > [-20,19] just like normal nice. Apparently this is not so. >> > >> > Regarding the range for the latency-nice values, I guess we have two >> > options: >> > >> > - [-20..19], which makes it similar to priorities >> > downside: we quite likely end up with a kernel space representation >> > which does not match the user-space one, e.g. look at >> > task_struct::prio. >> > >> > - [0..1024], which makes it more similar to a "percentage" >> > >> > Being latency-nice a new concept, we are not constrained by POSIX and >> > IMHO the [0..1024] scale is a better fit. >> > >> > That will translate into: >> > >> > latency-nice=0 : default (current mainline) behaviour, all "biasing" >> > policies are disabled and we wakeup up as fast as possible >> > >> > latency-nice=1024 : maximum niceness, where for example we can imaging >> > to turn switch a CFS task to be SCHED_IDLE? >> >> There's a few things wrong there; I really feel that if we call it nice, >> it should be like nice. Otherwise we should call it latency-bias and not >> have the association with nice to confuse people. >> >> Secondly; the default should be in the middle of the range. Naturally >> this would be a signed range like nice [-(x+1),x] for some x. but if you >> want [0,1024], then the default really should be 512, but personally I >> like 0 better as a default, in which case we need negative numbers. >> >> This is important because we want to be able to bias towards less >> importance to (tail) latency as well as more importantance to (tail) >> latency. >> >> Specifically, Oracle wants to sacrifice (some) latency for throughput. >> Facebook OTOH seems to want to sacrifice (some) throughput for latency. > > Another use case I'm considering is using latency-nice to prefer an idle CPU if > latency-nice is set otherwise go for the most energy efficient CPU. > > Ie: sacrifice (some) energy for latency. > > The way I see interpreting latency-nice here as a binary switch. But maybe we > can use the range to select what (some) energy to sacrifice mean here. Hmmm. I see this concept possibly evolving into something more then just a binary switch. Not yet convinced if it make sense and/or it's possible but, in principle, I was thinking about these possible usages for CFS tasks: - dynamically tune the policy of a task among SCHED_{OTHER,BATCH,IDLE} depending on crossing certain pre-configured threshold of latency niceness. - dynamically bias the vruntime updates we do in place_entity() depending on the actual latency niceness of a task. - bias the decisions we take in check_preempt_tick() still depending on a relative comparison of the current and wakeup task latency niceness values. -- #include Patrick Bellasi