Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp3044992imm; Mon, 13 Aug 2018 05:10:41 -0700 (PDT) X-Google-Smtp-Source: AA+uWPz9S5X/H+MqNN8BQQwp9wb1wdYaK0nutaKLl2KHQXwp6fjqdFU1AvKjRrX8/rWYRIuFRhmf X-Received: by 2002:a63:f002:: with SMTP id k2-v6mr16520475pgh.8.1534162241165; Mon, 13 Aug 2018 05:10:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1534162241; cv=none; d=google.com; s=arc-20160816; b=OXZOt0m0qCHbeuAjdWDw+BsoI8KraDxJNlXn3R09cnIS0IeoP9NflW0DhshVioDZ58 3Rd782e0E31jWcCou0YM0boKNNaxD8U7qVfwfxUIdemuVj6dINhBTJQ21ETHt+PvIuEg DhnvoLvd95ZPsGhNRwk+9i7leVN2r+9p8HESjkS6VNeHUiOUwr+QGFq5bqQYorMvSavX zrt+EJ962KL+ggpFNdNLEOLW5ZQDrpmxmi3tuAvIDvaMFSUIwfar74ELN+U3eJ8tClkv 1L9mLWyVuQKswgcnjbNbuCLxFZ/OuGDo+NWUWwkVQtAfU5K1wSiXOk9naD4NLvKAnqBl Gsdw== 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 :arc-authentication-results; bh=vExfePqjGig734gpYzOV0lcWRT0ynTcCTK02eQujStY=; b=NNYrO5PcDO6BJBB851c9pl3Hm7FU93qDVgZEOXLaIpf0g69CGgugWVkspkGxrRy3UH llVPiITMC3j/VSjV7wgWOsLSkHWEWzWe3DdxLy2oVxCd4/NW5plqj/x0rrZBppkyB8nD AvBFVPh7prFRUIywq8lAKnB5MI5fIEuliRBxElx44az1r+47iwQS6c7Gx/+8AT70Kv0I y0WpDZ0FBvCb485jyv2bc4imY/5W/99ugJ02EiwtMbntlruveVUMfVKEtcqJYj4MfERh XzRboz8aERK/V0HRfyNCaKyrfwBbY8Xw/6FBBpJByhtxTjIJPCEA/Nhja4gYhqMFPe8i oqVQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=bCntU7Qt; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b2-v6si13694623plx.121.2018.08.13.05.10.26; Mon, 13 Aug 2018 05:10:41 -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; dkim=pass header.i=@linaro.org header.s=google header.b=bCntU7Qt; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729667AbeHMOvS (ORCPT + 99 others); Mon, 13 Aug 2018 10:51:18 -0400 Received: from mail-it0-f52.google.com ([209.85.214.52]:39595 "EHLO mail-it0-f52.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729084AbeHMOvS (ORCPT ); Mon, 13 Aug 2018 10:51:18 -0400 Received: by mail-it0-f52.google.com with SMTP id g141-v6so13595393ita.4 for ; Mon, 13 Aug 2018 05:09:17 -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=vExfePqjGig734gpYzOV0lcWRT0ynTcCTK02eQujStY=; b=bCntU7QtgScK8xtjPhUBgfe6tzmCiWkf7mO1TNDVbarQ8PVHA2holbgLEgMRlhj7Bn vwlwkYfUKmBdM1zZvoaZRBtgcJjS6svPKxIGhZkxsQ1sRPlBrwx4jJ/f99vnmm2JPEkn zypc4Xqpgq297NPel0XYqEhwddTtz+WyxK754= 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=vExfePqjGig734gpYzOV0lcWRT0ynTcCTK02eQujStY=; b=qsn9WCm+bDL+YmByfcaE9d19KOSSyrNPhGYCq81ZcmBukMp/AyJfsMfP1WvfhlKl5M fV0HgMOfBM5BbIPBZUtBu3M7kyFsmdEXqGhxJhdeIyFeMzfZ0kXEOLdezqJftxi8/Oes 0vbrVdHPtnpxHvSVDYHwYZ0S0MSoLhoFb600+ivbHdY7e/9ECYvyvEsDOYHh2uZNHl+5 fC4+HHPVbIIoNKJb+2lw0c7mhkL1W4WGjzt9wouD3zDa7+fYWx6cpyP/VnbW/J6z2ROd xD2CFFST0M876Ts93d7ksmZPE8oJnFMZ68QIZsAiRcHnhZfkUX/PR15ToJtIvK2tyzMF W/DQ== X-Gm-Message-State: AOUpUlHg/go/NIrrgrQAGjNHf66N0l/bQzIUO+psaUCx35LloOjrsOnK UeISvCmERyFwWE/osSjaxAh2wMRR9sN/CiKbm2aHMQ== X-Received: by 2002:a24:55cd:: with SMTP id e196-v6mr10141705itb.8.1534162157090; Mon, 13 Aug 2018 05:09:17 -0700 (PDT) MIME-Version: 1.0 References: <20180806163946.28380-1-patrick.bellasi@arm.com> <20180806163946.28380-7-patrick.bellasi@arm.com> <20180807132630.GB3062@localhost.localdomain> <20180809153423.nsoepprhut3dv4u2@darkstar> <20180813101221.GA2605@e110439-lin> In-Reply-To: From: Vincent Guittot Date: Mon, 13 Aug 2018 14:09:06 +0200 Message-ID: Subject: Re: [PATCH v3 06/14] sched/cpufreq: uclamp: add utilization clamping for RT tasks To: Patrick Bellasi Cc: Juri Lelli , linux-kernel , "open list:THERMAL" , Ingo Molnar , Peter Zijlstra , Tejun Heo , "Rafael J. Wysocki" , viresh kumar , Paul Turner , Dietmar Eggemann , Morten Rasmussen , Todd Kjos , Joel Fernandes , "Cc: Steve Muckle" , Suren Baghdasaryan 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 Mon, 13 Aug 2018 at 14:07, Vincent Guittot wrote: > > On Mon, 13 Aug 2018 at 12:12, Patrick Bellasi wrote: > > > > Hi Vincent! > > > > On 09-Aug 18:03, Vincent Guittot wrote: > > > > On 07-Aug 15:26, Juri Lelli wrote: > > > > [...] > > > > > > > > + util_cfs = cpu_util_cfs(rq); > > > > > > + util_rt = cpu_util_rt(rq); > > > > > > + if (sched_feat(UCLAMP_SCHED_CLASS)) { > > > > > > + util = 0; > > > > > > + if (util_cfs) > > > > > > + util += uclamp_util(cpu_of(rq), util_cfs); > > > > > > + if (util_rt) > > > > > > + util += uclamp_util(cpu_of(rq), util_rt); > > > > > > + } else { > > > > > > + util = cpu_util_cfs(rq); > > > > > > + util += cpu_util_rt(rq); > > > > > > + util = uclamp_util(cpu_of(rq), util); > > > > > > + } > > > > > > > > Regarding the two policies, do you have any comment? > > > > > > Does the policy for (sched_feat(UCLAMP_SCHED_CLASS)== true) really > > > make sense as it is ? > > > I mean, uclamp_util doesn't make any difference between rt and cfs > > > tasks when clamping the utilization so why should be add twice the > > > returned value ? > > > IMHO, this policy would make sense if there were something like > > > uclamp_util_rt() and a uclamp_util_cfs() > > > > The idea for the UCLAMP_SCHED_CLASS policy is to improve fairness on > > low-priority classese, especially when we have high RT utilization. > > > > Let say we have: > > > > util_rt = 40%, util_min=0% > > util_cfs = 10%, util_min=50% > > > > the two policies will select: > > > > UCLAMP_SCHED_CLASS: util = uclamp(40) + uclamp(10) = 50 + 50 = 100% > > !UCLAMP_SCHED_CLASS: util = uclamp(40 + 10) = uclmp(50) = 50% > > > > Which means that, despite the CPU's util_min will be set to 50% when > > CFS is running, these tasks will have almost no boost at all, since > > their bandwidth margin is eclipsed by RT tasks. > > Hmm ... At the opposite, even if there is no running rt task but only > some remaining blocked rt utilization, > even if util_rt = 10%, util_min=0% > and util_cfs = 40%, util_min=50% > the UCLAMP_SCHED_CLASS: util = uclamp(10) + uclamp(40) = 50 + 50 = 100% > > So cfs task can get double boosted by a small rt task. > > Furthermore, if there is no rt task but 2 cfs tasks of 40% and 10% > the UCLAMP_SCHED_CLASS: util = uclamp(0) + uclamp(40) = 50 = 50% s/uclamp(40)/uclamp(50)/ > > So in this case cfs tasks don't get more boost and have to share the > bandwidth and you don't ensure 50% for each unlike what you try to do > for rt. > You create a difference in the behavior depending of the class of the > others co-schedule tasks which is not sane IMHO > > > > > > > > We had an internal discussion and we found pro/cons for both... but > > > > The UCLAMP_SCHED_CLASS policy is thus less energy efficiency but it > > should grant a better "isolation" in terms of what is the expected > > speed-up a task will get at run-time, independently from higher > > priority classes. > > > > Does that make sense? > > > > > > I'm not sure keeping the sched_feat is a good solution on the long > > > > run, i.e. mainline merge ;) > > > > This problem still stands... > > > > -- > > #include > > > > Patrick Bellasi