Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp7107379imm; Tue, 24 Jul 2018 08:30:11 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfd1CRDqPZFNbv2to+EMeVu0Fc5fqlyC/CgAzjKn2PSK7YaLy62HHqZCYoF7W74m+LJmyzL X-Received: by 2002:a17:902:24c7:: with SMTP id l7-v6mr17536265plg.170.1532446211429; Tue, 24 Jul 2018 08:30:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532446211; cv=none; d=google.com; s=arc-20160816; b=EwrBvCaS70MdpPN1FDKz0ftdEpUyN5X0dmJmb2fj4MsnzheRkVJkAswsqptjpNr8YE rBIw99a6avG3mwtAdqRtfm/NVeRvNisIx4PAmu/HalNdfg89siWezRrc47EvRxe/FRwh URUgzlpnOzA3KwmB4udkQwOKZElq3W4WVJyenLRK8r2oivTJ2OHdtxDitQO3l2ebM8NQ 2SgG1W5mfxub2RYr3UzeiyAdSYJ7EjmNDahqvnBl/F3rGp84+5DYugNeUoa+tm3MdTSm 4hcMUzdB20RM5e1g+EbJrx2MjH4vjhba3wujGPys3/CUoYTaU59nXrQtBaBQa++52hWu yYOQ== 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 :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=lccaIhC7T9n6pgdGVt3ciPqkrhXDs5G/Xx0YB4NVu24=; b=Ea6ZWscVyo68Kdj/dKVBQKcXMpaW3aTq21xSiQTa+a137EIdsE2HvE5XyckE4cMq8G pKOLGCt6MHdO35UQz2jWZgAcu9uR3KHJ0ba+Ti0RT6wtXefP58WiB099wjdJw6/etAH+ UlVUBj9ma7eFPX0DylnCzwOl4k3g0Ub+5GULjCR5GqDskZXppvOTOYNrTANJt7tSmcuc G/UZzggpv/zoKaWriVdGTT04DY/XKlZs4yci/DtNn8KBQtixqja6kT09dieIr6k3kOk8 I/c42gH57TUwVqypVx2dqnKb61ec+QQzv0lTXW/VP3d6OJHXcRrSZBHr2IHBK6NjJUjF ZL0w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=n3B8OHJl; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 65-v6si10766600pgi.195.2018.07.24.08.29.56; Tue, 24 Jul 2018 08:30:11 -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=@google.com header.s=20161025 header.b=n3B8OHJl; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728148AbeGXQfp (ORCPT + 99 others); Tue, 24 Jul 2018 12:35:45 -0400 Received: from mail-it0-f66.google.com ([209.85.214.66]:53249 "EHLO mail-it0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726857AbeGXQfn (ORCPT ); Tue, 24 Jul 2018 12:35:43 -0400 Received: by mail-it0-f66.google.com with SMTP id 72-v6so4280416itw.3 for ; Tue, 24 Jul 2018 08:28:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=lccaIhC7T9n6pgdGVt3ciPqkrhXDs5G/Xx0YB4NVu24=; b=n3B8OHJlSdXmtoNME/eAUyD/8Y5SB8IvpMwlg+BN0zIw8fWch5k27xThejKs6Mdt8+ s0lot3ZYtZFd1wSswn3YCpuyALsv9RDB8CwVAzQhTs9FyamWf5ukI2qdHuCL1O7m6q34 i8WLB6KkZC0SQzPkIYquYE8WZqKfwNzN8ckgumikGwsY33PDoSwu3qFaTG32W1BljvIC rvRXyZqoHun8PBGrKkEv65cFCa+KRPQQ09HoG6lwcSvOvPerqvPaQzJSk0P7dcZ19OVw iX3nZUKEdn/nrSi95aZKCU/lWSjaDvkahby7oACXgLnYyHEzJSBfxt+Q6DlQtT9gyuY6 Ud/A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=lccaIhC7T9n6pgdGVt3ciPqkrhXDs5G/Xx0YB4NVu24=; b=sH1vyFQnlVyzQoRPKhEbRLxgVJNntr0lnLtLrH1Kb0AIHrGOoli6lbGeeyGfyBb5Hp YdRfmkhpYuVsMjknjG14ZgVRSdmbShs2TDJm3uW3TKiQwIri9HPKulQ+VQ6Say1GvY4V /zHDB7KrDU9IeY5iqYHZ6AKnnrozg1u7yzrm5GHmQuAuJclUIwz3ANoKzOBqj+eU2RTy UBcWkYPv3/V1D4ZHwgMyaLxIu4t0MY57xIAy4Eh8MUZdC2bjYTE3IqccD/Hwjm0AALwe ydY7yC2k0RPqhSLZmqK2P+jDuroXU0RPRuwO5Z5JQZtGkhJPPasHpJdVxsVSuKOM9vRc rVdA== X-Gm-Message-State: AOUpUlHGGHVnWY84KTiGLe+faEgvuEhjRkzLtibCszK0q1+WNe2mDe+5 RpSRVWsY+Gpd3a24iZqhxBpXoiZYmi42xFshSLvOAMQQPSM= X-Received: by 2002:a24:ecc6:: with SMTP id g189-v6mr2956027ith.21.1532446122291; Tue, 24 Jul 2018 08:28:42 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:ac0:e445:0:0:0:0:0 with HTTP; Tue, 24 Jul 2018 08:28:41 -0700 (PDT) In-Reply-To: <20180724095550.GA3162@e110439-lin> References: <20180716082906.6061-1-patrick.bellasi@arm.com> <20180716082906.6061-11-patrick.bellasi@arm.com> <20180723154025.GF2683@e110439-lin> <20180724095550.GA3162@e110439-lin> From: Suren Baghdasaryan Date: Tue, 24 Jul 2018 08:28:41 -0700 Message-ID: Subject: Re: [PATCH v2 10/12] sched/core: uclamp: use TG's clamps to restrict Task's clamps To: Patrick Bellasi Cc: linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, Ingo Molnar , Peter Zijlstra , Tejun Heo , "Rafael J . Wysocki" , Viresh Kumar , Vincent Guittot , Paul Turner , Dietmar Eggemann , Morten Rasmussen , Juri Lelli , Todd Kjos , Joel Fernandes , Steve Muckle 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 Hi Patrick. Thanks for the explanation and links. No more questions from me on this one :) On Tue, Jul 24, 2018 at 2:56 AM, Patrick Bellasi wrote: > On 23-Jul 10:11, Suren Baghdasaryan wrote: >> On Mon, Jul 23, 2018 at 8:40 AM, Patrick Bellasi >> wrote: >> > On 21-Jul 20:05, Suren Baghdasaryan wrote: >> >> On Mon, Jul 16, 2018 at 1:29 AM, Patrick Bellasi > > [...] > >> >> So to satisfy both TG and syscall requirements I think you would >> >> need to choose the largest value for UCLAMP_MIN and the smallest one >> >> for UCLAMP_MAX, meaning the most boosted and most clamped range. >> >> Current implementation choses the least boosted value, so >> >> effectively one of the UCLAMP_MIN requirements (either from TG or >> >> from syscall) are being ignored... Could you please clarify why >> >> this choice is made? >> > >> > The TG values are always used to specify a _restriction_ on >> > task-specific values. >> > >> > Thus, if you look or example at the CPU mask for a task, you can have >> > a task with affinity to CPUs 0-1, currently running on a cgroup with >> > cpuset.cpus=0... then the task can run only on CPU 0 (althought its >> > affinity includes CPU1 too). >> > >> > Same we do here: if a task has util_min=10, but it's running in a >> > cgroup with cpu.util_min=0, then it will not be boosted. >> > >> > IOW, this allows to implement a "nice" policy at task level, where a >> > task (via syscall) can decide to be less boosted with respect to its >> > group but never more boosted. The same task can also decide to be more >> > clamped, but not less clamped then its current group. >> > >> >> The fact that boost means "at least this much" to me seems like we can >> safely choose higher CPU bandwidth (as long as it's lower than >> UCLAMP_MAX) > > I understand your view point, which actually is matching my first > implementation for util_min aggregation: > > https://lore.kernel.org/lkml/20180409165615.2326-5-patrick.bellasi@arm.com/ > > >> but from your description sounds like TG's UCLAMP_MIN means "at most >> this much boost" and it's not safe to use CPU bandwidth higher than >> TG's UCLAMP_MIN. > > Indeed, after this discussion with Tejun: > > https://lore.kernel.org/lkml/20180409222417.GK3126663@devbig577.frc2.facebook.com/ > > I've convinced myself that for the cgroup interface we have to got for > a "restrictive" interface where a parent value must set the upper > bound for all its descendants values. AFAIU, that's one of the basic > principles of the "delegation model" implemented by cgroups and the > common behavior implemented by all controllers. > >> So instead of specifying min CPU bandwidth for a task it specifies >> the max allowed boost. Seems like a discrepancy to me but maybe >> there are compelling usecases when this behavior is necessary? > > I don't think it's strictly related to use-cases, you can always > describe a give use-case in one model or the other. It all depends on > how you configure your hierarchy and where you place your tasks. > > For our Android use cases, we are still happy to say that all tasks of > a CGroup can be boosted up to a certain value and then we can either: > - don't configure tasks: and thus get the CG defined boost > - configure a task: and explicitly give back what we don't need > > This model works quite well with containers, where the parent want to > precisely control how much resources are (eventually) usable by a > given container. > >> In that case would be good to spell them out to explain why this >> choice is made. > > Yes, well... if I understand it correctly is really just the > recommended way cgroups must be used to re-partition resources. > > I'll try to better explain this behavior in the changelog for this > patch. > > [...] > > Best, > Patrick > > -- > #include > > Patrick Bellasi