From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E9157C47094 for ; Thu, 10 Jun 2021 10:20:39 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C7E93613C6 for ; Thu, 10 Jun 2021 10:20:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230103AbhFJKWe (ORCPT ); Thu, 10 Jun 2021 06:22:34 -0400 Received: from foss.arm.com ([217.140.110.172]:56194 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230086AbhFJKWe (ORCPT ); Thu, 10 Jun 2021 06:22:34 -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 8A12CD6E; Thu, 10 Jun 2021 03:20:38 -0700 (PDT) Received: from e113632-lin (usa-sjc-imap-foss1.foss.arm.com [10.121.207.14]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 051873F694; Thu, 10 Jun 2021 03:20:35 -0700 (PDT) From: Valentin Schneider To: Will Deacon Cc: linux-arm-kernel@lists.infradead.org, linux-arch@vger.kernel.org, linux-kernel@vger.kernel.org, Catalin Marinas , Marc Zyngier , Greg Kroah-Hartman , Peter Zijlstra , Morten Rasmussen , Qais Yousef , Suren Baghdasaryan , Quentin Perret , Tejun Heo , Johannes Weiner , Ingo Molnar , Juri Lelli , Vincent Guittot , "Rafael J. Wysocki" , Dietmar Eggemann , Daniel Bristot de Oliveira , kernel-team@android.com Subject: Re: [PATCH v8 11/19] sched: Allow task CPU affinity to be restricted on asymmetric systems In-Reply-To: <20210607225202.GB8215@willie-the-truck> References: <20210602164719.31777-1-will@kernel.org> <20210602164719.31777-12-will@kernel.org> <87zgw5d05b.mognet@arm.com> <20210607225202.GB8215@willie-the-truck> Date: Thu, 10 Jun 2021 11:20:33 +0100 Message-ID: <87eedac972.mognet@arm.com> MIME-Version: 1.0 Content-Type: text/plain Precedence: bulk List-ID: X-Mailing-List: linux-arch@vger.kernel.org On 07/06/21 23:52, Will Deacon wrote: > On Fri, Jun 04, 2021 at 06:12:32PM +0100, Valentin Schneider wrote: >> On 02/06/21 17:47, Will Deacon wrote: >> > + /* >> > + * Forcefully restricting the affinity of a deadline task is >> > + * likely to cause problems, so fail and noisily override the >> > + * mask entirely. >> > + */ >> > + if (task_has_dl_policy(p) && dl_bandwidth_enabled()) { >> > + err = -EPERM; >> > + goto err_unlock; >> > + } >> > + >> > + if (!cpumask_and(new_mask, &p->cpus_mask, subset_mask)) { >> > + err = -EINVAL; >> > + goto err_unlock; >> > + } >> > + >> > + /* >> > + * We're about to butcher the task affinity, so keep track of what >> > + * the user asked for in case we're able to restore it later on. >> > + */ >> > + if (user_mask) { >> > + cpumask_copy(user_mask, p->cpus_ptr); >> > + p->user_cpus_ptr = user_mask; >> > + } >> > + >> >> Shouldn't that be done before any of the bailouts above, so we can >> potentially restore the mask even if we end up forcefully expanding the >> affinity? > > I don't think so. I deliberately only track the old mask if we've managed > to take a subset for the 32-bit task. If we end up having to override the > mask entirely, then I treat it the same way as an explicit affinity change > (only with a warning printed) and don't then try to restore the old mask -- > it feels like we'd be overriding the affinity twice if we tried to do that. > Put in this way, it does make sense to me. Thanks!