Received: by 2002:a05:7412:3784:b0:e2:908c:2ebd with SMTP id jk4csp1851359rdb; Tue, 3 Oct 2023 03:06:41 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFrdkKIFsDQT7HXL4vSpG1uX65P2UQ7tYpKzfo+qDCBIZnsYB4CgqSpUeuI4WCZkrL/jxJk X-Received: by 2002:a05:6902:150a:b0:d00:cc5b:8a9f with SMTP id q10-20020a056902150a00b00d00cc5b8a9fmr16354308ybu.16.1696327600983; Tue, 03 Oct 2023 03:06:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696327600; cv=none; d=google.com; s=arc-20160816; b=VDlW1Y1Z9JDYoF1k4LS3/1FFPFbnv770C9FuMQZHK1tgUvrk635Ol9qe6ePspsx29L OEayVM0cha6BiYQ+zhud5ottjhMRKb6/dH7OFuq7LX7A0ejSRO9YhQsIrw0BpfdKerNr pzAMwPvvJxxSOMpS7vTkAwZcH3i8l9pi3v9wTD3ncpy3RLTNCNkF1AeNtWdhZsrbpWdD Gr+poVVFMLNKuRwP4QIkORdWe6S5Q1X+P/3ydGLJh33tUlDJD1zy6w/4afGEuGeG2Hs+ KonUFiQbwpW2Iq2n2zpgfBFuI4IOwnplSOVL6bRfUKuO6AvdKh5kFDT0hUwa6Z/pIHuk y5xw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=y1+tmyaL0mfLqyg9z7m8D+U6L4leAfoeDobjpunPmas=; fh=V0EURbwsq7Qih4wMvIjmsEfh6adx2pujvE2D4CqkJSY=; b=V8u7NTInVRvDP6J1EA34yAumN03eAfMlCh1aSQVui2NsCCAPPx1OewAA91z3NWApT4 AMlMt4TtLPf2+g0jEsPekyMyf0Vr7c7LEORt1BBV2i3xvWOYU5WYHwwRbSd9/VSDjBF1 zIhf/cESTJo4RuATdb1gQKElD6jnhxDVyIZd9FVvErqJoDuOMQIJaXyApcn+YMMl7agB rP2HKNt1Dt1/Zx6Fzpq/DaMqUZ9cfAynDaV0l20VJEkGZ6ws9jHo3M7MR3M4/pX3AY8h WdyATpIDgJPqHpdh+Jh6DB93YxwakLDgMsIu1XI9xF5o2fIYkzpX2PJtIFE26QnIK3Td Nb5Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=kdcx664b; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from pete.vger.email (pete.vger.email. [2620:137:e000::3:6]) by mx.google.com with ESMTPS id k8-20020a633d08000000b00584d292d519si1163559pga.386.2023.10.03.03.06.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Oct 2023 03:06:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) client-ip=2620:137:e000::3:6; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=kdcx664b; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by pete.vger.email (Postfix) with ESMTP id 709C88041310; Tue, 3 Oct 2023 03:06:38 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239838AbjJCKGa (ORCPT + 99 others); Tue, 3 Oct 2023 06:06:30 -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> X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on pete.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (pete.vger.email [0.0.0.0]); Tue, 03 Oct 2023 03:06:38 -0700 (PDT) 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.