From patchwork Thu Oct 13 18:40:26 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leonardo Bras X-Patchwork-Id: 13006330 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 8452AC433FE for ; Thu, 13 Oct 2022 18:45:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232222AbiJMSpC (ORCPT ); Thu, 13 Oct 2022 14:45:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58428 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232353AbiJMSn5 (ORCPT ); Thu, 13 Oct 2022 14:43:57 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BC3B09583 for ; Thu, 13 Oct 2022 11:42:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1665686458; 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=8VBqJ4dzJjbnYynK7jkYTYjysfbRi2UUuxGT40j6Ev4=; b=CnccWy+fW16LtiD7AgKRvw0cqNN69yI64kv72Ml/ejNYEjbH60tuQCFQ5uJWklJKhKKs0f Pnk83WpsFMBd0eUlELTe/nVxc7L2NffHPgy4hMaHKvWvZea5IS64KSIogMqoocvFIOgQUP s0de0kIl6aj+j78l8jLqTtdNWWeCi8U= Received: from mail-oi1-f197.google.com (mail-oi1-f197.google.com [209.85.167.197]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-651-aAhGSLHOOKWZc3K3ImEwrQ-1; Thu, 13 Oct 2022 14:40:56 -0400 X-MC-Unique: aAhGSLHOOKWZc3K3ImEwrQ-1 Received: by mail-oi1-f197.google.com with SMTP id e7-20020aca1307000000b003550b8aaac2so810208oii.5 for ; Thu, 13 Oct 2022 11:40:56 -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=8VBqJ4dzJjbnYynK7jkYTYjysfbRi2UUuxGT40j6Ev4=; b=xPFGDn3ifGVGDgIFy7zQ+N//8vdjk5d1wZgoeqOGZUbGNM9pC/we/UH65HES8VXHcd kf+/Wf44abnvjN3LLaNAP0IG2ni2xyojB6HpNtZb9cGroFQwy1hn20NoNTuRISKY1gXA 9JylNI3Rf1dt0fKNfuvw7HjOi4GTXmY/IlyskS9snSfoZdQXMJiAp+sQnNtQ6VKzvdd5 JnhVt4YqoiIIQm91jR5Y0tsQSXohbS1k4YUgyNGngofTZSL8F3cWy4Pmp94K5qOcqEYl We6vateUAzy4DN88fzLbfgVIYIzS1+FlSNV2Bom+9wvVmVNSe/nv1WnoRmHlqDjAKD+q OVdA== X-Gm-Message-State: ACrzQf1wFi4uLZH2A+YvBsGtGyWUxoY6IeQLO/LbLyZHZqTkpE7bQGxr GK/Mgfyz/oplh2N6Vu4xEyd3t4Ot3MtqPZa12kBx2+pDjG7nXQAssm+OR25UtQJFasluO8TJsg1 GZdYxJOgYS7akl+tRlkAh X-Received: by 2002:a05:6830:3152:b0:661:ceb9:9272 with SMTP id c18-20020a056830315200b00661ceb99272mr667822ots.149.1665686455879; Thu, 13 Oct 2022 11:40:55 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4nJIAmq9Hq+46Kh8sn9us3gulZMoSvouw/Iy6ORtvgE9Z/MyjjjsC/KzgV7OOt2CYFqnSHDA== X-Received: by 2002:a05:6830:3152:b0:661:ceb9:9272 with SMTP id c18-20020a056830315200b00661ceb99272mr667806ots.149.1665686455653; Thu, 13 Oct 2022 11:40:55 -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.40.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 Oct 2022 11:40:55 -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 1/4] sched/isolation: Fix style issues reported by checkpatch Date: Thu, 13 Oct 2022 15:40:26 -0300 Message-Id: <20221013184028.129486-2-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 Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org scripts/checkpatch.pl warns about: - extern prototypes should be avoided in .h files - Missing or malformed SPDX-License-Identifier tag in line 1 Fix those issues to avoid extra noise. Signed-off-by: Leonardo Bras --- include/linux/sched/isolation.h | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/include/linux/sched/isolation.h b/include/linux/sched/isolation.h index 8c15abd67aed9..762701f295d1c 100644 --- a/include/linux/sched/isolation.h +++ b/include/linux/sched/isolation.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */ #ifndef _LINUX_SCHED_ISOLATION_H #define _LINUX_SCHED_ISOLATION_H @@ -20,12 +21,12 @@ enum hk_type { #ifdef CONFIG_CPU_ISOLATION DECLARE_STATIC_KEY_FALSE(housekeeping_overridden); -extern int housekeeping_any_cpu(enum hk_type type); -extern const struct cpumask *housekeeping_cpumask(enum hk_type type); -extern bool housekeeping_enabled(enum hk_type type); -extern void housekeeping_affine(struct task_struct *t, enum hk_type type); -extern bool housekeeping_test_cpu(int cpu, enum hk_type type); -extern void __init housekeeping_init(void); +int housekeeping_any_cpu(enum hk_type type); +const struct cpumask *housekeeping_cpumask(enum hk_type type); +bool housekeeping_enabled(enum hk_type type); +void housekeeping_affine(struct task_struct *t, enum hk_type type); +bool housekeeping_test_cpu(int cpu, enum hk_type type); +void __init housekeeping_init(void); #else From patchwork Thu Oct 13 18:40:27 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leonardo Bras X-Patchwork-Id: 13006333 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 12E8DC4332F for ; Thu, 13 Oct 2022 18:45:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230091AbiJMSpf (ORCPT ); Thu, 13 Oct 2022 14:45:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59028 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230471AbiJMSoG (ORCPT ); Thu, 13 Oct 2022 14:44:06 -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 557AE3B706 for ; Thu, 13 Oct 2022 11:42:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1665686466; 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=6JjDK3twE+pSMUDp2i+4iId8FgNp8eHanR+PXksbbJA=; b=bS3O0+uXJMajQKHu7wsh6xX6mw12rfA1dM1RMDkE1M0VFNs6ZvzHiJzXJCcHn4VEaBAd3U UqoByhoKvqGBlztLhAnh3GT2V/xAumK9Hp0T5HBO+RiqvIWQG4N0mRPf/tra/pvqDTW/cj zelr+8JHK142b+T24EDy08+wzNwj/ws= Received: from mail-oa1-f71.google.com (mail-oa1-f71.google.com [209.85.160.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-584-UMWwKXoHN0ur-EuHBMYfFw-1; Thu, 13 Oct 2022 14:41:03 -0400 X-MC-Unique: UMWwKXoHN0ur-EuHBMYfFw-1 Received: by mail-oa1-f71.google.com with SMTP id 586e51a60fabf-131caeb598bso1491627fac.12 for ; Thu, 13 Oct 2022 11:41:02 -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=6JjDK3twE+pSMUDp2i+4iId8FgNp8eHanR+PXksbbJA=; b=gqsrUiy/4vFBtO2mFSaTgiX59pc6zIclul5KoW5RMTuVrtH4fbBsGnC/dqxdmE4PGD HX6qAR7Ei+XMf8RrwQ7twyxew4bXGUjumEzCybqvyAevx+qmD/Ezg0ckQpyG+0PX1a/D jx50gDuZCMM34fa+kIitb+LQQCcbT5B9IUn3TcqFrE/URQXbu7BT2Fx4PjOw2JHjpa7j Q/0S5LlOYwMRDI7+qIK40tXNpfZ3TbI43haKqAGubYGzs+LB0Szet5uT11oBlZIEpN2M bHamJYhoVK8zI3alYvisZlkzsYn5jYw53soCZN5lErhVZGu6Mksye18V+dnvV+KMn4B8 jHDQ== X-Gm-Message-State: ACrzQf16pZEEawlBK9QK25bVkYoqjSElqhpcneGLXVav6UHD0IHsWZya 3ZqoWFA6QGYtVqXK9bSNx07nL6Uz+3AcSTvC1tsaY8lD3NhrAmImysxE0HdmcOAMsu/9aj0Vw7O us4sFKm5rt0nnKYluxKY3 X-Received: by 2002:a9d:2d81:0:b0:658:accf:2adf with SMTP id g1-20020a9d2d81000000b00658accf2adfmr688447otb.334.1665686462117; Thu, 13 Oct 2022 11:41:02 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7TiIyrwXPFplLjLvX4+bEb60ttonBBZ0lr/zrMURi69WbZIZ4juK0apaIljHzLOixeLkyFDw== X-Received: by 2002:a9d:2d81:0:b0:658:accf:2adf with SMTP id g1-20020a9d2d81000000b00658accf2adfmr688432otb.334.1665686461891; Thu, 13 Oct 2022 11:41:01 -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.40.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 Oct 2022 11:41:01 -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 2/4] sched/isolation: Improve documentation Date: Thu, 13 Oct 2022 15:40:27 -0300 Message-Id: <20221013184028.129486-3-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 Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org Improve documentation on housekeeping types and what to expect from housekeeping functions. Signed-off-by: Leonardo Bras --- include/linux/sched/isolation.h | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/include/linux/sched/isolation.h b/include/linux/sched/isolation.h index 762701f295d1c..9333c28153a7a 100644 --- a/include/linux/sched/isolation.h +++ b/include/linux/sched/isolation.h @@ -7,18 +7,25 @@ #include enum hk_type { - HK_TYPE_TIMER, - HK_TYPE_RCU, - HK_TYPE_MISC, - HK_TYPE_SCHED, - HK_TYPE_TICK, - HK_TYPE_DOMAIN, - HK_TYPE_WQ, - HK_TYPE_MANAGED_IRQ, - HK_TYPE_KTHREAD, + HK_TYPE_TIMER, /* Timer interrupt, watchdogs */ + HK_TYPE_RCU, /* RCU callbacks */ + HK_TYPE_MISC, /* Minor housekeeping categories */ + HK_TYPE_SCHED, /* Scheduling and idle load balancing */ + HK_TYPE_TICK, /* See isolcpus=nohz boot parameter */ + HK_TYPE_DOMAIN, /* See isolcpus=domain boot parameter*/ + HK_TYPE_WQ, /* Work Queues*/ + HK_TYPE_MANAGED_IRQ, /* See isolcpus=managed_irq boot parameter */ + HK_TYPE_KTHREAD, /* kernel threads */ HK_TYPE_MAX }; +/* Kernel parameters like nohz_full and isolcpus allow passing cpu numbers + * for disabling housekeeping types. + * + * The functions bellow work the opposite way, by referencing which cpus + * are able to perform the housekeeping type in parameter. + */ + #ifdef CONFIG_CPU_ISOLATION DECLARE_STATIC_KEY_FALSE(housekeeping_overridden); int housekeeping_any_cpu(enum hk_type type); 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 X-Patchwork-Id: 13006358 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 F1BEDC4332F for ; Thu, 13 Oct 2022 19:03:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229908AbiJMTDS (ORCPT ); Thu, 13 Oct 2022 15:03:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36684 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229739AbiJMTDN (ORCPT ); Thu, 13 Oct 2022 15:03:13 -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 19EDFD2C7 for ; Thu, 13 Oct 2022 12:03:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1665687789; 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=PQtX24VJk1SbFim7kz+5LDo5XmmdJEexMjfBovyfkanhiJpxkHIxqDxTyb2bSIdZXKBqy+ cq9u0dif7PjXvAyiVd36gIIX078Ed27aR+g/jtp+mQVI8UrSlxdU69lC6n8qvX/jucirTF 4VycbZe0opJmHFAH8OS/3u9pL9+soko= 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-597-A0pq_bKuOfqOpUbls1V4sQ-1; Thu, 13 Oct 2022 14:41:09 -0400 X-MC-Unique: A0pq_bKuOfqOpUbls1V4sQ-1 Received: by mail-oa1-f70.google.com with SMTP id 586e51a60fabf-1331cbf6357so1511876fac.11 for ; Thu, 13 Oct 2022 11:41:09 -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=F2xtObp4fOkqqjkbUTNlsS5bBISJEHwObtfsI47ux/UQTkxDtON2lYSKAsJAM8NqWE PP5Inl3U3G3jOgEWZueuydkFCll3PPokld6uo5KZiCPrIHcF5anBk2bzzOoIVdAM6REq CN2MEERb4Z+RSbk2iDDlaBoRLggjMgxfSBek9MEby0t5VBMDIIVnWcL5E/y4yo6BUtKf hgpP2nTkx5bizVOgwSP2rPByP63lY4JOQ9spKU6U8PQTvgaii2y6Vu2O/gGRKlu6WsxY Kgiuzx/36gznzrPr719C/epCO83+7lBhF8JNRk5eY0BGcSGx5JdZCUh3nZK+qQycGYIv a1MQ== X-Gm-Message-State: ACrzQf0pQMDk9Pc/UsCWObJOhaLGqfRNzMBncgOALIxlTlMm4PttwF7i 2vZn4h++KMEiroPC3FeejdGkCduvbbAebpKfpgQyWH8pkwyjsgCS78kS7fmosGfIELCzN4B3eOH za4eN1uBv00gxphbWCqWK X-Received: by 2002:a05:6808:10c3:b0:350:e563:7c4a with SMTP id s3-20020a05680810c300b00350e5637c4amr598492ois.182.1665686468373; Thu, 13 Oct 2022 11:41:08 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7GzHFdCUGCQhqNsosJjZKt8Eeu2wVwQ9Do3KHBGqH13o0NNm/9FKqwNNjhBy1g53fEGrBUSA== 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 Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org 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); From patchwork Thu Oct 13 18:40:29 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leonardo Bras X-Patchwork-Id: 13006348 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 09C59C4332F for ; Thu, 13 Oct 2022 18:59:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229813AbiJMS73 (ORCPT ); Thu, 13 Oct 2022 14:59:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56954 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230157AbiJMS6Q (ORCPT ); Thu, 13 Oct 2022 14:58:16 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4C823E09CD for ; Thu, 13 Oct 2022 11:56:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1665687361; 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=aO9uwyAWNrITIE0HcaM8sZnAKHxlA4eUnkHhusC4UKE=; b=Y7ytDSHUmkDNW18udAVhbDK5gZoj98wkOUavs4fRprAV7qwp9z9TEOXk+lpFvB5hLq+t24 Mzgmwu7GTglhMB2TKF97gk5j5N7JV85w+DQBrwZ0sN+cZfT28TWL2deXvEp2JRwfAVS1It dYRzC9d3CSZq8IO+Yfr8qAnWo0dQHlo= Received: from mail-oi1-f198.google.com (mail-oi1-f198.google.com [209.85.167.198]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-571-_9y3kMYFPe-zbGdg27cwCQ-1; Thu, 13 Oct 2022 14:41:15 -0400 X-MC-Unique: _9y3kMYFPe-zbGdg27cwCQ-1 Received: by mail-oi1-f198.google.com with SMTP id j186-20020aca3cc3000000b003542949670eso1090316oia.6 for ; Thu, 13 Oct 2022 11:41:15 -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=aO9uwyAWNrITIE0HcaM8sZnAKHxlA4eUnkHhusC4UKE=; b=Hl9q7BlrW1ebKpGqOhYNZpO3pGzjPGxniTSZS8hCE2hAqQ9h+duT4eVzcOONrh1X41 5O4l2TyC7/I8njEeLtCk1qaCyCIR3gGZ5zT0dLJfvc1X0Va0TJd5R25Z86J8Cu3Cae4a kCJVAVkojDirTvfrJ6cG2fStVaUR9+7yXr0w24hXKo/OQ4Q9KW3AIisg7MNyCkowiNV/ MJAfnqMJNk3NENR5gdsq8uU5TwT2JGIOPzrFD+7JtiLW8Vf57yw+PwhZ3A0GCJL4i5uE 5dkLetVb9i4FI6J9pH1ookEiS0OHxJjo+gBIaZQdnDETx53bAHG4tmMwGVUT9TY/7EIb Ehwg== X-Gm-Message-State: ACrzQf3XLKQRVhQmPRSIZvkfuyy6Q/PRsm/+29AtXia7HietJXUFWj96 N9ixkm4rXI7YHRM+7lGHKtYFqnxy77FVC9C1lUKmu4EGGbpIX7GQ/LWyyDxzxMEUVQ/U5qydQwV vZiki2og6BHRcD2ee73D3 X-Received: by 2002:a05:6870:596:b0:12d:91cd:cf36 with SMTP id m22-20020a056870059600b0012d91cdcf36mr6446060oap.84.1665686474649; Thu, 13 Oct 2022 11:41:14 -0700 (PDT) X-Google-Smtp-Source: AMsMyM52k3vKtIVGL+BfBIsY/ib9UZWiX3f2GV5v2CeLaUkMNUjAO0cLO7Cc3TLwdOlxaDtAQIvz/Q== X-Received: by 2002:a05:6870:596:b0:12d:91cd:cf36 with SMTP id m22-20020a056870059600b0012d91cdcf36mr6446050oap.84.1665686474448; Thu, 13 Oct 2022 11:41:14 -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.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 Oct 2022 11:41:14 -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 4/4] crypto/pcrypt: Do not use isolated CPUs for callback Date: Thu, 13 Oct 2022 15:40:29 -0300 Message-Id: <20221013184028.129486-5-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 Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org Currently pcrypt_aead_init_tfm() will pick callback cpus (ctx->cb_cpu) from any online cpus. Later padata_reorder() will queue_work_on() the chosen cb_cpu. This is undesired if the chosen cb_cpu is listed as isolated (i.e. using isolcpus=... or nohz_full=... kernel parameters), since the work queued will interfere with the workload on the isolated cpu. Make sure isolated cpus are not used for pcrypt. Signed-off-by: Leonardo Bras --- crypto/pcrypt.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/crypto/pcrypt.c b/crypto/pcrypt.c index 9d10b846ccf73..0162629a03957 100644 --- a/crypto/pcrypt.c +++ b/crypto/pcrypt.c @@ -16,6 +16,7 @@ #include #include #include +#include static struct padata_instance *pencrypt; static struct padata_instance *pdecrypt; @@ -175,13 +176,15 @@ static int pcrypt_aead_init_tfm(struct crypto_aead *tfm) struct pcrypt_instance_ctx *ictx = aead_instance_ctx(inst); struct pcrypt_aead_ctx *ctx = crypto_aead_ctx(tfm); struct crypto_aead *cipher; + const cpumask_t *hk_wq = housekeeping_cpumask(HK_TYPE_WQ); cpu_index = (unsigned int)atomic_inc_return(&ictx->tfm_count) % - cpumask_weight(cpu_online_mask); + cpumask_weight_and(hk_wq, cpu_online_mask); - ctx->cb_cpu = cpumask_first(cpu_online_mask); + ctx->cb_cpu = cpumask_first_and(hk_wq, cpu_online_mask); for (cpu = 0; cpu < cpu_index; cpu++) - ctx->cb_cpu = cpumask_next(ctx->cb_cpu, cpu_online_mask); + ctx->cb_cpu = cpumask_next_and(ctx->cb_cpu, hk_wq, + cpu_online_mask); cipher = crypto_spawn_aead(&ictx->spawn);