Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp140354ybz; Tue, 21 Apr 2020 06:20:21 -0700 (PDT) X-Google-Smtp-Source: APiQypL2OQwVv8H5gMkk4N+DhU82X3MjCm9w4c9tR5VluVk8/h106SM9oWHbj+rvX2ICBnAaX1BJ X-Received: by 2002:a50:bf4d:: with SMTP id g13mr18201285edk.381.1587475220843; Tue, 21 Apr 2020 06:20:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587475220; cv=none; d=google.com; s=arc-20160816; b=eJLL7zU/cdVMq3RVJPL0FLt9+tn83nmQzZcj2ea4MjRTehgWFe06CSJpOmvth4WBa1 S1NZ0LXw2V2yFONLnqHKbCCPeq7tDWNYHzoQOm8ORgXmsLxoPrUDjD14Dqdfnzbufuf4 1s2c6c4AMvf7UWIkpubmil/DOvDSOlGRp0tFO9NJt180sHS8hf/Be9AixhVta0tm3hcl 0IP7/FKSqczPGNjq9L+NtqTl1kyjUccjNPMa0Cb20Xw2381mHqU7YidZcOBJ/Z4m/8TL LY4Z7mT1EPdv+oap7aF3622J/AH7HBoc+WKoo9cvUOZF5eZeTZUgLikCY2suuf2PX3yE Y0QQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:in-reply-to :subject:cc:to:from:user-agent:references; bh=buAiQQtM1ZwpAmXmRYZ2AalL0HGAiUK5HbBE4sWzGRQ=; b=PTf1gryIqA+RwODhqupVhVtGJ4utw8P9dBlpVc3RZt/Fjgy/yw06PODpQfDLMQt6YH 99eN93HeXkcEv0NOSLjzV9hpcQX3xL/fYWWA6/SicZwlCPdECgP85FMqM172bxhAv8Y2 iGCQZaYeVf7YwwVRDLj4J4d77GO6Q0HY9Jny7d6YAkkJqUxJfs5zs9ifFuB8GIGFn13v hpaWpnNJZmhRZK0wpttKahYPEhsQBBJHgkc8sBWyQpmu5/XBTbLpoD8m1XoMssRHe67N 5v3QoxNQqRr8OF0YeWrW7WsUxImrfg5rzvRHDAB5RSAJYR3aigKprsqJecEKYX6s1GeO 08ag== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f26si1569883edj.20.2020.04.21.06.19.57; Tue, 21 Apr 2020 06:20:20 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728720AbgDUNST (ORCPT + 99 others); Tue, 21 Apr 2020 09:18:19 -0400 Received: from foss.arm.com ([217.140.110.172]:34860 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726018AbgDUNST (ORCPT ); Tue, 21 Apr 2020 09:18:19 -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 1D76E31B; Tue, 21 Apr 2020 06:18:18 -0700 (PDT) Received: from e113632-lin (e113632-lin.cambridge.arm.com [10.1.194.46]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 9FEAE3F68F; Tue, 21 Apr 2020 06:18:15 -0700 (PDT) References: <20200414150556.10920-1-qais.yousef@arm.com> <20200421121305.ziu3dfqwo7cw6ymu@e107158-lin.cambridge.arm.com> User-agent: mu4e 0.9.17; emacs 26.3 From: Valentin Schneider To: Qais Yousef Cc: Ingo Molnar , Peter Zijlstra , Juri Lelli , Vincent Guittot , Dietmar Eggemann , Steven Rostedt , Ben Segall , Mel Gorman , Andrew Morton , Thomas Gleixner , Yury Norov , Paul Turner , Alexey Dobriyan , Josh Don , Pavan Kondeti , linux-kernel@vger.kernel.org, Marc Zyngier , "Rafael J. Wysocki" Subject: Re: [PATCH 0/4] sched/rt: Distribute tasks in find_lowest_rq() In-reply-to: <20200421121305.ziu3dfqwo7cw6ymu@e107158-lin.cambridge.arm.com> Date: Tue, 21 Apr 2020 14:18:10 +0100 Message-ID: MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 21/04/20 13:13, Qais Yousef wrote: > On 04/14/20 19:58, Valentin Schneider wrote: >> >> I'm a bit wary about such blanket changes. I feel like most places impacted >> by this change don't gain anything by using the random thing. In sched land >> that would be: > > The API has always been clear that cpumask_any return a random cpu within the > mask. And the fact it's a one liner with cpumask_first() directly visible, > a user made the choice to stick to cpumask_any() indicates that that's what > they wanted. > > Probably a lot of them they don't care what cpu is returned and happy with the > random value. I don't see why it has to have an effect. Some could benefit, > like my use case here. Or others truly don't care, then it's fine to return > anything, as requested. > Exactly, *some* (which AFAICT is a minority) might benefit. So why should all the others pay the price for a functionality they do not need? I don't think your change would actually cause a splat somewhere; my point is about changing existing behaviour without having a story for it. The thing said 'pick a "random" cpu', sure, but it never did that, it always picked the first. I've pointed out two examples that want to be cpumask_first(), and I'm absolutely certain there are more than these two out there. What if folks ran some performance test and were completely fine with the _first() behaviour? What tells you randomness won't degrade some cases? IMO the correct procedure is to keep everything as it is and improve the specific callsites that benefit from randomness. I get your point that using cpumask_any() should be a good enough indicator of the latter, but I don't think it can realistically be followed. To give my PoV, if in the past someone had used a cpumask_any() where a cpumask_first() could do, I would've acked it (disclaimer: super representative population of sample size = 1). Flipping the switch on everyone to then have a series of patches "oh this one didn't need it", "this one neither", "I actually need this to be the first" just feels sloppy. > I CCed Marc who's the maintainer of this file who can clarify better if this > really breaks anything. > > If any interrupt expects to be affined to a specific CPU then this must be > described in DT/driver. I think the GIC controller is free to distribute them > to any cpu otherwise if !force. Which is usually done by irq_balancer anyway > in userspace, IIUC. > > I don't see how cpumask_any_and() break anything here too. I actually think it > improves on things by better distribute the irqs on the system by default. > As you say, if someone wants smarter IRQ affinity they can do irq_balancer and whatnot. The default kernel policy for now has been to shove everything on the lowest-numbered CPU, and I see no valid reason to change that.