Received: by 2002:a05:7208:13ce:b0:7f:395a:35b6 with SMTP id r14csp210607rbe; Wed, 28 Feb 2024 18:15:38 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWRT50GHuDcgy3B8EpKMNFTMqngXsvkoCnNcaGZip2d6ctgcPN08hCGJzqm0wNknBz7so7PMLrm7xOdCaXuFh3ACkKggMUpPGskTLZR3w== X-Google-Smtp-Source: AGHT+IFh7vG3scKQaALIMuKeY7vahKEPfHId54hLAEJzJE6NgzEp9n56L8yO6fU7fkzieooJik7C X-Received: by 2002:a05:6214:1884:b0:68f:f0a1:b64f with SMTP id cx4-20020a056214188400b0068ff0a1b64fmr1122808qvb.26.1709172937768; Wed, 28 Feb 2024 18:15:37 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709172937; cv=pass; d=google.com; s=arc-20160816; b=HM9GiKwjkZZygSy+k8X1NGzAPw7t5WN8Q1rBTNdSLkgnHQ/HQKwW5jRwM0xDu+srvI GZ+hQpcxwwqCvh9bospGrj5FK7FpuhiL7ZROy8ZPrY5U17XCZSaCv404V69HRJxrNhoA dJEV1UVkll7NK1Q5P72GwU3t4VLJERpe6TqGvoEiaoXZAHC4djpRYcxw7b7SGzvOytmX RNuMojMJaAWFMjyhq/a31Gsah/kgI3SYwW3nso2E0vnXfAPhdr954Gt5ZdDieHg+Y5gr 7WnnZ4UcFLv5wkrbmSaoF8SiMiDjv1nZN1YsyRg7etxUgelDFkj6LbMbgVVbZ3y7ROP/ KNZw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=/XKfDwEYq77yh2Tx7xxyUZeYeDXKbwbjelgL1h1OpUk=; fh=Ieh26qMz7ii+wAfD3rSAC/AGrlk2wkd+lASkLp3ZwYY=; b=I0TQ9I+Ig8fgNZ12rW5ULmQYSFTQ0r9bfELZCyOG6CtLa2Khgsvn4BxGuFOtl/VtNT 3jWvgKW2rS9/sa+ghXAE/yyWCVTRgf38afhnnNjTlAy1cIqXv4M9Om0Uw2NguvvbofOi JLkNIcQ9Bt9XwTf005YY9uQDtBIopW+0MRV/EtrfPkOfByL7RtH0iWeslmPpi8wcDCwR 6weKf4862wjdLstoKtcDnUAUc58hlvxCqyRVONMRoCbjE/kzHjkhRrpQ4GU1w1jGGOya MdSqgy2zCURskK3t+EWK8/gP+VXurcTSths5hNx0xevXE3KZMSklX/Kc7oYxxQujB4iV 1G6A==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=iCMWisb7; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-86037-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-86037-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id e9-20020a0562140d8900b00690048b5b2csi451876qve.133.2024.02.28.18.15.37 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Feb 2024 18:15:37 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-86037-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=iCMWisb7; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-86037-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-86037-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 28F191C23DB9 for ; Thu, 29 Feb 2024 02:15:25 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5B909376EC; Thu, 29 Feb 2024 02:15:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="iCMWisb7" Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CDCB536AFF for ; Thu, 29 Feb 2024 02:14:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709172901; cv=none; b=cNVUIHJZ1OWavto36r5/pODRS7+3aHSTrlztUbI6TmJlQ3PtfkRWvBT8y+RLDvEpKN2AvprT1iMVrZOBPbdhy6qRrIo2ku46cNuMK7tUPmIo9jMAmBvfsX52cpWS/KZ1z12j+yXICEhBX4MFZh8CXqanR42QcYiGVY5nCSx5z1w= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709172901; c=relaxed/simple; bh=sakExV8Zhp5Sh/q1+gBQuscarUS25o1Em4K3tkAC4hY=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=uiwa4v5PoZ9gg6b9+1iKDu1urNRutxQTCMbPYZVAMZ20aDsOr6Eo6042FW3XD1thQjPpFN2gZAZiZCdBJ0lsxi3W2VfI4Z7/LW/E2+S7qNvtoMPnr5cVQIs2FRpAZWlXNlwwaYUl5r9Xj81Ubgf81vhkYz0erT5PUWrKJzuV7GM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=iCMWisb7; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1709172898; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=/XKfDwEYq77yh2Tx7xxyUZeYeDXKbwbjelgL1h1OpUk=; b=iCMWisb7YdMJFW1meLGylIuuQDACZaR+KNXB233LUevdoF3ej/6KaWAOUgjH3sp0vQB/p3 HA1rZC6UWl1bhN30G9ozPbw+t1jqGvaDO4y6B5TEZVSEacz9BV1sh7nJqMYqfqzjW1dIPw 7QQ2wmrvW0vfbuUbIjsYouK2ce2bFN4= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-658-hYHPAaMkPg2jcoflFBPneA-1; Wed, 28 Feb 2024 21:14:54 -0500 X-MC-Unique: hYHPAaMkPg2jcoflFBPneA-1 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id E47AA85A588; Thu, 29 Feb 2024 02:14:53 +0000 (UTC) Received: from llong.com (unknown [10.22.9.68]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5AE30492BFA; Thu, 29 Feb 2024 02:14:52 +0000 (UTC) From: Waiman Long To: Zefan Li , Tejun Heo , Johannes Weiner , Ingo Molnar , Peter Zijlstra , Juri Lelli , Vincent Guittot , Dietmar Eggemann , Steven Rostedt , Ben Segall , Mel Gorman , Daniel Bristot de Oliveira , Valentin Schneider , Frederic Weisbecker Cc: linux-kernel@vger.kernel.org, cgroups@vger.kernel.org, Cestmir Kalina , Costa Shulyupin , Waiman Long Subject: [PATCH 2/2] cgroup/cpuset: Exclude isolated CPUs from housekeeping CPU masks Date: Wed, 28 Feb 2024 21:14:14 -0500 Message-Id: <20240229021414.508972-3-longman@redhat.com> In-Reply-To: <20240229021414.508972-1-longman@redhat.com> References: <20240229021414.508972-1-longman@redhat.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.10 Call the newly introduced housekeeping_exlude_isolcpus() function to exclude isolated CPUs from the selected housekeeping CPU masks. This is in addition to the exclusion of isolated CPUs from the workqueue unbound CPU mask. Right now only HK_TYPE_TIMER and HK_TYPE_RCU CPU masks are updated, but more may be added in the future when appropriate. Signed-off-by: Waiman Long --- kernel/cgroup/cpuset.c | 30 +++++++++++++++++++++++------- 1 file changed, 23 insertions(+), 7 deletions(-) diff --git a/kernel/cgroup/cpuset.c b/kernel/cgroup/cpuset.c index ba36c073304a..d2541af71c22 100644 --- a/kernel/cgroup/cpuset.c +++ b/kernel/cgroup/cpuset.c @@ -214,6 +214,11 @@ static cpumask_var_t isolated_cpus; /* List of remote partition root children */ static struct list_head remote_children; +/* + * The set of housekeeping flags to be updated for CPU isolation + */ +#define HOUSEKEEPING_FLAGS (BIT(HK_TYPE_TIMER) | BIT(HK_TYPE_RCU)) + /* * Partition root states: * @@ -1505,7 +1510,15 @@ static bool partition_xcpus_del(int old_prs, struct cpuset *parent, return isolcpus_updated; } -static void update_unbound_workqueue_cpumask(bool isolcpus_updated) +/** + * update_isolation_cpumasks - Update external isolation CPU masks + * @isolcpus_updated - @true if isolation CPU masks update needed + * + * The following external CPU masks will be updated if necessary: + * - workqueue unbound cpumask + * - housekeeping cpumasks + */ +static void update_isolation_cpumasks(bool isolcpus_updated) { int ret; @@ -1515,7 +1528,10 @@ static void update_unbound_workqueue_cpumask(bool isolcpus_updated) return; ret = workqueue_unbound_exclude_cpumask(isolated_cpus); - WARN_ON_ONCE(ret < 0); + if (WARN_ON_ONCE(ret < 0)) + return; + ret = housekeeping_exlude_isolcpus(isolated_cpus, HOUSEKEEPING_FLAGS); + WARN_ON_ONCE((ret < 0) && (ret != -EOPNOTSUPP)); } /** @@ -1609,7 +1625,7 @@ static int remote_partition_enable(struct cpuset *cs, int new_prs, parent->child_ecpus_count--; } spin_unlock_irq(&callback_lock); - update_unbound_workqueue_cpumask(isolcpus_updated); + update_isolation_cpumasks(isolcpus_updated); /* * Proprogate changes in top_cpuset's effective_cpus down the hierarchy. @@ -1645,7 +1661,7 @@ static void remote_partition_disable(struct cpuset *cs, struct tmpmasks *tmp) cs->prs_err = PERR_INVCPUS; reset_partition_data(cs); spin_unlock_irq(&callback_lock); - update_unbound_workqueue_cpumask(isolcpus_updated); + update_isolation_cpumasks(isolcpus_updated); /* * Proprogate changes in top_cpuset's effective_cpus down the hierarchy. @@ -1697,7 +1713,7 @@ static void remote_cpus_update(struct cpuset *cs, struct cpumask *newmask, if (deleting) isolcpus_updated += partition_xcpus_del(prs, NULL, tmp->delmask); spin_unlock_irq(&callback_lock); - update_unbound_workqueue_cpumask(isolcpus_updated); + update_isolation_cpumasks(isolcpus_updated); /* * Proprogate changes in top_cpuset's effective_cpus down the hierarchy. @@ -2067,7 +2083,7 @@ static int update_parent_effective_cpumask(struct cpuset *cs, int cmd, WARN_ON_ONCE(parent->nr_subparts < 0); } spin_unlock_irq(&callback_lock); - update_unbound_workqueue_cpumask(isolcpus_updated); + update_isolation_cpumasks(isolcpus_updated); if ((old_prs != new_prs) && (cmd == partcmd_update)) update_partition_exclusive(cs, new_prs); @@ -3131,7 +3147,7 @@ static int update_prstate(struct cpuset *cs, int new_prs) else if (new_xcpus_state) partition_xcpus_newstate(old_prs, new_prs, cs->effective_xcpus); spin_unlock_irq(&callback_lock); - update_unbound_workqueue_cpumask(new_xcpus_state); + update_isolation_cpumasks(new_xcpus_state); /* Force update if switching back to member */ update_cpumasks_hier(cs, &tmpmask, !new_prs ? HIER_CHECKALL : 0); -- 2.39.3