Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp854874pxu; Wed, 14 Oct 2020 16:05:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyDdHi4y2LiblKJegKkd2s0rFMP+bcrsgLCjdrzVFpNkAWRUvc+DNav99b7exMC6VoDxl8R X-Received: by 2002:a50:9b14:: with SMTP id o20mr1322863edi.328.1602716708514; Wed, 14 Oct 2020 16:05:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1602716708; cv=none; d=google.com; s=arc-20160816; b=k4MkDJYVBr0YmIyeyCpTpCxxU8wSNNFBFYnRxP98XMStuarYgVXZYY4E7QsQtxj7Qz SKh6YZDge6KVJU76KzxZVqxKckhMmw+5ZPNmQ/cAqciW/VZHpTDVB3p3fZYV35WijUh0 Cw0OQwsaP5+H21TLFmOS//viteIQjc+jM+MkZ9YCFXU/zV82phmwzetUR/NNwvVYleMh 0IRFcBVNG8sG1sOBwMKDxo+BUAj6Ey1u0LvXeECevdHqn/ceqK2rhgWw2vHuAjzY7fre Z/NaeVKlMsZkpzZmn222WzK6ZWtkrN/pIqABhz6dBjghd8dUfP8/WyuWMIDsb3hoBTIJ jraw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=2kzmCVx4VWztvXiKETRt1cVPZxhXoBdxox4zWFJThBs=; b=s6t2zLKNuQOsjY/HBcpueRJQLvc2Z+3Pq84LdinhfYb/tPRJ69GtPV+Jgwi43+qR4E 6+JUQByrFFLCN/TqgOUe30wOwzXHVJa+gA5UGwpVsiJmj5UgYtpfCcK0AOa18B9UFHgh 7JOIvrqFT9eoqE3joITY233f3jVBoFx3LTZYSsRdzJ+mjqsg3Lgdc7ni5Pbzl+Y/ermz ClZ6SEhR4SD4fBfvkkG3l7B5qrqE0jItGO2zS1cQb0Qjlj/i70IpMSOa1xR7IkKdQL2s 80vlAbc6R1kY3qZwGkfywGuskqNDd8IqmS1eZbNc/Yc+r3TtvMbcP6JOzGWATj6+iT6F 1gzQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=T4slwHcz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c9si736989edl.424.2020.10.14.16.04.46; Wed, 14 Oct 2020 16:05:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=T4slwHcz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730336AbgJNPAn (ORCPT + 99 others); Wed, 14 Oct 2020 11:00:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36304 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726780AbgJNPAn (ORCPT ); Wed, 14 Oct 2020 11:00:43 -0400 Received: from mail-pl1-x644.google.com (mail-pl1-x644.google.com [IPv6:2607:f8b0:4864:20::644]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E8FF2C061755 for ; Wed, 14 Oct 2020 08:00:42 -0700 (PDT) Received: by mail-pl1-x644.google.com with SMTP id o9so1896444plx.10 for ; Wed, 14 Oct 2020 08:00:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=2kzmCVx4VWztvXiKETRt1cVPZxhXoBdxox4zWFJThBs=; b=T4slwHczcFuXifvMfDF8fdTo8/QHabfkz4YSN7Yk/SeT9TE3AaTHcLFtkE89zJlBSf um6058lqvGe+fmgKvJXSs37Qf8cDtx7Ekzp7EheWEZ3RcvE6jQPugOMCbnFTC0q5wHx9 kkQWAI/rtQh3sto9PmV1q6sdDcDixrDtDh48Tu3VU0nbErwp7Fv+RhfnHp1gOF8ZpRiQ Hzjoba1tu+RFR/9V/NdfDCHFrY+Kt+PWlLFkYPijApigoSKU1ZzIfpSNix689Hw4OinM fw2Nq+XR5IrdS3jYTqoniQMxGjoQnBRJIjUX3j6AoBimw2fPhs1T2kiQIu/aZvJH+OTS kJOg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=2kzmCVx4VWztvXiKETRt1cVPZxhXoBdxox4zWFJThBs=; b=A5bOuIDGTby4j+Wvx4RV6qtPFHKH525GT8QWdqXDINnK9h31aTGKwy0Vyeq5lV9el2 GR98aM5ZQzASSoWi2M5T5nOm5RaNz5ukpO9bxPpkSzLpnaZO1oZFaDOqYZ54hdtS6Q22 1FWSEXjD5wXD5HH+/4arFPoyGqjhty91IOT1Wt06zmfLnmj4pEtdQ0KoWxMHhE3SKhul A4rFO2nDoHr7ENj/PAuyzQztWVp4yB4zrRnFZh6Flky5EiXeMFmKlJNYc+prA6ryCM1O rzxRDLAr91sXHbRqgU/SnIM6YkhWzBbZMCVOWlGU8PotmF+h+aysdyZAyiwLdskQyop7 do9w== X-Gm-Message-State: AOAM533C+H7CKgbQC+NykNcHCyyh/i3GwSaqMSpt0m48HrYm9nMye2W6 wjYQsnFAyN0qcWeLgeKmC48= X-Received: by 2002:a17:902:7c0d:b029:d3:de09:a3 with SMTP id x13-20020a1709027c0db02900d3de0900a3mr4555636pll.52.1602687642379; Wed, 14 Oct 2020 08:00:42 -0700 (PDT) Received: from ubuntu (1-171-246-157.dynamic-ip.hinet.net. [1.171.246.157]) by smtp.gmail.com with ESMTPSA id e16sm3852061pfh.45.2020.10.14.08.00.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 Oct 2020 08:00:41 -0700 (PDT) Date: Wed, 14 Oct 2020 23:00:34 +0800 From: Yun Hsiang To: Dietmar Eggemann Cc: peterz@infradead.org, linux-kernel@vger.kernel.org, qais.yousef@arm.com, patrick.bellasi@matbug.net Subject: Re: [PATCH v2 1/1] sched/uclamp: add SCHED_FLAG_UTIL_CLAMP_RESET flag to reset uclamp Message-ID: <20201014150034.GA502296@ubuntu> References: <20201012163140.371688-1-hsiang023167@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Oct 13, 2020 at 10:25:48PM +0200, Dietmar Eggemann wrote: > Hi Yun, > > On 12/10/2020 18:31, Yun Hsiang wrote: > > If the user wants to stop controlling uclamp and let the task inherit > > the value from the group, we need a method to reset. > > > > Add SCHED_FLAG_UTIL_CLAMP_RESET flag to allow the user to reset uclamp via > > sched_setattr syscall. > > before we decide on how to implement the 'uclamp user_defined reset' > feature, could we come back to your use case in > https://lkml.kernel.org/r/20201002053812.GA176142@ubuntu ? > > Lets just consider uclamp min for now. We have: > > (1) system-wide: > > # cat /proc/sys/kernel/sched_util_clamp_min > > 1024 > > (2) tg (hierarchy) with top-app's cpu.uclamp.min to ~200 (20% of 1024): > > # cat /sys/fs/cgroup/cpu/top-app/cpu.uclamp.min > 20 > > (3) and 2 cfs tasks A and B in top-app: > > # cat /sys/fs/cgroup/cpu/top-app/tasks > > pid_A > pid_B > > Then you set A and B's uclamp min to 100. A and B are now user_defined. > A and B's effective uclamp min value is 100. > > Since the task uclamp min values (3) are less than (1) and (2), their > uclamp min value is not affected by (1) or (2). > > If A doesn't want to control itself anymore, it can set its uclamp min > to e.g. 300. Now A's effective uclamp min value is ~200, i.e. controlled > by (2), the one of B stays 100. The tg uclamp value may also change. If top-app's cpu.uclamp.min change to 50 (~500), then task A's effective uclamp min value is 300 not ~500. We can set task A's uclamp to 1024, it will be restricted by the tg. But when task A move to root group, it's effective uclamp min value will be 1024 not 0. If a task is in root group and it doesn't want to control it's uclamp, the effective uclamp min value of that task should be 0. So I think reset functionality is needed. > > So the policy is: > > (a) If the user_defined task wants to control it's uclamp, use task > uclamp value less than the tg (hierarchy) (and the system-wide) > value. > > (b) If the user_defined task doesn't want to control it's uclamp > anymore, use a uclamp value greater than or equal the tg (hierarchy) > (and the system-wide) value. > > So where exactly is the use case which would require a 'uclamp > user_defined reset' functionality?