From patchwork Thu Oct 13 18:40:28 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leonardo Bras Soares Passos X-Patchwork-Id: 2328 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp430128wrs; Thu, 13 Oct 2022 11:56:12 -0700 (PDT) X-Google-Smtp-Source: AMsMyM75JTjsu6qrfH56giTLSifIqhbIMn3J2ygYIEcYJSyw79GdjM+ZjCLF+SS1H6vP33Tgyvs8 X-Received: by 2002:a63:ff59:0:b0:439:db5:5da9 with SMTP id s25-20020a63ff59000000b004390db55da9mr1161033pgk.88.1665687372488; Thu, 13 Oct 2022 11:56:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1665687372; cv=none; d=google.com; s=arc-20160816; b=ZwgG9boEo6lycpP0fFIvVoSk7LJb1ZRf3ZcSQq7+zntYqX9txL9HrhgKoXDKCoDpbe mmHMRpEfHlz94A2EN90fpvI81ObtLu+MuavWzu/AQ8x63U1tqhpmU03QZjM55bORJuP1 OJJschvMmw4ACERUe1PBNQGD3DsPs/ogEe3As1A0YjVV7Rl4VlNf1RA4KNhe8VHBjwVj AcBcroNFXbs6FxYPNRZXpspXIkbtqG7fCANhmMmNCBT+lMse4pn3Rnvc9PxdssG26VKX 598LOIGk6TPIfAF2px6CdQr0xRM3coLRxxGO4V1Y1j+f7rJd+z1MD921UY27Bb2/ze/d cs5Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=vsO4hYJKt+wtVYN9Zqac/Tunho9CLrg8yUdRp7WUlZA=; b=uE66tuuY6y79N6IJStnFIAEl/OUVhPwQXOWcV6w/wixExnXWZPx6Xt56Bdz8PTNaf6 yD8d9hp93vLycgD96vGdfb/ZBtMSqEUZ9bybtNHu07EywgWAmtDbeZr4SwuZ9KEncTe8 h3+rIYXBID+ChDOH3k0xV9fxdVZcpynXP/puoW7i0pv+0GdiTtXoXOLzvHogZjdIyNje 5hn++rs6q7FwLwc3gBtYm5HfXHxMFeiPoS8sf4lompicwN6+ofSqNyojwotEWPbjaaVd crF83bDkHD4UyG71Os/ccw0SR1RUn1GHODbOnR7OmRPyTVXnQfshyz1GE1ZPnR2wrWlm Y53g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=YemYfWVY; 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=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id nk5-20020a17090b194500b00202b984842csi320500pjb.35.2022.10.13.11.55.58; Thu, 13 Oct 2022 11:56:12 -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=@redhat.com header.s=mimecast20190719 header.b=YemYfWVY; 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=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232234AbiJMSpv (ORCPT + 99 others); Thu, 13 Oct 2022 14:45:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32912 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232211AbiJMSow (ORCPT ); Thu, 13 Oct 2022 14:44:52 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4C6D95A14E for ; Thu, 13 Oct 2022 11:42:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1665686471; 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=vsO4hYJKt+wtVYN9Zqac/Tunho9CLrg8yUdRp7WUlZA=; b=YemYfWVYWdoYcieLZd7Ad7PNsZt7CJgWMiosvUNRoifEEFllLpSVeIuRj2R/+ECH5BRDvK pwfmOSbv3+btry+zbS2aNGZwOjyfN/czZx49rxJOukNs+quZSrifH9l8VkQNawkzPyKVT5 UnBXH1L+S7RIBLFf5Xh6M6Y7q4iu5hs= Received: from mail-oa1-f70.google.com (mail-oa1-f70.google.com [209.85.160.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-22-25EcX6d8PoagtUEumReSPg-1; Thu, 13 Oct 2022 14:41:09 -0400 X-MC-Unique: 25EcX6d8PoagtUEumReSPg-1 Received: by mail-oa1-f70.google.com with SMTP id 586e51a60fabf-132ac95c2abso1490962fac.23 for ; Thu, 13 Oct 2022 11:41:08 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=vsO4hYJKt+wtVYN9Zqac/Tunho9CLrg8yUdRp7WUlZA=; b=pRBw7rt+rr/4+7ugYtCEpD2vQ3Ka/KLKfgO3FYqJ7SkL4OVCkXChXXLpFkjuWmuJ39 qP1FMw+DrYQqpVt2WpztG3/eYhGGpjW8feWDLltFA2+4N8I977/8Lr9ZrB8ENvUf3K9E CnW/c/VAgoJzQF1ixdwNYcqDUE/S6f/wy+SEbZZDvm+aav1tXeMSFiDphZyT6cBmkuvN RpdLym7RDSVqR4wDrWRwsBHQQAFwPEfXneRRMNX7JOOelzcLwqDLCBxYI7o9F/SjaZOT loSkBqQtAbVOnVcsxtj3aAgCVsN+c3BS85BsLmgzd6jdDHWpdkjdN+ja6TIDfM/VzZjF aIFg== X-Gm-Message-State: ACrzQf16Of/SC8lGbERzGxjbH4JljX/FjTxMyadlY4FSXKiFyMiuo1rB 12M3kdqj2NcOXRt7gKBu8WzVr7Sh0uXiuIaA9Td1iLo5FhAiepwH1LLc/T29reJojoqcoSL/R/X sZ+X4Q1rn1H704jT8KyjkqsLa X-Received: by 2002:a05:6808:10c3:b0:350:e563:7c4a with SMTP id s3-20020a05680810c300b00350e5637c4amr598502ois.182.1665686468380; Thu, 13 Oct 2022 11:41:08 -0700 (PDT) X-Received: by 2002:a05:6808:10c3:b0:350:e563:7c4a with SMTP id s3-20020a05680810c300b00350e5637c4amr598464ois.182.1665686468134; Thu, 13 Oct 2022 11:41:08 -0700 (PDT) Received: from localhost.localdomain ([2804:1b3:a801:9473:d360:c737:7c9c:d52b]) by smtp.gmail.com with ESMTPSA id v13-20020a05683024ad00b006618ad77a63sm244521ots.74.2022.10.13.11.41.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 Oct 2022 11:41:07 -0700 (PDT) From: Leonardo Bras To: Steffen Klassert , Herbert Xu , "David S. Miller" , Bjorn Helgaas , Ingo Molnar , Peter Zijlstra , Juri Lelli , Vincent Guittot , Dietmar Eggemann , Steven Rostedt , Ben Segall , Mel Gorman , Daniel Bristot de Oliveira , Valentin Schneider , Tejun Heo , Lai Jiangshan , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Leonardo Bras , Frederic Weisbecker , Phil Auld , Antoine Tenart , Christophe JAILLET , Wang Yufen , mtosatti@redhat.com Cc: linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, netdev@vger.kernel.org Subject: [PATCH v2 3/4] sched/isolation: Add HK_TYPE_WQ to isolcpus=domain Date: Thu, 13 Oct 2022 15:40:28 -0300 Message-Id: <20221013184028.129486-4-leobras@redhat.com> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221013184028.129486-1-leobras@redhat.com> References: <20221013184028.129486-1-leobras@redhat.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_NONE 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1746599802602106301?= X-GMAIL-MSGID: =?utf-8?q?1746599802602106301?= Housekeeping code keeps multiple cpumasks in order to keep track of which cpus can perform given housekeeping category. Every time the HK_TYPE_WQ cpumask is checked before queueing work at a cpu WQ it also happens to check for HK_TYPE_DOMAIN. So It can be assumed that the Domain isolation also ends up isolating work queues. Delegating current HK_TYPE_DOMAIN's work queue isolation to HK_TYPE_WQ makes it simpler to check if a cpu can run a task into an work queue, since code just need to go through a single HK_TYPE_* cpumask. Make isolcpus=domain aggregate both HK_TYPE_DOMAIN and HK_TYPE_WQ, and remove a lot of cpumask_and calls. Also, remove a unnecessary '|=' at housekeeping_isolcpus_setup() since we are sure that 'flags == 0' here. Signed-off-by: Leonardo Bras Signed-off-by: Frederic Weisbecker --- drivers/pci/pci-driver.c | 13 +------------ kernel/sched/isolation.c | 4 ++-- kernel/workqueue.c | 1 - net/core/net-sysfs.c | 1 - 4 files changed, 3 insertions(+), 16 deletions(-) diff --git a/drivers/pci/pci-driver.c b/drivers/pci/pci-driver.c index 107d77f3c8467..550bef2504b8d 100644 --- a/drivers/pci/pci-driver.c +++ b/drivers/pci/pci-driver.c @@ -371,19 +371,8 @@ static int pci_call_probe(struct pci_driver *drv, struct pci_dev *dev, pci_physfn_is_probed(dev)) { cpu = nr_cpu_ids; } else { - cpumask_var_t wq_domain_mask; - - if (!zalloc_cpumask_var(&wq_domain_mask, GFP_KERNEL)) { - error = -ENOMEM; - goto out; - } - cpumask_and(wq_domain_mask, - housekeeping_cpumask(HK_TYPE_WQ), - housekeeping_cpumask(HK_TYPE_DOMAIN)); - cpu = cpumask_any_and(cpumask_of_node(node), - wq_domain_mask); - free_cpumask_var(wq_domain_mask); + housekeeping_cpumask(HK_TYPE_WQ)); } if (cpu < nr_cpu_ids) diff --git a/kernel/sched/isolation.c b/kernel/sched/isolation.c index 373d42c707bc5..ced4b78564810 100644 --- a/kernel/sched/isolation.c +++ b/kernel/sched/isolation.c @@ -204,7 +204,7 @@ static int __init housekeeping_isolcpus_setup(char *str) if (!strncmp(str, "domain,", 7)) { str += 7; - flags |= HK_FLAG_DOMAIN; + flags |= HK_FLAG_DOMAIN | HK_FLAG_WQ; continue; } @@ -234,7 +234,7 @@ static int __init housekeeping_isolcpus_setup(char *str) /* Default behaviour for isolcpus without flags */ if (!flags) - flags |= HK_FLAG_DOMAIN; + flags = HK_FLAG_DOMAIN | HK_FLAG_WQ; return housekeeping_setup(str, flags); } diff --git a/kernel/workqueue.c b/kernel/workqueue.c index 7cd5f5e7e0a1b..b557daa571f17 100644 --- a/kernel/workqueue.c +++ b/kernel/workqueue.c @@ -6004,7 +6004,6 @@ void __init workqueue_init_early(void) BUG_ON(!alloc_cpumask_var(&wq_unbound_cpumask, GFP_KERNEL)); cpumask_copy(wq_unbound_cpumask, housekeeping_cpumask(HK_TYPE_WQ)); - cpumask_and(wq_unbound_cpumask, wq_unbound_cpumask, housekeeping_cpumask(HK_TYPE_DOMAIN)); pwq_cache = KMEM_CACHE(pool_workqueue, SLAB_PANIC); diff --git a/net/core/net-sysfs.c b/net/core/net-sysfs.c index 8409d41405dfe..7b6fb62a118ab 100644 --- a/net/core/net-sysfs.c +++ b/net/core/net-sysfs.c @@ -852,7 +852,6 @@ static ssize_t store_rps_map(struct netdev_rx_queue *queue, } if (!cpumask_empty(mask)) { - cpumask_and(mask, mask, housekeeping_cpumask(HK_TYPE_DOMAIN)); cpumask_and(mask, mask, housekeeping_cpumask(HK_TYPE_WQ)); if (cpumask_empty(mask)) { free_cpumask_var(mask);