Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp974965ybl; Fri, 24 Jan 2020 13:02:00 -0800 (PST) X-Google-Smtp-Source: APXvYqyvPnWJ43dvFqEVmCRMf59NnTGpc60CLh46gnXg0/vqo/63cBcttjGuhPC6B+GPPTg/CVyg X-Received: by 2002:aca:5795:: with SMTP id l143mr540668oib.27.1579899719855; Fri, 24 Jan 2020 13:01:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1579899719; cv=none; d=google.com; s=arc-20160816; b=Xi8nvG6Qro8AXgCG9iEMu0n4o49N4I2kxCB36AvFfHEhwL7OCq34+0ad1QNHGudb/a ML5a8S1uZEcZe40dt5lQzpv1ucuz3Pa6RNDDxjZWESErSbSFGXvHdWZsvqMX61ADHyqS zGMWJhp99tUD6s7K68Nb/wY7t9O+/Rje5ypXDpy0WhlGhWlaX40ZJ4AuvbP4awO1tLcs E2ODQ693RL+POMZ6grHEZvnAtWG9cf9mLuOHo4SIDD12EhYomU1zj416o3FjX7retwqf b1dj/iJ5JmpSPgAwemoaaJsd9ZxsZz/Ggmpd4QUfcENAtQFfvD0lyZfsj2vchjgUf6wv coQw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=pnshRx+yfJVL9rNOvojgRi7jn44CYdJG0KWpqXP4zPQ=; b=JGqrOjGN090T10JSA0GZEhceZnTjcALMlM1i90qV2QfBgxTo9ivJhA+erSwvtsf5cG p1dDpd4RJ7foG28No1pKNCcBy594BbaIdFHYm9MJe9aTrm60BgwO62oF3Sqt3UyVRL12 JYFe3RmoSYkQjhGMnKKeRduTD3+7RV1gqoWmmk0bZBwKqD1WWZC2iCY64N58Du8Fi5cT xsywKuM0UqEsZJjchl6ti2nWNjkhqkeZBZXywfiMAcYTqtDEzJubNTk/HYJmUVN2+rP/ B3h2zezitIbaIxBeEDMmFb6wcEujRTqnM3+7K3Ipm6OwKq7D4u1d9S1xEwa/fnS63KZG UsYw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=Oa94JIt5; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v20si334213oia.159.2020.01.24.13.01.46; Fri, 24 Jan 2020 13:01:59 -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; dkim=pass header.i=@google.com header.s=20161025 header.b=Oa94JIt5; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2392237AbgAXTNN (ORCPT + 99 others); Fri, 24 Jan 2020 14:13:13 -0500 Received: from mail-ed1-f68.google.com ([209.85.208.68]:34383 "EHLO mail-ed1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389171AbgAXTNM (ORCPT ); Fri, 24 Jan 2020 14:13:12 -0500 Received: by mail-ed1-f68.google.com with SMTP id r18so3640881edl.1 for ; Fri, 24 Jan 2020 11:13:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=pnshRx+yfJVL9rNOvojgRi7jn44CYdJG0KWpqXP4zPQ=; b=Oa94JIt5CKbuWnjPvbSVRCesgEW9ckySl83l9PgWm734fJW2xI/a4R8GiX9sQUosa1 Akh31uBTvqxq9EtfFrLdlrP22Gb/k0LLypBBgu4QLVVmy1Sno1nqxI3UGREXMzQJ3iuA uVdVM2EQcNmv0jpSDIirPfZTQtMxmJlqGVNURO5Am9MTCoIYQAdLsmgDF/AdJXffDjus g8w6Lcvt6OF+QAGF9Hh4i/G+26lg3r/5tJsdyZMWtsPv4RhHens0kamZFmK4WvQPOE1b v0vhWkodgp9ZhxSCd1ioRsK7ihL8j7uttGuCiAPjemwZ01Iye+9skD5XcZrscNagWcsa Uh3w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=pnshRx+yfJVL9rNOvojgRi7jn44CYdJG0KWpqXP4zPQ=; b=s+E3BgPjjEQ6+Htx5o6kcIxAKvGkDPZO8uFhaYlbtwhpT8WGV8UYnPKZljGpMNaH6L ACD85qJPnBYR1wbIIggtE+kOFmPGoOLCnK6kYw1tIAlFKpZSMaUUoR14XHLp5UNVPDG2 jRBqU67y3RoPqwuL+jZOYFQzv+rHrjTx+4DcYZMoLTmXUDzIdZNTd5DxPULsO5j54lSK kH6yvQ0ivjlweFH3+PRWFN9lz9QRr92JOVpjZR8X7xl91usLGxh4op063hpLeXCALEpa V88r5pPD5d5Y4vqnh9+JAZYHcl2rH5MWE9z4Ee91GqmmXmjH4eRFJhlSu3h4gvn6jcRp PI8A== X-Gm-Message-State: APjAAAUoI6nlNEe4l5AihOOsomsQ9hueqSOJzHrJSHTqA3E9z2npWB08 +1vckE6+E51gDXQTRfF/eYWxpIyGdsNKglxLubnmFw== X-Received: by 2002:a50:ef1a:: with SMTP id m26mr3881337eds.289.1579893190505; Fri, 24 Jan 2020 11:13:10 -0800 (PST) MIME-Version: 1.0 References: <20200124002811.228334-1-wvw@google.com> <20200124025238.jsf36n6w4rrn2ehc@e107158-lin> <20200124095125.GA121494@google.com> <849cc9f0-f4ae-f2b6-8449-f55697928cf5@arm.com> In-Reply-To: <849cc9f0-f4ae-f2b6-8449-f55697928cf5@arm.com> From: Wei Wang Date: Fri, 24 Jan 2020 11:12:58 -0800 Message-ID: Subject: Re: [PATCH] [RFC] sched: restrict iowait boost for boosted task only To: Valentin Schneider Cc: Quentin Perret , Qais Yousef , 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 Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jan 24, 2020 at 3:01 AM Valentin Schneider wrote: > > On 24/01/2020 09:51, Quentin Perret wrote: > >>> +static inline bool iowait_boosted(struct task_struct *p) > >>> +{ > >>> + return p->in_iowait && uclamp_eff_value(p, UCLAMP_MIN) > 0; > >> > >> I think this is overloading the usage of util clamp. You're basically using > >> cpu.uclamp.min to temporarily switch iowait boost on/off. > >> > >> Isn't it better to add a new cgroup attribute to toggle this feature? > >> > >> The problem does seem generic enough and could benefit other battery-powered > >> devices outside of the Android world. I don't think the dependency on uclamp && > >> energy model are necessary to solve this. > > > > I think using uclamp is not a bad idea here, but perhaps we could do > > things differently. As of today the iowait boost escapes the clamping > > mechanism, so one option would be to change that. That would let us set > > a low max clamp in the 'background' cgroup, which in turns would limit > > the frequency request for those tasks even if they're IO-intensive. > > Something we see e.g. is f2fs's gc thread, and my thought on this is instead of chasing everything down, it is a lot easier for us to only boost what we know in foreground (and on Android we sort of have that information on hand from framework). I was hesitant to introduce a new switch ( e.g. Android's older EAS kernel prefer_idle toggle ) but would be happy to do that if someone supports that idea. > > > > 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. > > > > That'll have to be done at the RQ level, but figuring out what's the > > current max clamp on the rq should be doable from sugov I think. > > > > Wei: would that work for your use case ? > > > > Also, the iowait boost really should be per-task and not per-cpu, so it > > can be taken into account during wake-up balance on big.LITTLE. That > > might also help on SMP if a task doing a lot of IO migrates, as the > > boost would migrate with it. But that's perhaps for later ... > > > > Thanks, > > Quentin > >