Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp1303293pxu; Thu, 17 Dec 2020 07:03:21 -0800 (PST) X-Google-Smtp-Source: ABdhPJw8H9G1L7qZ40JkAJfzelkDhpy5JUqi00bkXfwMlhv++2TsHnpMG8rJ4b0NhL3wQM/LfrfC X-Received: by 2002:a05:6512:368d:: with SMTP id d13mr14398957lfs.414.1608217400868; Thu, 17 Dec 2020 07:03:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1608217400; cv=none; d=google.com; s=arc-20160816; b=h9EGZLQKIhL5UPQ1w0h0bgWjVK3KCsIysOCbsUHXcupM7TNUkMbnM4wpvOpa+rlLnN cqPPeWWjwLahIVPqCRjSOdZsLk5HW8tBVJXcQozLEa9A0TXt0RtGjvcVh09v6T+TYmWO mI4RXYIYShSipV9uCpAOHLBfGxxU21mG8iQjpJv0f/1vhqAAo0RQmLnnU1qGT3lC//S7 cvQ4UkLM2OSgh0iIv2wUFm1krjK532WRsbpRNHkxmj0PgegS5lUAWwrsSDfrx6RS1K4l n+tLAO4y6Xm0I126j0XjnlipoULgvNraCkc/aUkj3XLO8WRLMQUN2K2ctxgn1s62IHKS L5+g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from :dkim-signature:date; bh=szPGEsUuLJrzHIPk21DQzlrY9a50wVme6VIV2kmT4wE=; b=vWEguqDa77OXyk241HCDJel/NBA+ZfgsvNV1PRSyiyPfdT+t3XUi2HOeM8ZIH7txv9 BW/iLo+2vIXD5FVVXBecP6J9/8BHTrpX2j5aoltsVo60yL91NwjWIT4IAHVrQnBJkXzx tcl1hrEwulHP0qSGIDSND0aSNbmrRnkw/0cs7NZcW4jjxi0tnkQ8NsKblxhRZa2H4kTa WuV1xu9h2/xVFQSpdUyl5FS5vXJXUPb2SdIbZ+TkAu2n2raEVXuOaXikLeeP4yfhqKKF 2PmBTWPqP2QbmrgnejwKOQyWf9Q6i+xOosAtl4zpUnMH++S9XmKoxPOTAUe4eaU70eFy ojdw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=N22OMxb+; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id x11si2659660ejb.241.2020.12.17.07.02.55; Thu, 17 Dec 2020 07:03:20 -0800 (PST) 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; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=N22OMxb+; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728313AbgLQPAm (ORCPT + 99 others); Thu, 17 Dec 2020 10:00:42 -0500 Received: from mail.kernel.org ([198.145.29.99]:60282 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728118AbgLQPAm (ORCPT ); Thu, 17 Dec 2020 10:00:42 -0500 Date: Thu, 17 Dec 2020 14:59:54 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1608217201; bh=SryEihmoGHKC5r1tLLVQJV4OdHijgIVYH18Si4+ZQUE=; h=From:To:Cc:Subject:References:In-Reply-To:From; b=N22OMxb+xaAjqkpCj4d3MHixRyNQhPXV6rdtIQ15RNVqNQeprGTLVAd20egsnrxJY uOSYgL8oU5NSCqc52q24+/d0n6RFicWy26aoTiR8Ohqb2TMnSA7YqXYaDDA06T3h9R evanQ6FiSR/bOONjtVrKzXXJgMedjO686WaL35XToPghTZB9DrIeuBzUQtJAQqzIqa 43uHKXNHr1PPswqSI592mhRYcyvFB3ppLEhUPpag9ct0eabMRS/H0zmH4RDiCyv+HG ue7W0nBnopnMCer75U/CLVzAxUXfkEQ9tq31m1EgzuxwbwD/J1tZfCQWUm2ZNY4SAq x2wufl1GC+/OA== From: Will Deacon To: Peter Zijlstra Cc: Qais Yousef , linux-arm-kernel@lists.infradead.org, linux-arch@vger.kernel.org, linux-kernel@vger.kernel.org, Catalin Marinas , Marc Zyngier , Greg Kroah-Hartman , Morten Rasmussen , Suren Baghdasaryan , Quentin Perret , Tejun Heo , Li Zefan , Johannes Weiner , Ingo Molnar , Juri Lelli , Vincent Guittot , kernel-team@android.com Subject: Re: [PATCH v5 07/15] cpuset: Don't use the cpu_possible_mask as a last resort for cgroup v1 Message-ID: <20201217145954.GA17881@willie-the-truck> References: <20201208132835.6151-1-will@kernel.org> <20201208132835.6151-8-will@kernel.org> <20201217121552.ds7g2icvqp5nvtha@e107158-lin.cambridge.arm.com> <20201217134401.GY3040@hirez.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201217134401.GY3040@hirez.programming.kicks-ass.net> User-Agent: Mutt/1.10.1 (2018-07-13) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Dec 17, 2020 at 02:44:01PM +0100, Peter Zijlstra wrote: > On Thu, Dec 17, 2020 at 12:15:52PM +0000, Qais Yousef wrote: > > On 12/08/20 13:28, Will Deacon wrote: > > > If the scheduler cannot find an allowed CPU for a task, > > > cpuset_cpus_allowed_fallback() will widen the affinity to cpu_possible_mask > > > if cgroup v1 is in use. > > > > > > In preparation for allowing architectures to provide their own fallback > > > mask, just return early if we're not using cgroup v2 and allow > > > select_fallback_rq() to figure out the mask by itself. > > > > > > Cc: Li Zefan > > > Cc: Tejun Heo > > > Cc: Johannes Weiner > > > Reviewed-by: Quentin Perret > > > Signed-off-by: Will Deacon > > > --- > > > kernel/cgroup/cpuset.c | 6 ++++-- > > > 1 file changed, 4 insertions(+), 2 deletions(-) > > > > > > diff --git a/kernel/cgroup/cpuset.c b/kernel/cgroup/cpuset.c > > > index 57b5b5d0a5fd..e970737c3ed2 100644 > > > --- a/kernel/cgroup/cpuset.c > > > +++ b/kernel/cgroup/cpuset.c > > > @@ -3299,9 +3299,11 @@ void cpuset_cpus_allowed(struct task_struct *tsk, struct cpumask *pmask) > > > > > > void cpuset_cpus_allowed_fallback(struct task_struct *tsk) > > > { > > > + if (!is_in_v2_mode()) > > > + return; /* select_fallback_rq will try harder */ > > > + > > > rcu_read_lock(); > > > - do_set_cpus_allowed(tsk, is_in_v2_mode() ? > > > - task_cs(tsk)->cpus_allowed : cpu_possible_mask); > > > + do_set_cpus_allowed(tsk, task_cs(tsk)->cpus_allowed); > > > > Why is it safe to return that for cpuset v2? > > v1 > > Because in that case it does cpu_possible_mask, which, if you look at > select_fallback_rq(), is exactly what happens when cpuset 'fails' to > find a candidate. > > Or at least, that's how I read the patch. I think Qais a point with v2 though: if task_cs(tsk)->cpus_allowed contains 64-bit-only CPUs, then we're in trouble here. I should be taking the intersection with the task_cpu_possible_mask() for the task. Will