Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp840473rwr; Thu, 20 Apr 2023 07:04:00 -0700 (PDT) X-Google-Smtp-Source: AKy350aZ68XoIN3rHtNspP0FhtJEl4athSy2lVru7GLE3ERiaqpg8UCTHW2zhO96572BPXU2OQJT X-Received: by 2002:a05:7500:6319:b0:101:cbfe:819d with SMTP id ib25-20020a057500631900b00101cbfe819dmr49434gab.36.1681999440175; Thu, 20 Apr 2023 07:04:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681999440; cv=none; d=google.com; s=arc-20160816; b=OLWQ3xOD+hW4JY8cET2vd1VoW26pKnjzi1s4ZcNbvtvcKz9CkijEiYvrpmBrQIr+et OGA6TUFiZ/bgWt8dGSDWs2jm6RFg0D+1ozLA01eTm+OSA2NUQXFigXorOy0qsOc7wcSM xMqvBRXznStzE6bdayeCKej80xp4O6g4XKyp9XVsg1sXNS20aRrqwfMU3aaRpjBHKdQJ FNfX094JqILh5eHfy4pb0P78KZW5Yvi+dQR1iMP1AzhwD6K8VTzp3pknkU5QswsOjTCV 8wvyvSKnZsgXYaqJu867C5NsVnBFn/6xC1DgFS7kZrik1oTcWuoOg6FthKgp9RTRubEX oNiA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=ivWpDBmkPgmKgvHTR5P8q8ZV37qTEylKx14C8X7MiLg=; b=WXm0ul5MWk5B8r4+odA6pZWnpn2GNxO/SW5MbtE6q4pWUQK+ljx6C2Lzb/uusAtfKM PXJ9h2aXZ6dtQMdzsWhttB+ZMoBQDO+sMIRST+lLr5A+h0WPpBgGrXIeS3+dgRU7C9gf 7Q1NvKOZ+RulF42C6w/wnw6lokaAjxLVfOkKty67YNsK4QkHtCe1h6UmjhxoW/jw/CY5 m72ynAH/SHpNw8AYmrReI697clu8JHfQEhBy4Szx1IHyEBqwUqfaF7OylRNvQf9fiXx1 EsLhfFSyKeY6ksz/PtTWKmA8bnY30iFfEVWIHMNuqqQLGTrZ8/PizTKrQCL8iJNMuaqk jgaQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="o/iL+O86"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l8-20020a0561023f4800b0042ff7db3099si451405vsv.197.2023.04.20.07.03.27; Thu, 20 Apr 2023 07:04:00 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="o/iL+O86"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231547AbjDTNoU (ORCPT + 99 others); Thu, 20 Apr 2023 09:44:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48618 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231234AbjDTNoR (ORCPT ); Thu, 20 Apr 2023 09:44:17 -0400 Received: from mail-pl1-x636.google.com (mail-pl1-x636.google.com [IPv6:2607:f8b0:4864:20::636]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B0F595BA1 for ; Thu, 20 Apr 2023 06:44:16 -0700 (PDT) Received: by mail-pl1-x636.google.com with SMTP id d9443c01a7336-1a52667955dso12402505ad.1 for ; Thu, 20 Apr 2023 06:44:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1681998256; x=1684590256; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=ivWpDBmkPgmKgvHTR5P8q8ZV37qTEylKx14C8X7MiLg=; b=o/iL+O86hLQmiaxzhayW0o1B0qhhzJoAYkiTeWUJ3wo67n6B22VcyWE/tYhcrVzELk FKfPB1ddzAxKqHNCCrkV0IFpWfpyWofXQ0bvWE6nlrZ12Jp9oStfqVH1eKuFQ5tNd5cg jA0JhBm0hDeR/h1442XZ6WWqHorgVQZLQc891lDUflZBjMIlDw3Bn1jkQNbC+KiwSJMO 8sFSGzeN+Nyi7eYV4V8FREt/yBvLft7eOhrlG9jr7cCxjVyjd2UDHLBzuSjYtEl5zLW+ fpU1t0WkLYCWTg1LwOKORWsScIzV6+bKEmr/R5kAs/ibvkhDghuXqaFGaTInZaEkCVUD o8FA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681998256; x=1684590256; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ivWpDBmkPgmKgvHTR5P8q8ZV37qTEylKx14C8X7MiLg=; b=WHml6l07InLA6wRJ68HWnNxUE39J6bdLlWtJWAA4zyofJBjzFTjTFGL39Y5xMbcUhE TFv58lx3Lq2SrXPOvHZcJWTt2GKXECxNhH4MtT8k99wDXzOewl4gncLjSdpT6Bd2NONm ukejJUdnN7cwSdtsYnJOmt2SqhCiubYnGRUCBHh4SF5cpApuWJfSUHsPs2vfLxQSP7AO dK6NSUI/OnIjXlXnv/nENI074Osa4lTC7ZIx3d1f2XlQgCGXneioBn47VNcTHBXPcQuY ejYbJ+N0SKKbGPZfrB6zxUC85uyjMhtSz/tJQWyGT+Ne1ujE5ROwWPQRjEt5OIQQ2Nww 0XcQ== X-Gm-Message-State: AAQBX9fHZye5Gu4XkPgdz7dJ+4+yxc/TRSmgxIITUUGWPlb4EP2kSIeH FfdPK2hhX80W0M4XNdOBsFCG0T1VKdc3NIbKfhr2ug== X-Received: by 2002:a17:902:748c:b0:1a6:be37:22e1 with SMTP id h12-20020a170902748c00b001a6be3722e1mr1502935pll.15.1681998256168; Thu, 20 Apr 2023 06:44:16 -0700 (PDT) MIME-Version: 1.0 References: <20230416213406.2966521-1-davidai@google.com> In-Reply-To: From: Vincent Guittot Date: Thu, 20 Apr 2023 15:44:04 +0200 Message-ID: Subject: Re: [RFC PATCH v1] sched/uclamp: Introduce SCHED_FLAG_RESET_UCLAMP_ON_FORK flag To: Dietmar Eggemann Cc: David Dai , Ingo Molnar , Peter Zijlstra , Juri Lelli , Steven Rostedt , Ben Segall , Mel Gorman , Daniel Bristot de Oliveira , Valentin Schneider , Qais Yousef , Quentin Perret , Saravana Kannan , kernel-team@android.com, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 20 Apr 2023 at 11:37, Dietmar Eggemann w= rote: > > On 20/04/2023 03:11, David Dai wrote: > > On Tue, Apr 18, 2023 at 10:18=E2=80=AFPM Dietmar Eggemann > > wrote: > >> > > > > Hi Dietmar, thanks for your time, > > > >> On 16/04/2023 23:34, David Dai wrote: > >>> A userspace service may manage uclamp dynamically for individual task= s and > >>> a child task will unintentionally inherit a pesudo-random uclamp sett= ing. > >>> This could result in the child task being stuck with a static uclamp = value > >> > >> Could you explain this with a little bit more detail? Why isn't the > >> child task also managed by the userspace service? > > > > See Qais=E2=80=99 reply that contains more detail on how it=E2=80=99s b= eing used in > > Android. In general, if a dynamic userspace service will adjust uclamp > > on the fly for a given task, but has no knowledge or control over if > > or when a task forks. Depending on the timing of the fork, a child > > task may inherit a very large or a small uclamp_min or uclamp_max > > value. The intent of this patch is to provide more flexibility to the > > uclamp APIs such that child tasks do not get stuck with a poor uclamp > > value when spawned while retaining other sched attributes. When > > RESET_ON_FORK is set on the parent task, it will reset uclamp values > > for the child but also reset other sched attributes as well. > > OK, in this case, why not just change behavior and always reset the > uclamp values at fork? > > Do we anticipate a use-case in which uclamp inheritance would be required= ? > > Let's not over-complicate the sched_[sg]etattr() unnecessarily. I was about to ask the same question and I'm aligned with Dietmar. Use RESET_ON_FORK and set all attributes > > [...] > > >> Does this issue happen with uclamp mainline or only with Android's > >> slightly different version (max- vs. sum aggregation)? > > > > I=E2=80=99m using the version of uclamp that=E2=80=99s in Linus=E2=80= =99 tree. How uclamp is > > aggregated is unrelated to the problem I=E2=80=99m trying to solve with= this > > patch. Which is to extend the uclamp APIs to have finer control for > > the uclamp inheritance of child tasks. > > OK, I see.