Received: by 2002:ac0:e34a:0:0:0:0:0 with SMTP id g10csp525756imn; Thu, 28 Jul 2022 07:57:36 -0700 (PDT) X-Google-Smtp-Source: AGRyM1ssO4E3npw8krSZwCzlmK1Hb3UopdWHIUlduk/dLusU4s+o6uOdb9Su4q3tLua886BMBACI X-Received: by 2002:a17:90b:1d87:b0:1f0:6c87:fc8 with SMTP id pf7-20020a17090b1d8700b001f06c870fc8mr10482291pjb.173.1659020255884; Thu, 28 Jul 2022 07:57:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1659020255; cv=none; d=google.com; s=arc-20160816; b=yuZyHQy+QV9W6bImFfPuzE3wnX/QWI1gl6pGIlrp728zkbYErpIsxNam7tUzeF9rmJ TOLogQdYZ0ZzAHTCy0WfJWOoYK8Pq20fmeVGbfX0YwLPt5nbzPX3WhLvnOnPmS2QH4un FaycGVG8WBQsgj4cy8hLZHInIfnJwt17HyUlFUc61Kxjn3QpbfHWcT/cMeDPhQS9boi1 lLUy7PRiEgzciLUX/OCTe0cf6WWqtWNwpGlIbyoqOs3SXDtx2yzT09+0Z33XSWKarbfZ IneC6mbT58u1NEh2t5s6Ovas8kXFD7LrKGo4uNshDevrvIWwjRPZ03/hC7rF4amS4YUH 1TQw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=DUx+MWMoJx3rj7YLGpNF515BhD3DfyJeCTB/nJKgRCk=; b=WgXoJS/OpUGXTjOgRkOp7T733IVvkqFiG3Y84/VDSesTOnqd5zcVrWszDf5OILA06A ayL2jkTMY9vJ7BM+Tigi4SPDA2HyN/VKXc+gkfewLUQb1SoG64UACXeeJXAkINk2ovbr Y4CZONTegLXpihnz0zkNNqR/bHhvHBGtj25qmXX9k0GackdahICG2nwcmBSwtiFMT1is 7Ns6PXvT/I610rfP2M4CYhV316Mr/o22Aaf7dv3Gvv3ONRC6JXk7d/JP62JyEdeZhSdC csnJQLANsRwFibP4B+v5Hev2qznrLjxHq6/DSzbGtRwNKNAQOib2k+n54ksOJIZ0ekGC pO7A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=MHJHRYEZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t69-20020a638148000000b004150ffa044dsi1151231pgd.871.2022.07.28.07.57.19; Thu, 28 Jul 2022 07:57:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=MHJHRYEZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229736AbiG1OoZ (ORCPT + 99 others); Thu, 28 Jul 2022 10:44:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51850 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232254AbiG1OoY (ORCPT ); Thu, 28 Jul 2022 10:44:24 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3FB8AF5; Thu, 28 Jul 2022 07:44:23 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id C8E9F20A80; Thu, 28 Jul 2022 14:44:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1659019461; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=DUx+MWMoJx3rj7YLGpNF515BhD3DfyJeCTB/nJKgRCk=; b=MHJHRYEZfylLqaLT6NoEWTI/QBRAymRiDK0CUqh5mdBBeYtTx6qCLSiiiJlKDbXH2CtuML ELg0DUMKWzPeLpTK+ErUV7mFx6fxMZpMc7rnXtt9XGWtBGIt5ltP3AO/QF24jIC/h4u+UH iAHGylfhM2L1Jq106PrL+B58hQ2xPus= Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 77DB513A7E; Thu, 28 Jul 2022 14:44:21 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id 3t49HMWg4mL+ZgAAMHmgww (envelope-from ); Thu, 28 Jul 2022 14:44:21 +0000 Date: Thu, 28 Jul 2022 16:44:20 +0200 From: Michal =?iso-8859-1?Q?Koutn=FD?= To: Waiman Long Cc: Ingo Molnar , Peter Zijlstra , Juri Lelli , Vincent Guittot , Dietmar Eggemann , Steven Rostedt , Ben Segall , Mel Gorman , Daniel Bristot de Oliveira , Valentin Schneider , Tejun Heo , Zefan Li , Johannes Weiner , cgroups@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 1/2] cgroup/cpuset: Keep current cpus list if cpus affinity was explicitly set Message-ID: <20220728144420.GA27407@blackbody.suse.cz> References: <20220728005815.1715522-1-longman@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220728005815.1715522-1-longman@redhat.com> User-Agent: Mutt/1.10.1 (2018-07-13) X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hello. On Wed, Jul 27, 2022 at 08:58:14PM -0400, Waiman Long wrote: > It was found that any change to the current cpuset hierarchy may reset > the cpus_allowed list of the tasks in the affected cpusets to the > default cpuset value even if those tasks have cpus affinity explicitly > set by the users before. I'm surprised this went so long unnoticed / unreported. Could it be users relied on that implicit affinity reset? > That is especially easy to trigger under a cgroup v2 environment where > writing "+cpuset" to the root cgroup's cgroup.subtree_control file > will reset the cpus affinity of all the processes in the system. This should apply only to tasks that were extracted out of the root cgroup, no? (OK, those are all processes practically.) (Even without your second patch, the scope should be limited because of src_cset==dst_cset check in cgroup_migrate_prepare_dst().) > That is especially problematic in a nohz_full environment where the > tasks running in the nohz_full CPUs usually have their cpus affinity > explicitly set and will behave incorrectly if cpus affinity changes. One could also argue that for such processes, cgroup hierarchy should be first configured and only then they start and set own affinity. > Fix this problem by adding a flag in the task structure to indicate that > a task has their cpus affinity explicitly set before and make cpuset > code not to change their cpus_allowed list unless the user chosen cpu > list is no longer a subset of the cpus_allowed list of the cpuset itself. I'm uneasy with the occasional revert of this flag, i.e. the task who set their affinity would sometimes have it overwritten and sometimes not (which might have been relied on, especially with writes into cpuset.cpus). (But I have no better answer than the counter-argument above since there's no easier way to detect the implicit migrations.) Also, is there similar effect with memory binding? Thanks, Michal