Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp79480rwr; Wed, 19 Apr 2023 18:15:18 -0700 (PDT) X-Google-Smtp-Source: AKy350a+AZjVGmM7kxMFuKBbUBVA4hChSNHV/7v9ebqxhEF5Uo+Xu40IHSE/X8kdkWB0N4yNI7V6 X-Received: by 2002:a17:903:110e:b0:1a6:6fe3:df91 with SMTP id n14-20020a170903110e00b001a66fe3df91mr8412076plh.50.1681953318261; Wed, 19 Apr 2023 18:15:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681953318; cv=none; d=google.com; s=arc-20160816; b=oUu1lGjTqHykl9mcaheWu9+NvqSkacFTn0cqi8RipISfnB9pJe98jJGT45Gf3SKImj 5F4rJc9CdyfYLdRRObAlfPSU6rmOLkYyXsriRWslZhb0zCMwpTnwyQlxdAL4pR7ULRCR W7ffFD98K92Avv70nh1FPLN8NQKMEcqxsZXA/adNBuuOx5ltKWVjFZM5fvlOsYTgIVHq r8ccE9LL5cNNAkPsMbbSCBMeEzVvdf5M+C5BroGbRVzSbBOLwGAOlaGtH5NVbVbBfmjy UW7C/rVy2mIT0w+uSTXa1rpjUnAlLqHyA845xnW0x4teeaWs/LvuABlFLSpo/0tB4Dfa eZjQ== 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=22Jgp2NNHKhZ/txW70k+3rxBOHsE9mfQXDpWkcdvQ1A=; b=0IDIyIJlGH/eBcmrCNO14+tuhFFg198KRgTDO6rdAZaoLgkmlaX8CGP0pmvlH2tYt6 /TYvZlXYdnsw+R/l7YwtIg9N09MyS6FZPifYqGiKvzDmNEUR8llmO3gPEWVjeLloYSJP fz700K5rfWFvMFYXK3OEbYeYBo/ecbDkAn6c2YJC9pm3TfCYSoDiTqNGTz5kCQqmK/BU muGJKXAyLttf5vuEnomgm+OwunKww0gR2g+bVXcQADT6GAjilLwR9SwdfYGIAttqugUz M8U+wOLrgBaqL1OwNvbvapXDOg4roPtLZ45S9zuNNQ1Wr9obHXUgulIG76mkWabrZvKs qHgA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20221208 header.b=3qFjTJuB; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u2-20020a170902e80200b0019aaf311eaesi307296plg.267.2023.04.19.18.15.06; Wed, 19 Apr 2023 18:15:18 -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=@google.com header.s=20221208 header.b=3qFjTJuB; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232152AbjDTBMH (ORCPT + 99 others); Wed, 19 Apr 2023 21:12:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60948 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232931AbjDTBMD (ORCPT ); Wed, 19 Apr 2023 21:12:03 -0400 Received: from mail-wm1-x332.google.com (mail-wm1-x332.google.com [IPv6:2a00:1450:4864:20::332]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 56A0D4C13 for ; Wed, 19 Apr 2023 18:11:59 -0700 (PDT) Received: by mail-wm1-x332.google.com with SMTP id l31-20020a05600c1d1f00b003f1718d89b2so2345093wms.0 for ; Wed, 19 Apr 2023 18:11:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1681953118; x=1684545118; 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=22Jgp2NNHKhZ/txW70k+3rxBOHsE9mfQXDpWkcdvQ1A=; b=3qFjTJuB0QEcNjYY9SNTfPND8ZW629fUAbmssX9cWFjL67ZJNCdv+vg7bPuxf9Z09+ E8rAF9D/kq8hebxc+KAzheuGKASqLQVKzzPxyt7ydbQ5Q6ujuJV9Jd3/6r9H0pwB0UjQ Un34UzFEorIGPEXZcrMznDVEdhNwr/BjBA98axOxehPASFa5Rvf9SIcPGSOIV0Yw1ISJ TPkLrvabDwJAUfIayVzLhJAsrSkvqLPUXp/5Omlb//KoUTN7wunAlX3wYnXCpR2BJ5Of Kn//oqn70IdV/4fNJ4MJFixnCA2M8+WPbe30jogsknU9YI4vtiU7b+c1Un9uJYjiZnoR 1X6A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681953118; x=1684545118; 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=22Jgp2NNHKhZ/txW70k+3rxBOHsE9mfQXDpWkcdvQ1A=; b=ZdUWtauu+9RR3GnMvIZez7ekWRy33F7QGccBvyK4W2r9VW9+cu2MrSf38IvfS2VPdi Ql3uaD/oOC9HIzq8OqL/2jAXrNkbBBPZSn0Wd3TlD628pX9UgIHPntJ3Lm4h6oN+OtRS RSaTC8nhlcM10N/rQ0N2YOL9Lk52o5qrTYEZ+CJbpKXbFBb/v5lBl4u6WiqzAck4b7U0 HW4KGFP+SV3oiqMHERkhjr6+Q1ay7P3JCa13xpNski58xZLFXQ8BkLdBD5y2bEKohAA+ 0RK9AkyW7++FO5kAhBvV49ovM1wJy5kWK3zQfUs1yxktEXB+RzBa6qOQP9qOjJOfHg/L 5DOQ== X-Gm-Message-State: AAQBX9f4gl8TIdaPw8fIN7x/hlw1n0cRHCP6nwmojFh2bbEOk82vFH72 lfu3l7w34rTeONFJj6f+eRIGm/FL3C2e2e/x8JmuWw== X-Received: by 2002:a05:600c:2305:b0:3f1:728a:1881 with SMTP id 5-20020a05600c230500b003f1728a1881mr9505707wmo.31.1681953117561; Wed, 19 Apr 2023 18:11:57 -0700 (PDT) MIME-Version: 1.0 References: <20230416213406.2966521-1-davidai@google.com> In-Reply-To: From: David Dai Date: Wed, 19 Apr 2023 18:11:46 -0700 Message-ID: Subject: Re: [RFC PATCH v1] sched/uclamp: Introduce SCHED_FLAG_RESET_UCLAMP_ON_FORK flag To: Dietmar Eggemann 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 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-17.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL 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 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 tasks = and > > a child task will unintentionally inherit a pesudo-random uclamp settin= g. > > This could result in the child task being stuck with a static uclamp va= lue > > 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 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. > > The child task will only make a difference if it's on the rq. > > 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 tr= ee. How uclamp is aggregated is unrelated to the problem I=E2=80=99m trying to solve with thi= s patch. Which is to extend the uclamp APIs to have finer control for the uclamp inheritance of child tasks. Thanks, David > > > that results in poor performance or poor power. > > > > Using SCHED_FLAG_RESET_ON_FORK is too coarse for this usecase and will > > reset other useful scheduler attributes. Adding a > > SCHED_FLAG_RESET_UCLAMP_ON_FORK will allow userspace to have finer cont= rol > > over scheduler attributes of child processes. > > [...] >