Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp516521rwr; Thu, 20 Apr 2023 02:39:56 -0700 (PDT) X-Google-Smtp-Source: AKy350bHVw5lkhB1Fr25nHmKAPP0mxOp4U4aoSDm5QI8Zrq9Mycogvm6d6j8I3fSIF2IoVVbzBAo X-Received: by 2002:a17:90a:c708:b0:246:aeee:e61c with SMTP id o8-20020a17090ac70800b00246aeeee61cmr967893pjt.11.1681983596587; Thu, 20 Apr 2023 02:39:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681983596; cv=none; d=google.com; s=arc-20160816; b=C0sIY909gvPp11MrxHZ+rm1EmmLYEVdIgyclY5F5CNXi85+4TNAWiS7XGbj75mlz4C jb5D7mCsUPcgneaFgf7LZSh+K3K4lYBrWEeNvcJhHbDp9czuUTOrNtJsaWyHrWPLO5Zj rnp4op17S91AQRKJOnU8F8qxZk2RrsufkZnzDMkpGS8PzC5VebsDEGSrJcT4B4ulLyz6 59bLmEJKKZHTVZKBAQEsz0dgOw2tiUItuxKuJ8Pf1jmP8n5i/rDCnjGsiF5umtUM4H75 6Hifzib45efdiZkbAD6UHGHkriHE4s7cazFTI/0G63U4vT+WRFrxYJ5xBi3GoLaRVcvO /QJw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id; bh=uq71m/b7YECT5Bii9WFXG/U5nKJHSb8BVg5qrPYA73s=; b=D65Gjx/NZNTPry9LeuDNUC6PMiHZIuh3AwWAEI6Yzm4WqrUVKp6u6l2IHYQyEBZB5t G2HD+xNmmE5nAzhnudvAtGLySnxcC/fN/WzlMbjyEk4JQx51mpYz5MLtM1kJ0cABt0t2 b8TxqLqekfrzciQoC02UJ6pMLTMIVOkXacsna247SMBTIbHPUQ8oXigbBwXXPComu8EV cnQICCys1BoTyW5UYpqj+DM+0qf5hOHe1DgB1E/2WbcCKCd/HnbMulGZKZIblDYBCR4e YR6frXpPtTxJgNvkCy1+dopKkpYAF2CyvuSr1Dp/JLeqICk891zo+YvkiMVid9xE/1jr wfZA== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d13-20020a170902f14d00b0019d13e26ecasi1256460plb.355.2023.04.20.02.39.45; Thu, 20 Apr 2023 02:39:56 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234495AbjDTJip (ORCPT + 99 others); Thu, 20 Apr 2023 05:38:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51474 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234160AbjDTJiH (ORCPT ); Thu, 20 Apr 2023 05:38:07 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 7876C5FF6 for ; Thu, 20 Apr 2023 02:37:07 -0700 (PDT) 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 C79741480; Thu, 20 Apr 2023 02:37:50 -0700 (PDT) Received: from [10.168.10.72] (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id DF8F33F5A1; Thu, 20 Apr 2023 02:37:03 -0700 (PDT) Message-ID: Date: Thu, 20 Apr 2023 11:37:01 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.9.0 Subject: Re: [RFC PATCH v1] sched/uclamp: Introduce SCHED_FLAG_RESET_UCLAMP_ON_FORK flag Content-Language: en-US To: David Dai Cc: Ingo Molnar , Peter Zijlstra , Juri Lelli , Vincent Guittot , 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 References: <20230416213406.2966521-1-davidai@google.com> From: Dietmar Eggemann In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-5.9 required=5.0 tests=BAYES_00,NICE_REPLY_A, RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_NONE,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 20/04/2023 03:11, David Dai wrote: > On Tue, Apr 18, 2023 at 10:18 PM 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 tasks and >>> a child task will unintentionally inherit a pesudo-random uclamp setting. >>> 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’ reply that contains more detail on how it’s being 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. [...] >> Does this issue happen with uclamp mainline or only with Android's >> slightly different version (max- vs. sum aggregation)? > > I’m using the version of uclamp that’s in Linus’ tree. How uclamp is > aggregated is unrelated to the problem I’m 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.