Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753145AbbDFTqh (ORCPT ); Mon, 6 Apr 2015 15:46:37 -0400 Received: from mail-db3on0098.outbound.protection.outlook.com ([157.55.234.98]:40576 "EHLO emea01-db3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753074AbbDFTqe (ORCPT ); Mon, 6 Apr 2015 15:46:34 -0400 Authentication-Results: spf=fail (sender IP is 12.216.194.146) smtp.mailfrom=ezchip.com; ezchip.com; dkim=none (message not signed) header.d=none; From: To: Frederic Weisbecker , Don Zickus , Ingo Molnar , Andrew Morton , Andrew Jones , chai wen , Ulrich Obergfell , Fabian Frederick , Aaron Tomlin , Ben Zhang , "Christoph Lameter" , Gilad Ben-Yossef , "Steven Rostedt" , , "Jonathan Corbet" , , Thomas Gleixner , Peter Zijlstra CC: Chris Metcalf Subject: [PATCH v5 1/2] smpboot: allow excluding cpus from the smpboot threads Date: Mon, 6 Apr 2015 15:45:55 -0400 Message-ID: <1428349556-21873-2-git-send-email-cmetcalf@ezchip.com> X-Mailer: git-send-email 2.1.2 In-Reply-To: <1428349556-21873-1-git-send-email-cmetcalf@ezchip.com> References: <1258649504.12464273.1428252407339.JavaMail.zimbra@redhat.com> <1428349556-21873-1-git-send-email-cmetcalf@ezchip.com> X-EOPAttributedMessage: 0 X-Forefront-Antispam-Report: CIP:12.216.194.146;CTRY:US;IPV:NLI;EFV:NLI;BMV:1;SFV:NSPM;SFS:(10009020)(6009001)(339900001)(189002)(199003)(92566002)(42186005)(19580395003)(50466002)(33646002)(46102003)(229853001)(106466001)(2950100001)(104016003)(105606002)(50986999)(36756003)(19580405001)(76176999)(48376002)(47776003)(6806004)(86152002)(77156002)(50226001)(62966003)(86362001)(85426001)(87936001)(921003)(1121003);DIR:OUT;SFP:1101;SCL:1;SRVR:HE1PR02MB0780;H:ld-1.internal.tilera.com;FPR:;SPF:Fail;MLV:sfv;MX:1;A:1;LANG:en; MIME-Version: 1.0 Content-Type: text/plain X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:HE1PR02MB0780; X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(601004)(5005006)(5002010);SRVR:HE1PR02MB0780;BCL:0;PCL:0;RULEID:;SRVR:HE1PR02MB0780; X-Forefront-PRVS: 0538A71254 X-OriginatorOrg: ezchip.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Apr 2015 19:46:29.9980 (UTC) X-MS-Exchange-CrossTenant-Id: 0fc16e0a-3cd3-4092-8b2f-0a42cff122c3 X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=0fc16e0a-3cd3-4092-8b2f-0a42cff122c3;Ip=[12.216.194.146];Helo=[ld-1.internal.tilera.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR02MB0780 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2325 Lines: 70 From: Chris Metcalf This change allows some cores to be excluded from running the smp_hotplug_thread tasks. The motivating example for this is the watchdog threads, which by default we don't want to run on any enabled nohz_full cores. Signed-off-by: Chris Metcalf --- include/linux/smpboot.h | 2 ++ kernel/smpboot.c | 11 ++++++++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/include/linux/smpboot.h b/include/linux/smpboot.h index d600afb21926..de2f64a98108 100644 --- a/include/linux/smpboot.h +++ b/include/linux/smpboot.h @@ -27,6 +27,7 @@ struct smpboot_thread_data; * @pre_unpark: Optional unpark function, called before the thread is * unparked (cpu online). This is not guaranteed to be * called on the target cpu of the thread. Careful! + * @exclude_mask: Optional cpumask, specifying cores to exclude. * @selfparking: Thread is not parked by the park function. * @thread_comm: The base name of the thread */ @@ -41,6 +42,7 @@ struct smp_hotplug_thread { void (*park)(unsigned int cpu); void (*unpark)(unsigned int cpu); void (*pre_unpark)(unsigned int cpu); + cpumask_t *exclude_mask; bool selfparking; const char *thread_comm; }; diff --git a/kernel/smpboot.c b/kernel/smpboot.c index c697f73d82d6..8adff4f817fc 100644 --- a/kernel/smpboot.c +++ b/kernel/smpboot.c @@ -173,6 +173,9 @@ __smpboot_create_thread(struct smp_hotplug_thread *ht, unsigned int cpu) if (tsk) return 0; + if (ht->exclude_mask && cpumask_test_cpu(cpu, ht->exclude_mask)) + return 0; + td = kzalloc_node(sizeof(*td), GFP_KERNEL, cpu_to_node(cpu)); if (!td) return -ENOMEM; @@ -221,9 +224,11 @@ static void smpboot_unpark_thread(struct smp_hotplug_thread *ht, unsigned int cp { struct task_struct *tsk = *per_cpu_ptr(ht->store, cpu); - if (ht->pre_unpark) - ht->pre_unpark(cpu); - kthread_unpark(tsk); + if (tsk) { + if (ht->pre_unpark) + ht->pre_unpark(cpu); + kthread_unpark(tsk); + } } void smpboot_unpark_threads(unsigned int cpu) -- 2.1.2 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/