Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp7164331ybi; Thu, 1 Aug 2019 04:12:05 -0700 (PDT) X-Google-Smtp-Source: APXvYqy54SBl9S+zviyL+keDGI3K227EStnNQQ41nZYbDMxnFEVBAqwkb9bno43yb6afE2X6akBK X-Received: by 2002:a17:902:2a69:: with SMTP id i96mr123926666plb.108.1564657925347; Thu, 01 Aug 2019 04:12:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564657925; cv=none; d=google.com; s=arc-20160816; b=MiNZGLVAstYZzGJPuK3YTwRXRF6SuYTkxtk4FXIburXxJtJLda3Il878Q1P91B2YdM Fx52SzMuxSIu0cp4Xcz7kc59smDwmzIktlPCj8rZjjXJhyNWYkBSxJIj3AvQ1p3Wrud4 K9beFgBuC4LRqAIIcp8/niFyp/JXJjhtOLcftG0DjvZ+hv7Yc2/ejRXEH3WEXtL5Z89O MF71Yx2AOGREpQHvAZRmRO5CaHunp7EDEiR1OAxD0PJnf7AIH8fHr0ek4VTMO5tqvy3s m7Gq3MRriZbSSubr9rRqr/gF9ttiNTxPXLD0SZkeOGGVZAJdoZAbYlyZC0qVaH2mYZbJ odvA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=DwsgtwpmEW6YsBuIXzOym1JXBTzjNL4ZHD2SD4FPee8=; b=a6L1JHmWs02kfjlusQV4eBV8FN+ykeRf8cPIyfs6MUgD8gpt6j9c5+GJ3HaNvDucwP +2HuqP2dFSEN3cJ0NysJrF5EVKCalUeZvIhoh2Z0pIyCimPMe0nORwiG/lJLPm+TMnvr +H6fZCJqF52Y1E6XyyUWILTChDtxXUQUfMWOg7Q/Pu+imdM8Ho42bB6ceJV8DHUSOKHe VrGgUZU8kHGObQ2g7DOuRsQnFPpbpqK35AhpTdk5PesBjgdsJNOxLxhdZgnqEJwM2y1s zJBz2XkQie3qYmCelN2oVmLagmM+cFPPgxpXUDWNT4+KMXu0m2Wq91DxcKFxhzBAvsVs khUA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z21si33653941pgu.376.2019.08.01.04.11.49; Thu, 01 Aug 2019 04:12:05 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729413AbfHALLA (ORCPT + 99 others); Thu, 1 Aug 2019 07:11:00 -0400 Received: from foss.arm.com ([217.140.110.172]:34160 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726014AbfHALK7 (ORCPT ); Thu, 1 Aug 2019 07:10:59 -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 DADC81570; Thu, 1 Aug 2019 04:10:58 -0700 (PDT) Received: from e110439-lin (e110439-lin.cambridge.arm.com [10.1.194.43]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 501603F575; Thu, 1 Aug 2019 04:10:56 -0700 (PDT) Date: Thu, 1 Aug 2019 12:10:54 +0100 From: Patrick Bellasi To: Michal =?utf-8?Q?Koutn=C3=BD?= Cc: cgroups@vger.kernel.org, linux-api@vger.kernel.org, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, Alessio Balsini , Dietmar Eggemann , Morten Rasmussen , Quentin Perret , Joel Fernandes , Paul Turner , Steve Muckle , Suren Baghdasaryan , Todd Kjos , Peter Zijlstra , "Rafael J . Wysocki" , Tejun Heo , Vincent Guittot , Viresh Kumar , Juri Lelli , Ingo Molnar Subject: Re: [PATCH v12 3/6] sched/core: uclamp: Propagate system defaults to root group Message-ID: <20190801111054.6izrad6eysfnw5ju@e110439-lin> References: <20190718181748.28446-1-patrick.bellasi@arm.com> <20190718181748.28446-4-patrick.bellasi@arm.com> <20190725114126.GA4130@blackbody.suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20190725114126.GA4130@blackbody.suse.cz> User-Agent: NeoMutt/20180716 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 25-Jul 13:41, Michal Koutn? wrote: > On Thu, Jul 18, 2019 at 07:17:45PM +0100, Patrick Bellasi wrote: > > The clamp values are not tunable at the level of the root task group. > > That's for two main reasons: > > > > - the root group represents "system resources" which are always > > entirely available from the cgroup standpoint. > > > > - when tuning/restricting "system resources" makes sense, tuning must > > be done using a system wide API which should also be available when > > control groups are not. > > > > When a system wide restriction is available, cgroups should be aware of > > its value in order to know exactly how much "system resources" are > > available for the subgroups. > IIUC, the global default would apply in uclamp_eff_get(), so this > propagation isn't strictly necessary in order to apply to tasks (that's > how it works under !CONFIG_UCLAMP_TASK_GROUP). That's right. > The reason is that effective value (which isn't exposed currently) in a > group takes into account this global restriction, right? Yep, well admittedly in this area things changed in a slightly confusing way. Up to v10: - effective values was exposed to userspace - system defaults was enforced only at enqueue time Now instead: - effective values are not exposed anymore (because of Tejun request) - system defaults are applied to the root group and propagated down the hierarchy to all effective values Both solutions are functionally correct but, in the first case, the cgroup's effective values was not really reflecting what a task will get while, in the current solution, we force update all effective values while not exposing them anymore. However, I think this solution is better in keeping information more consistent and should create less confusion if in the future we decide to expose effective values to user-space. Thought? > > @@ -1043,12 +1063,17 @@ int sysctl_sched_uclamp_handler(struct ctl_table *table, int write, > > [...] > > + if (update_root_tg) > > + uclamp_update_root_tg(); > > + > > /* > > * Updating all the RUNNABLE task is expensive, keep it simple and do > > * just a lazy update at each next enqueue time. > Since uclamp_update_root_tg() traverses down to > uclamp_update_active_tasks() is this comment half true now? Right, this comment is now wrong. We update all RUNNABLE tasks on system default changes. However, despite the above command it's difficult to say how much expensive that operation can be. It really depends on how many RUNNABLE tasks we have, the number of CPUs and also how many tasks are not already clamped by a more restrictive "effective" value. Thus, for the time being, we can consider speculation the above statement and add in a simple change if in the future that should be reported as a real issue to justify a lazy update. The upside is that with the current implementation we have a more strict control on task. Even long running tasks can be clamped on sysadmin demand without waiting for them to sleep. Does that makes sense? If it does, I'll drop the above comment in v13. Cheers Patrick -- #include Patrick Bellasi