From patchwork Thu Nov 7 11:13:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sebastian Andrzej Siewior X-Patchwork-Id: 13866213 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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0D5DBD43349 for ; Thu, 7 Nov 2024 11:18:29 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 8B6406B009A; Thu, 7 Nov 2024 06:18:28 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 898556B00A0; Thu, 7 Nov 2024 06:18:28 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7540C6B009F; Thu, 7 Nov 2024 06:18:28 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 54ACD6B0099 for ; Thu, 7 Nov 2024 06:18:28 -0500 (EST) Received: from smtpin05.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id C9D05140643 for ; Thu, 7 Nov 2024 11:18:27 +0000 (UTC) X-FDA: 82759049856.05.128FC06 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by imf24.hostedemail.com (Postfix) with ESMTP id 64ECF18001B for ; Thu, 7 Nov 2024 11:18:21 +0000 (UTC) Authentication-Results: imf24.hostedemail.com; dkim=pass header.d=linutronix.de header.s=2020 header.b=wtsNZeNO; dkim=pass header.d=linutronix.de header.s=2020e header.b=94PFRSzp; dmarc=pass (policy=none) header.from=linutronix.de; spf=pass (imf24.hostedemail.com: domain of bigeasy@linutronix.de designates 193.142.43.55 as permitted sender) smtp.mailfrom=bigeasy@linutronix.de ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1730978136; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=rlnDNt/q+P1z8kgLF+N992bHvMJ9T7IfJZldadLin68=; b=M/A3/8Rv5+nGQaaqSV+Tm9lRFjHElo9wklUftK8HLr7cSZ2MPhlE8WbK1s1l3a27Eby7tc e+15nr7iWbtsknWdsW+cl8GdlP7PoRy/2VCv+gTppubKGCLY/HWXGl5kW+2ZAlfkwMs/lc 8T0bAAn9e2ujxAGOq0zsWPAyKLwSf/I= ARC-Authentication-Results: i=1; imf24.hostedemail.com; dkim=pass header.d=linutronix.de header.s=2020 header.b=wtsNZeNO; dkim=pass header.d=linutronix.de header.s=2020e header.b=94PFRSzp; dmarc=pass (policy=none) header.from=linutronix.de; spf=pass (imf24.hostedemail.com: domain of bigeasy@linutronix.de designates 193.142.43.55 as permitted sender) smtp.mailfrom=bigeasy@linutronix.de ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1730978136; a=rsa-sha256; cv=none; b=e9biGwIkAthXGoLyu6Veb0RRFk0dKE0ERNeBOHzoMtjM8Vj4DBHgnd2FM6AnICl7GZyQNq 5yDQDzu0fEu6MF/ZrIZD7jB2wWI/50Z8Zyp95+xTL3Enlz7r78v+IMsof0SWrq8h4KXgXK 6UIgFHL6Lju/9qTr3AO3zd2A+5x0qoQ= From: Sebastian Andrzej Siewior DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1730978304; 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=rlnDNt/q+P1z8kgLF+N992bHvMJ9T7IfJZldadLin68=; b=wtsNZeNOyMJaldtbOFaqNx8Fida5NHgixfmht+XXgQL0xo2mc7k4R5BDokhZGEAAf8puhY RdaNsQqt5gLo9RzhmXtjmMEXAPSzEDrdEM428J0L8X8bgAKSqxHlUZmercMPgiaI4clbkB ovMAgCRyrdKw8bOWUgivcosNYwZGearQAPTjk3OWJxxP/+/QluQm+XzyzydmSOR1TurxAw 1VcmIe6jEMY5XIEv8bkhXi30L0O0zucKKTJ/kmEtxzTugkWiTe09cQe2z1SvGwVM/L0Uyt IymvOb70uBfkVjuv82GnKmMyUulUqf+9FRNZl+3BDNeakG35dM8WrAZv2JZZ1g== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1730978304; 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=rlnDNt/q+P1z8kgLF+N992bHvMJ9T7IfJZldadLin68=; b=94PFRSzpi6CjV9+fwfoYfFcVVSDiklFOujZck6z98CsK6lfD6ykQFvnYpIGnoHzKMnEoru u2W1K7fZOV3JHVAA== To: kasan-dev@googlegroups.com, linux-kernel@vger.kernel.org, linux-mm@kvack.org Cc: "Paul E. McKenney" , Boqun Feng , Marco Elver , Peter Zijlstra , Tomas Gleixner , Vlastimil Babka , akpm@linux-foundation.org, cl@linux.com, iamjoonsoo.kim@lge.com, longman@redhat.com, penberg@kernel.org, rientjes@google.com, sfr@canb.auug.org.au, Sebastian Andrzej Siewior Subject: [PATCH v2 1/3] scftorture: Avoid additional div operation. Date: Thu, 7 Nov 2024 12:13:06 +0100 Message-ID: <20241107111821.3417762-2-bigeasy@linutronix.de> In-Reply-To: <20241107111821.3417762-1-bigeasy@linutronix.de> References: <20241107111821.3417762-1-bigeasy@linutronix.de> MIME-Version: 1.0 X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: 64ECF18001B X-Stat-Signature: bn93kiwkubbpnpeijcxg3motj8cwf7bi X-Rspam-User: X-HE-Tag: 1730978301-526041 X-HE-Meta: U2FsdGVkX19eHa49ydI8G04W1WyQgewKOa5/vE/vV3AKE/xQBh5C6xPsaoqRfuvq+td4rdsJWW+QI4QflFjnRRuggA653Xh59RyLrDJvWFeLpzbKBMfmV46vjB8Qi9VybMwe0lt/p2pVsINfCDR3l9IC3pILIczvOdNmc45JdEjQGAjOC+T6zKMdZUk21lTcc9G+jSoxi4dR1HbeTZnDusbXlMtoPl+G7BB8/DnLm702p/WNu7UPX2uMOtLbzC6Z4UAo/WwxwW+PrJDzblcw5y8a+mB+HLCxzM63pILfUntGjg4TyvckQmMQN53MEksoEBheIK8hGa1Kr822xpY8+cwMOKS+6yH2Aio/ZLYd0n3NAFwfMycGAX9veBSVWqjvcwx6E+XFMZw0hzTOM40Pw5RXokoCkc5lIsJ5BR+EeVLSW6GkDjcWkquGbaQXwbUylQWXkIbNmyKaH6JncsnhzxnXRmdZ+MGGsBvMT75HpGDzOrTW/sFTXr94tb4Mds7ut4c9V02y9u8XadLWtgbN2YyoR7VF+d7jeo+5vO+j9mhKRUOWH8qKEb2mkZ7jG8CjIvCmS97KvaxHFv0yjeWZ8aKzimdRcL4yHIFt84l6gmdDHDRM7vG44uMUjMBuJ9cL9bnLWUi2dak7kVTh6QkTLAMagyufot5IL/62h4uZ4XybW0LL/rfSI9rVYb1OIwcTKKt/kjsdga5R7ICsTSeFWGxNEwIHJ6UAHRWOgMN4ziL3ROcLEIlzVyFRZKNYTaRWhp8vPeJRF3MYPfhaW6HbyOKTEisTeXhhbgheS6rTyJaQU02lI9Ls8+wZ1FqbjY+ixZ7rFIv00Oa+McXSMaEC0nU5zVe/ZgvmEcVQmuw/4H8HiEmtOtBJTMkg946WP0OqKErwp03l9perYNBWTBaX6XvG5XbBrX4n6riqEKKjAf9Cna5NClwIoOmv/ecLbGRXrhz81JIwM+s25kvjLvA dGn/1IZa eocdFOmpIYz21J7Vn41RXrm+u+F/S9Hfd6n8BFAbDBcVvzb6ntlbGL4/0l8Qjm/yEbaj20AkC1LyLPNTxAQyMMdACo8/jJ1ihEyiSQxJ66KVfZ2xVFOITp6yUywntaH7vfO8cteXWIN/FhVXR+9+OgRCMLWI261hBE+PiLLjSq30vIktKs/d11zKMW/9+uDm8aTX8YdaKZanpsXOnU0irafVI2Q== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: Replace "scfp->cpu % nr_cpu_ids" with "cpu". This has been computed earlier. Signed-off-by: Sebastian Andrzej Siewior --- kernel/scftorture.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/scftorture.c b/kernel/scftorture.c index 44e83a6462647..455cbff35a1a2 100644 --- a/kernel/scftorture.c +++ b/kernel/scftorture.c @@ -463,7 +463,7 @@ static int scftorture_invoker(void *arg) // Make sure that the CPU is affinitized appropriately during testing. curcpu = raw_smp_processor_id(); - WARN_ONCE(curcpu != scfp->cpu % nr_cpu_ids, + WARN_ONCE(curcpu != cpu, "%s: Wanted CPU %d, running on %d, nr_cpu_ids = %d\n", __func__, scfp->cpu, curcpu, nr_cpu_ids); From patchwork Thu Nov 7 11:13:07 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sebastian Andrzej Siewior X-Patchwork-Id: 13866215 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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 21192D4334A for ; Thu, 7 Nov 2024 11:18:32 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 35EA86B00A0; Thu, 7 Nov 2024 06:18:29 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 30E0E6B00A1; Thu, 7 Nov 2024 06:18:29 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 11D266B00A2; Thu, 7 Nov 2024 06:18:29 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id DEE696B00A0 for ; Thu, 7 Nov 2024 06:18:28 -0500 (EST) Received: from smtpin27.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 92E82805FA for ; Thu, 7 Nov 2024 11:18:28 +0000 (UTC) X-FDA: 82759049226.27.C8E9FC3 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by imf21.hostedemail.com (Postfix) with ESMTP id B065A1C000E for ; Thu, 7 Nov 2024 11:17:18 +0000 (UTC) Authentication-Results: imf21.hostedemail.com; dkim=pass header.d=linutronix.de header.s=2020 header.b=M9xvkSfR; dkim=pass header.d=linutronix.de header.s=2020e header.b=KnxUBCaR; dmarc=pass (policy=none) header.from=linutronix.de; spf=pass (imf21.hostedemail.com: domain of bigeasy@linutronix.de designates 193.142.43.55 as permitted sender) smtp.mailfrom=bigeasy@linutronix.de ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1730978222; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=gSS1F9zfYFqWED7mnEuItD0xDLRRE+69aaEbBshj25g=; b=eAVPhDzUGSnODlgU2BDTcuRkOgv2IcemyEJJRdkuM+Rajs84doTvCEyTyHigP7Et5qJndC Nlncdmjm+5hSRPabYyqkr3dYSGfgdj87I0alwZhDKYgCdGKbizSpat2SNFtQ58haF3cFnV KFTVY+oeNOHYjKo/nxtlxnNfljmcx3A= ARC-Authentication-Results: i=1; imf21.hostedemail.com; dkim=pass header.d=linutronix.de header.s=2020 header.b=M9xvkSfR; dkim=pass header.d=linutronix.de header.s=2020e header.b=KnxUBCaR; dmarc=pass (policy=none) header.from=linutronix.de; spf=pass (imf21.hostedemail.com: domain of bigeasy@linutronix.de designates 193.142.43.55 as permitted sender) smtp.mailfrom=bigeasy@linutronix.de ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1730978222; a=rsa-sha256; cv=none; b=nhizrVc0mzxRcPY8xvBTF093IgeW5cyNBLh7kNuF6KWoGm6z47+4gOljmicGogqMKzABKd uCWkSYoiC933HBOjFgjCDHQXtHJV2W59GL9mj76E2k9rDFjDidsmqLWfnLvb2+j41uEteE 6Y3GBCydMPxvqSkAWTl4xnZ+31TeEVY= From: Sebastian Andrzej Siewior DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1730978304; 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=gSS1F9zfYFqWED7mnEuItD0xDLRRE+69aaEbBshj25g=; b=M9xvkSfRi0mLUpX9TLv4MNv7FmIhnXB2PGcxl8jqrsZiTgmfXRBrLhJpqFMwH7Uch3kAc0 Zgq5WD3+uqCt0eWW7v/qYhFeIIFg+7gSe1HKqZTPiut9f7Nis8B0xtXwsCcBUfiRJZmYI9 f4ks6rTTH/lP2QUC1WpSLTqTVjPGBAxeJk77KGrjHjmpZry5sAqKOspHaB85k+uv/YpO3j wFY/7jBhLyKRB8MVxFb4SAPQP4KvF4hkpyOem2RkBmMB2phCWxSH06T9nGeKeCpXC9mS0W 4zW4IJ+UDHlgfIK2+ko98AltF74QmSgKRxPRF4YjOWQ+JWpVccUKawT/MVp8sg== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1730978304; 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=gSS1F9zfYFqWED7mnEuItD0xDLRRE+69aaEbBshj25g=; b=KnxUBCaRXPrO8SHNZYEuBzqr9XpR/DJfDS0jlMBpakInVwKuNBU6xlNJN/hBffhYxpmnVc Lj9nJ2NCMjyOJXDQ== To: kasan-dev@googlegroups.com, linux-kernel@vger.kernel.org, linux-mm@kvack.org Cc: "Paul E. McKenney" , Boqun Feng , Marco Elver , Peter Zijlstra , Tomas Gleixner , Vlastimil Babka , akpm@linux-foundation.org, cl@linux.com, iamjoonsoo.kim@lge.com, longman@redhat.com, penberg@kernel.org, rientjes@google.com, sfr@canb.auug.org.au, Sebastian Andrzej Siewior Subject: [PATCH v2 2/3] scftorture: Move memory allocation outside of preempt_disable region. Date: Thu, 7 Nov 2024 12:13:07 +0100 Message-ID: <20241107111821.3417762-3-bigeasy@linutronix.de> In-Reply-To: <20241107111821.3417762-1-bigeasy@linutronix.de> References: <20241107111821.3417762-1-bigeasy@linutronix.de> MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: B065A1C000E X-Stat-Signature: fu6oumyh97u4dg81yfghwj6dzp4xsi7d X-HE-Tag: 1730978238-856570 X-HE-Meta: U2FsdGVkX1+twiKp1eOO3BDkYKNzs+cVZnGNOyYaZ7nzrWsS9bfJeo2Zvh/etJKgWQGDjEOa9zLBz7Sl+tOyv1PaMBa+GbETzvb1x4BMyrQu+OtYwbng9TO3kxiWEqCcmgQzWThE5QYicawOPOhvclakETgOu6z7cTMyUnslT4SsMzkpDGebgixUQVlitvHoqVkHIURqmxnrWWk72L2roUFR6W6TmU/QC2AYJbFT7zzLUAyR8iRZNORi/9VFta4ZZ4vkyM8Khdqry6Joptq3eNZcZWgoHnQDZwTbvT7DZgjckNGTsDMVTWzicv9/Jz4nwiElvI2bpXxT1c6Odp8YU0w0TLfXPFO5RFxyLpeUCVUi2AeEl0vm/p6F9irFO9O06gJjLFLhzj5BUBPz5MYq97RWBE8fFF6o2c23Wuwr5Q4L4UjFOvxjvZ7i4IWjjQRPn1gL7d942PNMPR/t0ZEiFodruCj2Mrso/AtL+P6Zj+zENXCNt/c+MeYDrXGY6dHPOjhq1eJBviwGT0s9bigoVJrzLtTvaeVl8MrC70fX2jTiAknlnmpcNMPzw1PLwnpHZuBtIvTD/7rqSvK2kOdt/JLdcRq3Xlhwg19cJ920puA3IacwMy6CLlPCqvt38+w+zwkY63v2tcDlDfQBQ5iFzQnWJZd0f+ZUMkYMYBwLeLXRRP89biu69Z5ojQh6ZBoltNMkm73q++1ey1r8vEh506mi+MJk3jsTFP/J2LhcW6TCtuyZTKsU6pxFdp+d9vJFOue80hp3VGQWYnaKB+jKcX+faOO1uWc9mmqasGmmTa/5MsDiXiHMUJ/XH9t20tYA2UkpeJn1m4w43ZdX9/ossXOFD1aBbOJgmaKhCBJmMwlsOLLyvxr6F4SeYvj6TE87qZLcMevfK1SoWX+tXknMMQ7nM79rP3/T9kgTMhikFfPClrjCfVvryS6dziDmUSLVg2NxK2JqCL0JsC2vXlG krqqRpMK U7vsFCZqOUcDJnveWg8dX6yaO/TRVa/ocuZqw9pxtbPQ7GZ75WXrRkyqNPuLlfImwITkuGDDoH2aQQ/rhMF8Qo2dJLztP06D0v+h7ShXBXIDSmaD34nqgckNi3iIwNlXVcVM1mMkltFEvvnsonSzUwBlM0ZlGLDUE6q2WKbNFrTElIrcIPBmyKcTstXp18NSo6wLDQUpE7ffijhUUNGu+8je1mRlf2QQlh3NuEWLaZ81a9q8G8GBHOI0mLdDKI1VkUePAdZUveA0TA9c= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: Memory allocations can not happen within regions with explicit disabled preemption PREEMPT_RT. The problem is that the locking structures underneath are sleeping locks. Move the memory allocation outside of the preempt-disabled section. Keep the GFP_ATOMIC for the allocation to behave like a "ememergncy allocation". Signed-off-by: Sebastian Andrzej Siewior --- kernel/scftorture.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/kernel/scftorture.c b/kernel/scftorture.c index 455cbff35a1a2..555b3b10621fe 100644 --- a/kernel/scftorture.c +++ b/kernel/scftorture.c @@ -320,10 +320,6 @@ static void scftorture_invoke_one(struct scf_statistics *scfp, struct torture_ra struct scf_check *scfcp = NULL; struct scf_selector *scfsp = scf_sel_rand(trsp); - if (use_cpus_read_lock) - cpus_read_lock(); - else - preempt_disable(); if (scfsp->scfs_prim == SCF_PRIM_SINGLE || scfsp->scfs_wait) { scfcp = kmalloc(sizeof(*scfcp), GFP_ATOMIC); if (!scfcp) { @@ -337,6 +333,10 @@ static void scftorture_invoke_one(struct scf_statistics *scfp, struct torture_ra scfcp->scfc_rpc = false; } } + if (use_cpus_read_lock) + cpus_read_lock(); + else + preempt_disable(); switch (scfsp->scfs_prim) { case SCF_PRIM_RESCHED: if (IS_BUILTIN(CONFIG_SCF_TORTURE_TEST)) { From patchwork Thu Nov 7 11:13:08 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sebastian Andrzej Siewior X-Patchwork-Id: 13866214 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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2D7C6D43341 for ; Thu, 7 Nov 2024 11:18:30 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D22E66B0099; Thu, 7 Nov 2024 06:18:28 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id CD2676B009F; Thu, 7 Nov 2024 06:18:28 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B253A6B00A1; Thu, 7 Nov 2024 06:18:28 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 837476B0099 for ; Thu, 7 Nov 2024 06:18:28 -0500 (EST) Received: from smtpin10.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 26B59805F2 for ; Thu, 7 Nov 2024 11:18:28 +0000 (UTC) X-FDA: 82759049562.10.4EF9A90 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by imf08.hostedemail.com (Postfix) with ESMTP id B30EF16001D for ; Thu, 7 Nov 2024 11:18:02 +0000 (UTC) Authentication-Results: imf08.hostedemail.com; dkim=pass header.d=linutronix.de header.s=2020 header.b=hebjJzYt; dkim=pass header.d=linutronix.de header.s=2020e header.b=6rBlaRMX; dmarc=pass (policy=none) header.from=linutronix.de; spf=pass (imf08.hostedemail.com: domain of bigeasy@linutronix.de designates 193.142.43.55 as permitted sender) smtp.mailfrom=bigeasy@linutronix.de ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1730978222; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=UREpr2g7dNESBp66vCKny1OLw5nYLTave8FGBQMbiqs=; b=nzAAgM5v0Q3YnEdc1uX+sN7NUKc03lSO+jSgSIuVp9P6W9owlDVNaFNoES8wq2XvhIrWAB 9cgxYRcIvNVOEUqHZvi5587u+04ymeM2ej9aMd/z1oOs9754f6Hx2YGkMTRxuSnSB5Eh2b IgCVPKj1pY5+SP4kW8OmVScOwWQPBFA= ARC-Authentication-Results: i=1; imf08.hostedemail.com; dkim=pass header.d=linutronix.de header.s=2020 header.b=hebjJzYt; dkim=pass header.d=linutronix.de header.s=2020e header.b=6rBlaRMX; dmarc=pass (policy=none) header.from=linutronix.de; spf=pass (imf08.hostedemail.com: domain of bigeasy@linutronix.de designates 193.142.43.55 as permitted sender) smtp.mailfrom=bigeasy@linutronix.de ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1730978222; a=rsa-sha256; cv=none; b=oNKwun3T2buW4e3/blaE12dC0LZqS/V2AT7EPpU8kv/I/E1WB6g31RgxtQRdLiUM2YTS1f UnR+KzDuavSbbj4kIQMnva/ITdelmCSAPea1IMPgxHvd5I88bQu+wdMnmZgf55isHqUn7a f7dSUPX7DLN3g8K5AL5MB4FF1R2DSCM= From: Sebastian Andrzej Siewior DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1730978304; 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=UREpr2g7dNESBp66vCKny1OLw5nYLTave8FGBQMbiqs=; b=hebjJzYt5XphUNmoFrKvrRey/8dSLOnZF+JVRGOlYlm0vHgkXUhLb2qING2kAiqHPYaesF +6JwaIot+DsI5wIYho72FiJO/MCvu1hhIXayNgicQBTDb0ZCIqVuCGeOFfd6RL4MuLKooF OAU7VSdzQqjrKU9J5xtOvdpqeaHAp/L7195AFiV1Gl0dErQSAwL8clasnyAe9NPqFTkUDS v0vhAOU+sDLxfPnDuLmgo9W2qsL+PJXX3L9FsXsXFDQ14Tin0BVsmDqjxSac4Kf+W2wXjj Otc1m0GaoC0cKcq0OCjJEZ8iSz2OppX9HYbpFR6BEfpr8LwQ876PK4XoIUgL+A== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1730978304; 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=UREpr2g7dNESBp66vCKny1OLw5nYLTave8FGBQMbiqs=; b=6rBlaRMXpg74iBIs0MX5d43tUWarZm/yzruVF2Ngma8aPTtKThQISSfBrY5vOrQGKd2fUK rvaNMEM3oa1+C9Aw== To: kasan-dev@googlegroups.com, linux-kernel@vger.kernel.org, linux-mm@kvack.org Cc: "Paul E. McKenney" , Boqun Feng , Marco Elver , Peter Zijlstra , Tomas Gleixner , Vlastimil Babka , akpm@linux-foundation.org, cl@linux.com, iamjoonsoo.kim@lge.com, longman@redhat.com, penberg@kernel.org, rientjes@google.com, sfr@canb.auug.org.au, Sebastian Andrzej Siewior Subject: [PATCH v2 3/3] scftorture: Use a lock-less list to free memory. Date: Thu, 7 Nov 2024 12:13:08 +0100 Message-ID: <20241107111821.3417762-4-bigeasy@linutronix.de> In-Reply-To: <20241107111821.3417762-1-bigeasy@linutronix.de> References: <20241107111821.3417762-1-bigeasy@linutronix.de> MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: B30EF16001D X-Stat-Signature: nj5a5s18r4mcnqcdi8nnc9j51ycbcucy X-HE-Tag: 1730978282-682587 X-HE-Meta: U2FsdGVkX18PKfMfsuP2/AFlOfSAE2crYPjt6FLMNl8cpFtSXgzYdPXhennPllx/65xumcDzaJcPQELIIXY5eZHjih+u9ekjpj77RI6slOFywRfuk7TpqWcei8Mz6BBh2xgHryIZK04mL6QxT0me50FgBEG4JiPzTwPr5VJS4yUoqTNS80JbmcucHi4rUd+bGdhQSSia4N//vmbR16Mmn4ZtkMBrxw7swM8d3Qt2EzdV4Fl4p4uJN8Hd4yJ+jVwnlYmIvwGIrXBbtsKSSGikSjOZf/n4kzVPGGlYItLHzR17J7cEQxMxp5OGLCA1s94/RcWJD+3nKqrVKCXIjQ2Wqu8Rw+LsJKzvKApDQfHjE1Ov8R5SKSE9zMHrW8VJixDlWvngD4jdkVifT28RP+SNqJQUYAzioGWjSNEU7O8SNJD3MMzPuqO5k8Z7pczEHnahFZc3hVPu5zLOvJN3Qcda+CdDTgJR2GfoBTylLA1LFTFSTw91B865Bz+EG31nV1vBQyZrCryYx9oSgeEh+f4C3Uj5zsrJEyFm7E7FmcygArHpj/C5HYKDIX4o9N3bWW+RHb9GyZVyJBXbW4J3UN7aBSJRxs7Y6/9FDu3vtcquuCPHgZ9GiDYE7Ax+A8+jWz9Bd1yHQk4tq62yJ0VhqbafpEvjZkiEcvGyncTnSN3UjWAVPe4Jb58HnUZywN8zziHoQf9HQ+FVIYnHoWCUvl+PpL6S6xXwdeLCBP2ZnOJrx+d54p5nu4VSiIIOhKDb29cfK0aDeJUjgms8WfkbgMUUvRSSD37Mw2R/VxsLK9qDsP8NKpwnrgRgsX/h1X8e5ska6mpbrqWi0WaIdDUKdq+CG5SqUHWoMkt28AJ0xJMMx+ZabxRE7pXFRSelQHz78Eli27UB2dfiwiE2xpp358uKJwlREmWp9Kzqa3aLdfoLtTNMe1Bvym5ygVylBu3NRv8k8k0Irw5pFwypXWh9h5Q LFRiD2bl ZUl4On6Rm3/1Arv132aoUpArnfQtJn3I9qZQdTdNTWEUJHxlUzYCwOt+YyZIN0bBbMsR4IULZ7I9MLGK9hUkKw+mkoCi7sctyLnNGa0j5i+Tuy2Og4EZZWGtUr5sfUjiikbQvXllwUTFhoTaNYLbLxiogUx+YvBUJQ32D6hR6muWCRJI6gR0/YyfnDf55L6FrAfYs6wXW+9Y/oVKnwJuYB/K44QZD6lK+Oi80yBCTflwDXxePIDPtwp5u4w== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: scf_handler() is used as a SMP function call. This function is always invoked in IRQ-context even with forced-threading enabled. This function frees memory which not allowed on PREEMPT_RT because the locking underneath is using sleeping locks. Add a per-CPU scf_free_pool where each SMP functions adds its memory to be freed. This memory is then freed by scftorture_invoker() on each iteration. On the majority of invocations the number of items is less than five. If the thread sleeps/ gets delayed the number exceed 350 but did not reach 400 in testing. These were the spikes during testing. The bulk free of 64 pointers at once should improve the give-back if the list grows. The list size is ~1.3 items per invocations. Having one global scf_free_pool with one cleaning thread let the list grow to over 10.000 items with 32 CPUs (again, spikes not the average) especially if the CPU went to sleep. The per-CPU part looks like a good compromise. Reported-by: "Paul E. McKenney" Closes: https://lore.kernel.org/lkml/41619255-cdc2-4573-a360-7794fc3614f7@paulmck-laptop/ Signed-off-by: Sebastian Andrzej Siewior --- kernel/scftorture.c | 39 +++++++++++++++++++++++++++++++++++---- 1 file changed, 35 insertions(+), 4 deletions(-) diff --git a/kernel/scftorture.c b/kernel/scftorture.c index 555b3b10621fe..1268a91af5d88 100644 --- a/kernel/scftorture.c +++ b/kernel/scftorture.c @@ -97,6 +97,7 @@ struct scf_statistics { static struct scf_statistics *scf_stats_p; static struct task_struct *scf_torture_stats_task; static DEFINE_PER_CPU(long long, scf_invoked_count); +static DEFINE_PER_CPU(struct llist_head, scf_free_pool); // Data for random primitive selection #define SCF_PRIM_RESCHED 0 @@ -133,6 +134,7 @@ struct scf_check { bool scfc_wait; bool scfc_rpc; struct completion scfc_completion; + struct llist_node scf_node; }; // Use to wait for all threads to start. @@ -148,6 +150,31 @@ static DEFINE_TORTURE_RANDOM_PERCPU(scf_torture_rand); extern void resched_cpu(int cpu); // An alternative IPI vector. +static void scf_add_to_free_list(struct scf_check *scfcp) +{ + struct llist_head *pool; + unsigned int cpu; + + cpu = raw_smp_processor_id() % nthreads; + pool = &per_cpu(scf_free_pool, cpu); + llist_add(&scfcp->scf_node, pool); +} + +static void scf_cleanup_free_list(unsigned int cpu) +{ + struct llist_head *pool; + struct llist_node *node; + struct scf_check *scfcp; + + pool = &per_cpu(scf_free_pool, cpu); + node = llist_del_all(pool); + while (node) { + scfcp = llist_entry(node, struct scf_check, scf_node); + node = node->next; + kfree(scfcp); + } +} + // Print torture statistics. Caller must ensure serialization. static void scf_torture_stats_print(void) { @@ -296,7 +323,7 @@ static void scf_handler(void *scfc_in) if (scfcp->scfc_rpc) complete(&scfcp->scfc_completion); } else { - kfree(scfcp); + scf_add_to_free_list(scfcp); } } @@ -363,7 +390,7 @@ static void scftorture_invoke_one(struct scf_statistics *scfp, struct torture_ra scfp->n_single_wait_ofl++; else scfp->n_single_ofl++; - kfree(scfcp); + scf_add_to_free_list(scfcp); scfcp = NULL; } break; @@ -391,7 +418,7 @@ static void scftorture_invoke_one(struct scf_statistics *scfp, struct torture_ra preempt_disable(); } else { scfp->n_single_rpc_ofl++; - kfree(scfcp); + scf_add_to_free_list(scfcp); scfcp = NULL; } break; @@ -428,7 +455,7 @@ static void scftorture_invoke_one(struct scf_statistics *scfp, struct torture_ra pr_warn("%s: Memory-ordering failure, scfs_prim: %d.\n", __func__, scfsp->scfs_prim); atomic_inc(&n_mb_out_errs); // Leak rather than trash! } else { - kfree(scfcp); + scf_add_to_free_list(scfcp); } barrier(); // Prevent race-reduction compiler optimizations. } @@ -479,6 +506,8 @@ static int scftorture_invoker(void *arg) VERBOSE_SCFTORTOUT("scftorture_invoker %d started", scfp->cpu); do { + scf_cleanup_free_list(cpu); + scftorture_invoke_one(scfp, &rand); while (cpu_is_offline(cpu) && !torture_must_stop()) { schedule_timeout_interruptible(HZ / 5); @@ -538,6 +567,8 @@ static void scf_torture_cleanup(void) end: torture_cleanup_end(); + for (i = 0; i < nthreads; i++) + scf_cleanup_free_list(i); } static int __init scf_torture_init(void) From patchwork Thu Nov 7 15:27:36 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sebastian Andrzej Siewior X-Patchwork-Id: 13866635 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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id EAEB2D4336F for ; Thu, 7 Nov 2024 15:27:42 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 74E026B0085; Thu, 7 Nov 2024 10:27:42 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 6FEBC6B0088; Thu, 7 Nov 2024 10:27:42 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5C5D36B0089; Thu, 7 Nov 2024 10:27:42 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 3E00F6B0085 for ; Thu, 7 Nov 2024 10:27:42 -0500 (EST) Received: from smtpin28.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id EED60120871 for ; Thu, 7 Nov 2024 15:27:41 +0000 (UTC) X-FDA: 82759678386.28.6CF4F81 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by imf28.hostedemail.com (Postfix) with ESMTP id 45292C0021 for ; Thu, 7 Nov 2024 15:27:03 +0000 (UTC) Authentication-Results: imf28.hostedemail.com; dkim=pass header.d=linutronix.de header.s=2020 header.b=4gWnbb0J; dkim=pass header.d=linutronix.de header.s=2020e header.b=ZxTtCI6C; dmarc=pass (policy=none) header.from=linutronix.de; spf=pass (imf28.hostedemail.com: domain of bigeasy@linutronix.de designates 193.142.43.55 as permitted sender) smtp.mailfrom=bigeasy@linutronix.de ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1730993089; a=rsa-sha256; cv=none; b=nzhuXeGZ4KbaUG70q9gHLFj6RW1aSBiAD1ZWL4yYnf0hcDxpwlJ791BNVur/vKkd540yT/ JssqG9lB0Az4zwoYIoW+FU8x2YiltHUi1Ig227phVGphAkpzTnqVFYXS4E/o3STJDkg5cr 50ydbk52tg2NVtQsnyN3oQ2vqi7+w+s= ARC-Authentication-Results: i=1; imf28.hostedemail.com; dkim=pass header.d=linutronix.de header.s=2020 header.b=4gWnbb0J; dkim=pass header.d=linutronix.de header.s=2020e header.b=ZxTtCI6C; dmarc=pass (policy=none) header.from=linutronix.de; spf=pass (imf28.hostedemail.com: domain of bigeasy@linutronix.de designates 193.142.43.55 as permitted sender) smtp.mailfrom=bigeasy@linutronix.de ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1730993089; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=D9GAkp6axrm31ZMYGbMxCuOZ4EkrG3h1hb4DuwNIX7w=; b=Pcwjcyb3fZneXyWSHVubx6gnm8h1pFcJCh1g0hlaDXzObFlll46oUQQj9AFBxkMo4WcqYF wKpNqEdZjgXsqP2i4nY6OSqwKynfwG0AeKA5VjiQYS095i1wlW2G32kNiH81s22rhvj/Tz eQKuLPrrIcDy8NEchUtrxNz3s4i73GE= Date: Thu, 7 Nov 2024 16:27:36 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1730993257; h=from:from:reply-to:subject:subject: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=D9GAkp6axrm31ZMYGbMxCuOZ4EkrG3h1hb4DuwNIX7w=; b=4gWnbb0JPA6louZB7MhLxMUhWSLppTnsLQbINltZYCdkRoFvDAOb8+j8uG1uTAQ31JdCBw 8bq2UJJC8T03kvvs8d9RqMv7kYIY8H147SAnH7YP+jVL3eCAIFbzk2URYTOyr0nZc6cYKo AitVwZZe8xTdc9dIk7S/lbQnDuh1aDKS8uNBTInwEVbJ0r7mMDIznyADV1VSwmw1u/bVnY I2lprx7i6DVpgJ0dV+DcIs87c3MlalAbPOO/L3q1nD9qMM9CiTOj9ZvHyc0O1fbqKPjdVk uYLcT3kZz0zGuryquAThpQ3caFZsH2LksUvyBtOo7XUP5SLyCaaIiUPwTaGUhg== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1730993257; h=from:from:reply-to:subject:subject: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=D9GAkp6axrm31ZMYGbMxCuOZ4EkrG3h1hb4DuwNIX7w=; b=ZxTtCI6CCJFS73eVuWExDYOllEmHp7Pxsrcs7aU7TeuBaqEJUgzfINiHhmE64uY9O5/NXf 4Bbi4xp5gjVmDpDg== From: Sebastian Andrzej Siewior To: kasan-dev@googlegroups.com, linux-kernel@vger.kernel.org, linux-mm@kvack.org Cc: "Paul E. McKenney" , Boqun Feng , Marco Elver , Peter Zijlstra , Tomas Gleixner , Vlastimil Babka , akpm@linux-foundation.org, cl@linux.com, iamjoonsoo.kim@lge.com, longman@redhat.com, penberg@kernel.org, rientjes@google.com, sfr@canb.auug.org.au Subject: [PATCH v2 4/3] scftorture: Wait until scf_cleanup_handler() completes. Message-ID: <20241107152736.BJPBLXGO@linutronix.de> References: <20241107111821.3417762-1-bigeasy@linutronix.de> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20241107111821.3417762-1-bigeasy@linutronix.de> X-Stat-Signature: ixxfcsrppk8njmc48zbfz7ekecgn13rg X-Rspamd-Queue-Id: 45292C0021 X-Rspamd-Server: rspam08 X-Rspam-User: X-HE-Tag: 1730993223-862138 X-HE-Meta: U2FsdGVkX1/AW7LRVMx7lQS6pNs4oulgxh+zCLuMnwhjhCyXtqHOw3e0BMAGI4O6i1s/9hCB5MnAybbZIT5GoZ1uIj2e6muFVrtcFwSXcASkFQJkXzc1FPZiRnPn1Qm+IOsz9XPQrsFisdNs2AVYjXo2k2tQrCMdx4HsaugIiKxcfa/ul70HrXx1kUi+rCuvGhsVJwWZKmfuKmwyUutD31c/SfgKAOi7Jo3iNeY3OtgoMM5TRXX1PFGGtmV5C0Cfg6sJNg7v17vP6aXfyOR0Ey6+eBYbB8pjQO7e/Q6JCYbtbHz0AOuQG1eNKjhmTMq5SGErC73KbZEx12nvt8LsYixShXgM38ZztdXTM9teN5Kabm7uDvfxxpd028WA/s2HJduypTjU+tqZILHcjnqSFv2Fn6AwS+wK8iCo4IRiR7XZs8DhzQuNvJ5tDVifmmoqJbyB3o5BAXls9X/bfbz7KtnymRmJ7MaNMGO0iKYtPRaER5HQB+v0Nyp2lypXPpoN0VVyfJwuYdwYExVcfcD5xeOhcoq3iE8AcZHpc+HzQcK/U/MYmJxIDCVAU02sdVejj/JDPPs6K9p9GGc3DmcWlAkIFl7PReEGLSJYeDlUdgsI7u53ZqBgO7TTLyi3M8ExCVHCcwLE4pbi4PofPmsW1+sNib6a9OFWmb+L9Mo4hEQfA6eVZ9uoVFTmoPe7KSxt2qzLTPp8Jm8Ipp04CE1E8QwVERIHTltB65bJtvyAJ7m587pF55q5+xkSoxMJKz98plo1H6P8flagOhNTHC775UPdU4XdSLD2vCaJea/UHEvFV6LuEgkX8q3ZF6K61lQ8kG5c0URHyPhvp1hZlfm40eCCX0A/0QPFJ+/00iQMM1SO/7BegwAVQtFG9A2+RMKoq1C6tHvqLyuWhPGcQv3gMAwOoV7vqsCU0qJJLJzCWv8UZlFKy4QMujQfhKskSr7WPClBBWWtwPY4uWDizTt l4IsVEOe 9Au1n2VAbjLlEHW7viRWyAlcZ5t4QaiWK/ImHOQny7X4uneMqU6PBdfUx+tLMVM3bEpsIc1704BmBXepIeu6/zKxhdgNJVvpfRVHJrJNUS5B+M73vo8Oj2SEI4qvyfIxnNYQ3LPEKHbSM8PEyPGsZ/uMNLXoI+gFPqbItrO8RY81euCgBuWpJfhBvhMXpf630ygSB6Yn9iITgw0xDDf1Qp2K+FBcZ/7JDHGXBRo04VNgifS3kREhO6fMcwVJAoefxgLVkIvYPt3p24kWBnQJvSQmBJw== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: The smp_call_function() needs to be invoked with the wait flag set to wait until scf_cleanup_handler() is done. This ensures that all SMP function calls, that have been queued earlier, complete at this point. Signed-off-by: Sebastian Andrzej Siewior --- kernel/scftorture.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/scftorture.c b/kernel/scftorture.c index 1268a91af5d88..ee8831096c091 100644 --- a/kernel/scftorture.c +++ b/kernel/scftorture.c @@ -552,7 +552,7 @@ static void scf_torture_cleanup(void) torture_stop_kthread("scftorture_invoker", scf_stats_p[i].task); else goto end; - smp_call_function(scf_cleanup_handler, NULL, 0); + smp_call_function(scf_cleanup_handler, NULL, 1); torture_stop_kthread(scf_torture_stats, scf_torture_stats_task); scf_torture_stats_print(); // -After- the stats thread is stopped! kfree(scf_stats_p); // -After- the last stats print has completed!