Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp389708pxj; Thu, 10 Jun 2021 03:23:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwjRy2dc6ewAHRIKShEI2yLIxKGNG9j4u+DapSs6TQDxkKzw0+3EMgIy7P6dhY3zEZHBOFo X-Received: by 2002:a50:ee16:: with SMTP id g22mr3966851eds.27.1623320636695; Thu, 10 Jun 2021 03:23:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623320636; cv=none; d=google.com; s=arc-20160816; b=Ew4Hnbk+Gp9BuWwjKSweksAXaFrl+zBcZccT1WSPsbQNjkCKNYlFh725OFsdO0WqqF WGW9oU5puFwtu+l0CRG45qmA/Q+tel9g5zb2rn0yOp0l2UDRzKGDvRoePCXiit+3T2bd udsn3mkrhHCUFsscjYKCWonAlKhEObypoRtacpzTv2QgsdTspaybwnCcO/ry1uSxNuKN Z79UjRgCR/hwOw2nsE1nEGTTD2hKmiUjaCrx4A1YKqD5kH7Ko4DMOyiAWj2Z7qpqqdRI 4kfB6dR2A/YpYGMNhor0PVv6KS8fzuplIgeoGz3hOWS7VBmtRldGWofuUTmx6rkk06k8 2YPw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:references :in-reply-to:subject:cc:to:from; bh=EP++CfAQSZRodEaJwaPWFFoatdWgBiefF6Hb/r2VZ6k=; b=QaUskNPiIlNZDYLANPrKIlqNHfacI/GqnOPLCRBYmO+F1FaIydcM9tEyuiylM9MmkY Iv2nPxVP7bN71KDx7Bv+cU3UKfpGY1XUFXGbdT4SJT7kbrdmqAQ+NwXLGjajDi/UPOdq PjsBDOg/kKJnRu85LXXaK8IYWH0mXmoI7I4oCOB5xhwasUxLnCwLfWpmdUjWA19PjFKx /3+xSHlBEnrprurXbbzc4CvmQaAGKg8bgcsHpUF+YqKF58lG7IgWWHPXvioJ8M57VCed +IMBRwZnFQQezsiNqLuJqMqWbkqRLt8BYZRm+WNq8B91vfm/RuBxLFDToY+gBY2AjWo3 AwTw== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id e6si2060446edz.576.2021.06.10.03.23.33; Thu, 10 Jun 2021 03:23:56 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230203AbhFJKWf (ORCPT + 99 others); Thu, 10 Jun 2021 06:22:35 -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-kernel@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!