Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp245721pxu; Tue, 13 Oct 2020 23:26:29 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzJdeIQmHXZeKQHbz6lBojz+aZ3L1/T6G2dDgkIyrwDq7LL8SOu77y7R99CUizJtA7B3Cd/ X-Received: by 2002:a17:906:4d10:: with SMTP id r16mr3900728eju.68.1602656789676; Tue, 13 Oct 2020 23:26:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1602656789; cv=none; d=google.com; s=arc-20160816; b=QTxOVFRPuM+uKO3Ic4v/4j8PsCnDxa/dIs7VR3PfCOsi/kZSuxnumKhlgq3LtR57ZG SZZkoKQL6GbpS9Chktr6QNbaX+HOzycLQKZchJdD4v/2ZxVbYIzq8/erMp/JdEMQjiWY LCu036GS02P/jQYLMTf+NCBYzawX/RAm3prkbtwaw9o0QDOXm6YRjKBEQ14aswPPwz2J egv21rcgPO/7DP/VYfu8Nj9ZNE19j0odOBwVY9izunrhLb5C8EpI8ugpgZa4pEerq5Ml Ymjy9GZ2qoz79uJFIF3kTN0ErLw+MDO5sqriq8QKM4bl2yV5klTosxA/cwdp4xmRsWQR Nm5g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=NOOHBSLcFPqLlOAhlLqyFRISvjmUb3OA/gUac1VxZII=; b=XpUs2ANCJ8bxOwExwM2fEBDQG6VIM7zvlTxB1UGWQkTDsTzn0IZaISVf0SHukUbA+t ydQmMt4mRmwygfYUAxSC/79pDop8IOxqGZc47pu1FrtzLiImtw+9+ZSr6f7W5EzEC1/w CdBuujpUoPVkxJNksZ3we0BPwQxq6p3dlvIGS6MwDEZ5KrbeLaD/j+9z3/O9yS2s51JU bieYtv/JyDM8LLCIStnymD1Yobv1IbvU3ikxfwVpa+UdBwyIIzjd1aq/H+SVXANuUhls XCnNQjGqo2Xij2CMzBg3jYO09KksUxFN/wHI6R76tQvCrP0Ar45U0L0+U/BbFIvZJk8h UZUQ== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id gt22si1453461ejb.571.2020.10.13.23.26.07; Tue, 13 Oct 2020 23:26:29 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727906AbgJMUZz (ORCPT + 99 others); Tue, 13 Oct 2020 16:25:55 -0400 Received: from foss.arm.com ([217.140.110.172]:36662 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726137AbgJMUZz (ORCPT ); Tue, 13 Oct 2020 16:25:55 -0400 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 93C9930E; Tue, 13 Oct 2020 13:25:54 -0700 (PDT) Received: from [192.168.178.2] (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 8C6063F66B; Tue, 13 Oct 2020 13:25:53 -0700 (PDT) Subject: Re: [PATCH v2 1/1] sched/uclamp: add SCHED_FLAG_UTIL_CLAMP_RESET flag to reset uclamp To: Yun Hsiang , peterz@infradead.org Cc: linux-kernel@vger.kernel.org, qais.yousef@arm.com, patrick.bellasi@matbug.net References: <20201012163140.371688-1-hsiang023167@gmail.com> From: Dietmar Eggemann Message-ID: Date: Tue, 13 Oct 2020 22:25:48 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <20201012163140.371688-1-hsiang023167@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. 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?