Received: by 2002:a25:c205:0:0:0:0:0 with SMTP id s5csp30139ybf; Wed, 26 Feb 2020 08:16:59 -0800 (PST) X-Google-Smtp-Source: APXvYqw/ob1caR+UwT/NFMZioqEHVL9Gq2iDSlHqwf8+LIhcQUCqesdrvwf9YJ9/CwO0sPEFiLNm X-Received: by 2002:a9d:53c4:: with SMTP id i4mr3967093oth.48.1582733819376; Wed, 26 Feb 2020 08:16:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582733819; cv=none; d=google.com; s=arc-20160816; b=ZrLFqwq7ctLqeUlChht8RZC2CkLusjCKYI0kwscgFNYZSqHHf5I4Csr3uTWjFvnttI dgT4CzgAqhdsmAlYO7MrENUp2r7R0w/7tu+nPilXufF9PsWOTt575leJ4s430K9V9ryx LUyfMxeMaegVunG0pbQ6jjt296uoCT54devyjF8pT4f7Jm6zRKIXhanO8n9yGO3//S33 Olcjebc1HwTWcpGvY0n2K9ok23l8rtLIrnieE1Bxl4J0v+MHodee6KR1WSL2Dguo9+ZO sALY5iv13Gj0YeFRq8xNl01cSJdNr7luhO85v0nMHsKojZSp7x17OzcLdHMYNCtneTE4 wK5A== 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=Q/wkZw1usPfh7zYXIsEWXWVeWdLHISNLSjA+51W6IKo=; b=JJQ45wnch33M3FhxWU+EurdHQTRgzLuNVZdOnUdElDCJAVhZhR58SNzK4Yhrz3rDIP hBNk76iVFzju1RZVXUI0psTfKcQljI7oES3C1XKH8Ik9wUnegFqy18FuLe/XthT8WP2F 3bsclyQ3AceESj6+qAYe3JxZX+LQ7nmSOHjsu/ekO/n8ZSHANXRh06H6vE7HY7Tz3hFv 6yFkxFkic999pHi9GYW+FNCiHl+V+27j3omyMgJYYkt2Ubdq3BouUxSNqDgjfE4kCrzB culVAtKF6uG8iRHh6qiAPyjQ75Wqh9tZVgsGgxpvseSgfpdlhp6Ka2XH7nNpqUsrW5iq O/LA== 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 t25si1527723oic.183.2020.02.26.08.16.34; Wed, 26 Feb 2020 08:16: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; 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 S1728671AbgBZQCx (ORCPT + 99 others); Wed, 26 Feb 2020 11:02:53 -0500 Received: from foss.arm.com ([217.140.110.172]:38458 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728406AbgBZQCw (ORCPT ); Wed, 26 Feb 2020 11:02:52 -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 AAD9D30E; Wed, 26 Feb 2020 08:02:51 -0800 (PST) Received: from e107158-lin.cambridge.arm.com (e107158-lin.cambridge.arm.com [10.1.195.21]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 588263F819; Wed, 26 Feb 2020 08:02:50 -0800 (PST) Date: Wed, 26 Feb 2020 16:02:48 +0000 From: Qais Yousef To: Pavan Kondeti Cc: Ingo Molnar , Peter Zijlstra , Steven Rostedt , Dietmar Eggemann , Juri Lelli , Vincent Guittot , Ben Segall , Mel Gorman , LKML Subject: Re: [PATCH v2 5/6] sched/rt: Better manage pushing unfit tasks on wakeup Message-ID: <20200226160247.iqvdakiqbakk2llz@e107158-lin.cambridge.arm.com> References: <20200223184001.14248-1-qais.yousef@arm.com> <20200223184001.14248-6-qais.yousef@arm.com> <20200224061004.GH28029@codeaurora.org> <20200224121139.cbz2dt5heiouknif@e107158-lin.cambridge.arm.com> <20200224174138.n6pmoeffqg7eqiy2@e107158-lin.cambridge.arm.com> <20200225035505.GI28029@codeaurora.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20200225035505.GI28029@codeaurora.org> User-Agent: NeoMutt/20171215 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 02/25/20 09:25, Pavan Kondeti wrote: > > I haven't been staring at this code for as long as you, but since we have > > logic at wakeup to do a push, I think we need something here anyway for unfit > > tasks. > > > > Fixing select_task_rq_rt() to better balance tasks will help a lot in general, > > but if that was enough already then why do we need to consider a push at the > > wakeup at all then? > > > > AFAIU, in SMP the whole push-pull mechanism is racy and we introduce redundancy > > at taking the decision on various points to ensure we minimize this racy nature > > of SMP systems. Anything could have happened between the time we called > > select_task_rq_rt() and the wakeup, so we double check again before we finally > > go and run. That's how I interpret it. > > > > I am open to hear about other alternatives first anyway. Your help has been > > much appreciated so far. > > > > The search inside find_lowest_rq() happens without any locks so I believe it > is expected to have races like this. In fact there is a comment in the code > saying "This test is optimistic, if we get it wrong the load-balancer > will have to sort it out" in select_task_rq_rt(). However, the push logic > as of today works only for overloaded case. In that sense, your patch fixes > this race for b.L systems. At the same time, I feel like tracking nonfit tasks > just to fix this race seems to be too much. I will leave this to Steve and > others to take a decision. I do think without this tasks can end up on the wrong CPU longer than they should. Keep in mind that if a task is boosted to run on a big core, it still have to compete with non-boosted tasks who can run on a any cpu. So this opportunistic push might be necessary. For 5.6 though, I'll send an updated series that removes the fitness check from task_woken_rt() && switched_to_rt() and carry on with this discussion for 5.7. > > I thought of suggesting to remove the below check from select_task_rq_rt() > > p->prio < cpu_rq(target)->rt.highest_prio.curr > > which would then make the target CPU overloaded and the push logic would > spread the tasks. That works for a b.L system too. However there seems to > be a very good reason for doing this. see > https://lore.kernel.org/patchwork/patch/539137/ > > The fact that a CPU is part of lowest_mask but running a higher prio RT > task means there is a race. Should we retry one more time to see if we find > another CPU? Isn't this what I did in v1? https://lore.kernel.org/lkml/20200214163949.27850-4-qais.yousef@arm.com/ Thanks -- Qais Yousef