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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B661CE7543F for ; Tue, 3 Oct 2023 10:06:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239860AbjJCKGb (ORCPT ); Tue, 3 Oct 2023 06:06:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55604 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239870AbjJCKGY (ORCPT ); Tue, 3 Oct 2023 06:06:24 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D1A48B7 for ; Tue, 3 Oct 2023 03:06:18 -0700 (PDT) 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=y1+tmyaL0mfLqyg9z7m8D+U6L4leAfoeDobjpunPmas=; b=kdcx664bWi3Ru6v29rSrH8Hwpz cul/BFAED2HQh/qZ1qwkwiDaoc9zNyaNf0rLMaqdfDACc//gjLmAuxwAZAmiAg0HH0WfskpzEyxue LH6BeiZy0QTR/sanI/1QvB+xx/NhL6IpkjoO4mLnOTIoViDRzJ4uj3n0gcLJZAeRFO/Feyxd5nUeD FO1kNxgWlvFkw8riI66HEPDT40IrDFkNCjde0dsNWcYDuVMTSBUzzV5/spFekza3PgrqeGRFF5KGu Grnb9WCq1lEdcb8UKEFIepXc93QR3+ENN+vkIMhuoldvJEM0MGpCyE8sxqTQkqx1ubPantjd0Wi3i fRRqN/cw==; Received: from j130084.upc-j.chello.nl ([24.132.130.84] helo=noisy.programming.kicks-ass.net) by casper.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1qncHz-00EP60-AM; Tue, 03 Oct 2023 10:06:03 +0000 Received: by noisy.programming.kicks-ass.net (Postfix, from userid 1000) id 023A2300348; Tue, 3 Oct 2023 12:06:03 +0200 (CEST) Date: Tue, 3 Oct 2023 12:06:02 +0200 From: Peter Zijlstra To: Waiman Long Cc: Ingo Molnar , Juri Lelli , Vincent Guittot , Dietmar Eggemann , Steven Rostedt , Ben Segall , Mel Gorman , Daniel Bristot de Oliveira , Valentin Schneider , linux-kernel@vger.kernel.org, Phil Auld , Brent Rowsell , Peter Hunt Subject: Re: [PATCH v3] sched/core: Use empty mask to reset cpumasks in sched_setaffinity() Message-ID: <20231003100602.GF27267@noisy.programming.kicks-ass.net> References: <20230804023218.75544-1-longman@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230804023218.75544-1-longman@redhat.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Aug 03, 2023 at 10:32:18PM -0400, Waiman Long wrote: > Since commit 8f9ea86fdf99 ("sched: Always preserve the user requested > cpumask"), user provided CPU affinity via sched_setaffinity(2) is > perserved even if the task is being moved to a different cpuset. However, > that affinity is also being inherited by any subsequently created child > processes which may not want or be aware of that affinity. > > One way to solve this problem is to provide a way to back off from > that user provided CPU affinity. This patch implements such a scheme > by using an empty cpumask to signal a reset of the cpumasks to the > default as allowed by the current cpuset. So I still don't like this much, the normal state is all bits set: $ grep allowed /proc/self/status Cpus_allowed: ff,ffffffff The all clear bitmask just feels weird for this.