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=-4.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,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 64D86C47088 for ; Wed, 26 May 2021 17:25:05 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 2A917613C3 for ; Wed, 26 May 2021 17:25:05 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2A917613C3 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=8sSRzYGdN6LGCm51cD4R14DO4wIVnEHeNZ+d3eavHxg=; b=MVv54xMWwE9Gaq a4vzV5/VzQf2OqVre1LukmGH6Ds37GZJEdOgfFU5Def2HB/c/GsQSyhwshM5n/Em80k927g7HmzK0 2a/hDugV2harrqdVHf7UqtEUFFtHe+iKnVH57UY5fpd3z+H/000r/jT8kkFnu/vin+T9Vn5eTzOX8 VDdXyJ7/ItwA1wxkFqj0KOHSq9V7NDuJFZnXLSKUs97zXFdCQmlD/qcnngGqXhDBgHZcejUWceEpE tIGnCpWcqgfBqF0KCTj5TdJRcmV3ef3b0vm0ufLkmIvMH89vP6rJJR4aR/M6lu0qiHjKEIkJtnRHw lQ8wTbJpUTJVY9YqOFaA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1llxF6-00G4se-07; Wed, 26 May 2021 17:22:53 +0000 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1llwH1-00Fgl0-Bn for linux-arm-kernel@bombadil.infradead.org; Wed, 26 May 2021 16:20:47 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=IFoSjDHrMWdi2TUI6YK2jTs5l6DaG7NO6Wy5qFgfnvE=; b=be/ttzz5/pCXA47SCWWock3PTI wzzZsBgMcyifPb4Hx393/YedkBG5GLwrxlLXabX+PcaP/0rSIpGkb6ux8oQZYva3dmFaNNWNqtEmU 9J44W1EaY3jTQVrPidw3BJNctAWEqZktD1ZoD/8Jte5WZqarslzP2Rlp86LHCdSXQB+Jk75ZpyqH9 cAzzTKv9DnLccHODZI7trSIrX5vi/1H5tbLIO8fVqvTTQqh+inut9YsWh64rMqpfFH53q+n41Pvsl F5jj57KrXeI0eH13mr6tJmtqlwDyxlJp/vDz/Naj71P5mm62kReaeZ1xD8XEyaA9RCMXEeVOC1qb0 seTZGBVQ==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=noisy.programming.kicks-ass.net) by casper.infradead.org with esmtpsa (Exim 4.94 #2 (Red Hat Linux)) id 1llwGg-004gxo-Vf; Wed, 26 May 2021 16:20:33 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id A09FA300221; Wed, 26 May 2021 18:20:25 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 7B98A201D301D; Wed, 26 May 2021 18:20:25 +0200 (CEST) Date: Wed, 26 May 2021 18:20:25 +0200 From: Peter Zijlstra 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 , 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 v7 13/22] sched: Allow task CPU affinity to be restricted on asymmetric systems Message-ID: References: <20210525151432.16875-1-will@kernel.org> <20210525151432.16875-14-will@kernel.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20210525151432.16875-14-will@kernel.org> X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Tue, May 25, 2021 at 04:14:23PM +0100, Will Deacon wrote: > +static int restrict_cpus_allowed_ptr(struct task_struct *p, > + struct cpumask *new_mask, > + const struct cpumask *subset_mask) > +{ > + struct rq_flags rf; > + struct rq *rq; > + int err; > + struct cpumask *user_mask = NULL; > + > + if (!p->user_cpus_ptr) { > + user_mask = kmalloc(cpumask_size(), GFP_KERNEL); if (!user_mask) return -ENOMEM; } ? > + > + rq = task_rq_lock(p, &rf); > + > + /* > + * 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; > + } > + > + return __set_cpus_allowed_ptr_locked(p, new_mask, 0, rq, &rf); > + > +err_unlock: > + task_rq_unlock(rq, p, &rf); > + kfree(user_mask); > + return err; > +} _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel