Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp2077819ybl; Sat, 25 Jan 2020 16:03:53 -0800 (PST) X-Google-Smtp-Source: APXvYqwJlhBKyt3HAfHeJlbZjCH0Po4EFRoyjaycUX8XvVkydumq4HPmgwWRQXcX9+rQpw7bNlWK X-Received: by 2002:a9d:7553:: with SMTP id b19mr8179849otl.79.1579997033514; Sat, 25 Jan 2020 16:03:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1579997033; cv=none; d=google.com; s=arc-20160816; b=0zJDvm3XidmRfilRQ5a7nrLvkRSXIzyhjXTaPaSASb6RW98hTCAXCmddG/6ujIsn4B 2GhtWxSIeRiVIxKXgP/S8uJDdqOUEcD4b6M/9VYTn57qqUlNextNcdZE51FR12WPobdK dLHjoOZ0R6GGWmkTvMexlJi7IUc6JehWaDtxF0xQUEo8SJCVv2+8G4LLB1m4XPb69Et5 pOvbXSj0uZzSaHqBvO0KucYh9hJUU5yycXoD9Hg79rlCfQxQ0sbxjoNN0lW+g6WVDvjF otVqSpwR6uYvOHPHBpVcKxxKrWCxY3Cygh7L/WI9QbV9+H4yAhHLloKgrikgU5YKvMXT Rf1w== 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-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=87+aGAAmhCYka9a9pT5IkHAz70bLw6VX8vc+dAbcRw4=; b=NprqsBpZggMYj5pC71Y/LTPZNE5TyGFRyCVDaF/yTOzyLeV2+ltAO5g/pIOYePkJ7Z g5b4q1qdEqckZ3fHg6fizF0L6/6iVl6sSLbAo/cKJYtqP+07NKv1jgu76WaHmfSRfNfy jWKjsnMlmo7hj0QLsvKZrSdsQJ7b0HP7Wk1Z1SnbraIk8+WV6Qh8wO7TcPvd0+7HxJcl zrT42IKTmbpMsO1G5RFXN9n3ku9O970X4IU7aivvbrKn2TJ34sJ6z8ZqPmwd6JBSgfne 12tmNoLvQBGW4e17j8AYhuIfxdd8lh1F+n6nF+qR0oaH6GTnhrXx0PJQ9QQpc1THKkU8 xEyQ== 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 e73si1831656oib.145.2020.01.25.16.03.37; Sat, 25 Jan 2020 16:03:53 -0800 (PST) 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 S1728842AbgAYX7m (ORCPT + 99 others); Sat, 25 Jan 2020 18:59:42 -0500 Received: from foss.arm.com ([217.140.110.172]:33596 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727307AbgAYX7m (ORCPT ); Sat, 25 Jan 2020 18:59:42 -0500 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 4EDEF328; Sat, 25 Jan 2020 15:59:41 -0800 (PST) Received: from e107158-lin (e107158-lin.cambridge.arm.com [10.1.195.21]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 8475B3F68E; Sat, 25 Jan 2020 15:59:39 -0800 (PST) Date: Sat, 25 Jan 2020 23:59:37 +0000 From: Qais Yousef To: Wei Wang Cc: Valentin Schneider , Quentin Perret , Wei Wang , dietmar.eggemann@arm.com, chris.redpath@arm.com, Ingo Molnar , Peter Zijlstra , Juri Lelli , Vincent Guittot , Steven Rostedt , Ben Segall , Mel Gorman , LKML Subject: Re: [PATCH] [RFC] sched: restrict iowait boost for boosted task only Message-ID: <20200125235934.wrs2nryuk3wmtkxr@e107158-lin> References: <20200124002811.228334-1-wvw@google.com> <20200124025238.jsf36n6w4rrn2ehc@e107158-lin> <20200124095125.GA121494@google.com> <849cc9f0-f4ae-f2b6-8449-f55697928cf5@arm.com> <20200124113050.i6ovkibcmutypm3q@e107158-lin> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20171215 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 01/24/20 12:55, Wei Wang wrote: > > > So I'm pretty sure we *do* want tasks with the default clamps to get iowait > > > boost'd. What we don't want are background tasks driving up the frequency, > > > and that should be via uclamp.max (as Quentin is suggesting) rather than > > > uclamp.min (as is suggested in the patch). > > > > > > Now, whether that is overloading the usage of uclamp... I'm not sure. > > > One of the argument for uclamp was actually frequency selection, so if > > > we just make iowait boost respect that, IOW not boost further than > > > uclamp.max (which is a bit better than a simple on/off switch), that > > > wouldn't be too crazy I think. > > > > Capping iowait boost value in schedutil based on uclamp makes sense indeed. > > > > What didn't make sense to me is the use of uclamp as a switch to toggle iowait > > boost on/off. > > Sounds like we all agree on adding a new toggle, so will move forward > with that then. Looking more closely at iowait boost, it's not actually a generic cpufreq attribute. Only schedutil and intel_pstate have it. Other governors might implement something similar but under a different name. So I'm not sure how easy it'd be to implement a generic toggle for something that probably should be considered an implementation detail of a governor and userspace shouldn't care much about. Of course, the maintainers might have a different opinion. So don't let mine discourage you from pursuing this further! :-) > For capping iowait boost, it should be a seperate patch. I am not sure > if we want to apply what's the current max clamp on the rq but I do > see the per-task iowait boost makes sense. It is true the 2 patches are orthogonal, but if you already cap the max frequencies the background task can use, by ensuring the iowait_boost in schedutil respects the uclamp restrictions then this should solve your problem too, no? The patch below only compile tested. background/cpu.uclamp.max = 200 # Cap background tasks max frequencies --- diff --git a/kernel/sched/cpufreq_schedutil.c b/kernel/sched/cpufreq_schedutil.c index 9b8916fd00a2..a76c02eecdaf 100644 --- a/kernel/sched/cpufreq_schedutil.c +++ b/kernel/sched/cpufreq_schedutil.c @@ -421,7 +421,8 @@ static unsigned long sugov_iowait_apply(struct sugov_cpu *sg_cpu, u64 time, * into the same scale so we can compare. */ boost = (sg_cpu->iowait_boost * max) >> SCHED_CAPACITY_SHIFT; - return max(boost, util); + boost = max(boost, util); + return uclamp_util_with(cpu_rq(sg_cpu->cpu), boost, NULL); } #ifdef CONFIG_NO_HZ_COMMON -- Qais Yousef