From patchwork Fri Nov 8 10:39:31 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: 13867916 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 77CD7D5E156 for ; Fri, 8 Nov 2024 10:42:28 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 1DA3A6B0096; Fri, 8 Nov 2024 05:42:27 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 09AEB6B009D; Fri, 8 Nov 2024 05:42:27 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id DC5D86B0099; Fri, 8 Nov 2024 05:42:26 -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 BA0296B0096 for ; Fri, 8 Nov 2024 05:42:26 -0500 (EST) Received: from smtpin10.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 7CA7F120B45 for ; Fri, 8 Nov 2024 10:42:26 +0000 (UTC) X-FDA: 82762587558.10.D42410A Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by imf18.hostedemail.com (Postfix) with ESMTP id 9A6CE1C000A for ; Fri, 8 Nov 2024 10:42:08 +0000 (UTC) Authentication-Results: imf18.hostedemail.com; dkim=pass header.d=linutronix.de header.s=2020 header.b="aHiJn/o/"; dkim=pass header.d=linutronix.de header.s=2020e header.b=JhRs5HBi; dmarc=pass (policy=none) header.from=linutronix.de; spf=pass (imf18.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=1731062419; a=rsa-sha256; cv=none; b=gsG/QRKpYF4LK8CajjbmN8oxMSOUYtiaJfq65SwJi3Vzl6q1pw7nhinAgEsWiI3HQQp5Np VcoScjClascEiRiuOoX0bZbfnbTFuUs4uD/poHUZs9tTUsAEfOVmV6ht4Woi2kZkhSDn6K 95ge9A6MCmddalsHA1Qld/o/PNE43bk= ARC-Authentication-Results: i=1; imf18.hostedemail.com; dkim=pass header.d=linutronix.de header.s=2020 header.b="aHiJn/o/"; dkim=pass header.d=linutronix.de header.s=2020e header.b=JhRs5HBi; dmarc=pass (policy=none) header.from=linutronix.de; spf=pass (imf18.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=1731062419; 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=CcYB5rXKKViOk7fZRL5jGg/tydDAGzhBkw56NFEZwc4=; b=OzIs3qY3fNN4gVZp/mcgaitWuDhYL6atbtxL2hVCweERjMiAbkzCGdaJm3My3yC9kuiueW cuGIWtrZAjVGKwn8NYve8HUrfvB1XLRV7oFavIL532xxxNlsoLVktekiGVOPUV/Wf0gZE3 GT+J/4ILjPBjteKuQjaYw2+G7s8yZww= From: Sebastian Andrzej Siewior DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1731062543; 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=CcYB5rXKKViOk7fZRL5jGg/tydDAGzhBkw56NFEZwc4=; b=aHiJn/o/+6onX0kCs8A1AF+dH4PkQZuCiqCHE9SqK55ncLjfpg1wXCj+mytiP4POXPWxIc LasvbEFflpW2QiawiJuNUBoYqo1LUSNMMCVWNe3HjnWCKBB74ZIQMT3QcqqtESkoTT5Svu pmnNyPkgjHw6sSu7gSRm/y0Yl422xMRqXizzfJSFS4t6H2wQ883iWHWoZQdRCYNVyZbcPL Y8bnx2oBAeXr6UTD5sFgH34hxBDtIlwRwtIAE3KjLB2td+B63DBzRDh9/8dp8+mGmXJTKf u8j9HEE/1HP71YQv3nRjyx9c6Q8bbr238ij/G1P8w+aAPZvsilvIpQ1Z7WEVsw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1731062543; 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=CcYB5rXKKViOk7fZRL5jGg/tydDAGzhBkw56NFEZwc4=; b=JhRs5HBiMYA0iJy0GGk0/CmAR2p7t7xPyc7Y9NrbJck2tkOJxhBw3tKEnOcV16A4OpkPAo kXbaprGbEnguLkCQ== 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 v3 1/4] scftorture: Avoid additional div operation. Date: Fri, 8 Nov 2024 11:39:31 +0100 Message-ID: <20241108104217.3759904-2-bigeasy@linutronix.de> In-Reply-To: <20241108104217.3759904-1-bigeasy@linutronix.de> References: <20241108104217.3759904-1-bigeasy@linutronix.de> MIME-Version: 1.0 X-Rspamd-Queue-Id: 9A6CE1C000A X-Stat-Signature: c6k1rbx5ehoerzctgg3rtgwcrifiowut X-Rspam-User: X-Rspamd-Server: rspam05 X-HE-Tag: 1731062528-766862 X-HE-Meta: U2FsdGVkX1/8+BrkWau58z8K4uie3f2DsNgCOGPtA554MWhsuLlH0fGMKmMc9faz3OIk6BPeYO3YXOD1yujQ2qZFvYxLvHC7zx43HJFK+n181+U6f1wXSriq6OdqyDLvRzCJEDN4e0hl3iaTEqoWl5vjT2xrclGQX5bk1h86WUJkjxXMOS0rQBZOAS6l8jPquU/jL08jUWoEfeaxsWLcp8yPfuEKJV+WiMAEmRJAGVhS1DTRXz/cifKj7m9XsORCv9N8753YXvyfF1eZChQCcKfBU5jW0Fx50fnhBQ/UtNHxC+4fhwbrgCQXhxnjt8cedqt7rLAZWeTFgtSu3ZROtTneRXUMSQ+a/nzqrLjZRgOeBVMj/0XhjZtIu1qrldjnVtdUYVhu9YNwOmwmKbo6MlmWOH6oopPkoD/hnjFDWIOT0DTF4JtBmPon4HSokuzPfAg3QeZQn+nvLBjcbqvR2Q202XUpt2WQRx5HwGkR/1YXJgUIUxeuhrmNtDcbxTSrHMWqZPEm34XBW9uHUgjFGh0WczZzjRv/G8iQG5P/hCAde4TxpaScxx/tHGbvNj7R77BBaPKFZuzPDHlK11MwlzS+K/4xCR2YjJwai68UKPpjMlxzJREtTtx6wQOKbEvxIWDg2VUSpzI0OVxb/2VACjelGxjA9WJ5ak5Tvlm4TGwoh71ztP8OQieJT7L8BF2YMKYXnw9j4gUUAvwCvRhv5vz75/qy9H0PtRVFPpo4FMlgm9Y59IhutLat9j7UUtmoGHyAnUVdKjUu1iNpAKC9y4YO8CraxiDi5RA2J2gyxUHBzSXO0JgW1puHN1TYhB+3pqlNzi0XzuRtSJ917FF9VapmS8FJQ+hc7sMlr8JxuWFl/rmZ/U4VMaeVJAg1jeQRUsOWKus72SbxfYWTYwa47/PjqbKQiYS9ulCnehRC1HXkErqHEUwJViiqIP335rn5xjiEad0LRQ7Wbp7yehw GVs6iiU8 gJ+zoNkb8xNPQ9CLNFmAEHH0gs2HEPD+D9qmQ288K934sVtroTjWvDK1xanpHyS+E3DRwh/u7lA6fiHcXggXjFtxhmF9i97toS9AeVhLgi05JKW43VMytnRd1qkKO+YsQhBpsH7ihBUclAL4lKBeBPjGgc3E78c9ouF0OVENMS3P2iVJ/cP7Oj03edCaI+nuOWj6K6ghj7kMvwHquVB7BgiC7T511ilZVQAchgkJK/PmhwiBqyrcnHGd0fw== 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. Tested-by: Paul E. McKenney 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 Fri Nov 8 10:39:32 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: 13867917 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 86D0AD5E157 for ; Fri, 8 Nov 2024 10:42:30 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 0782E6B00A0; Fri, 8 Nov 2024 05:42:28 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id E84806B009F; Fri, 8 Nov 2024 05:42:27 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id CD0F66B009D; Fri, 8 Nov 2024 05:42:27 -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 994D56B0099 for ; Fri, 8 Nov 2024 05:42:27 -0500 (EST) Received: from smtpin12.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 1DC1A1A0B79 for ; Fri, 8 Nov 2024 10:42:27 +0000 (UTC) X-FDA: 82762587684.12.F52850A Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by imf26.hostedemail.com (Postfix) with ESMTP id A865B140016 for ; Fri, 8 Nov 2024 10:41:57 +0000 (UTC) Authentication-Results: imf26.hostedemail.com; dkim=pass header.d=linutronix.de header.s=2020 header.b=hhcP8+Wo; dkim=pass header.d=linutronix.de header.s=2020e header.b=KFvBYwKh; spf=pass (imf26.hostedemail.com: domain of bigeasy@linutronix.de designates 193.142.43.55 as permitted sender) smtp.mailfrom=bigeasy@linutronix.de; dmarc=pass (policy=none) header.from=linutronix.de ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1731062318; 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=hZ7T3n9ji38bfDcEZMnrKQTiWeEv9uEaf9nIoN35Fps=; b=ELNDCcg2BD1K1bdIr1ddGGNEmrL8lnsjrVIBwlUzEuyNn5F7T72+J4TDazBz/mgRQosNpX C4RPL+P5n7vMbnIh1pvkoXNwkLcmK0SbsW9b/uETCC1ODS8xl7hVqA3apW5tms44MBXec6 P0caJHUIhvDNfWbbyoHFLO8noRommQ4= ARC-Authentication-Results: i=1; imf26.hostedemail.com; dkim=pass header.d=linutronix.de header.s=2020 header.b=hhcP8+Wo; dkim=pass header.d=linutronix.de header.s=2020e header.b=KFvBYwKh; spf=pass (imf26.hostedemail.com: domain of bigeasy@linutronix.de designates 193.142.43.55 as permitted sender) smtp.mailfrom=bigeasy@linutronix.de; dmarc=pass (policy=none) header.from=linutronix.de ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1731062318; a=rsa-sha256; cv=none; b=3JT5HxmcP/J079zuFv2UEvYqgj1iwcPdfqrmh+m1TF6jaHfxo4lhvCY6VetoTAnrlCNYjC QRZ4I4ecwJSlWt5Vl+Tk6Ukwv60KXbP2JqRO/hDdNFUlW2dTqR58HP4UCWBj6p6/kQFEj+ ybO9svhatR4/HAn0F8VHBCxBXLO4xro= From: Sebastian Andrzej Siewior DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1731062543; 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=hZ7T3n9ji38bfDcEZMnrKQTiWeEv9uEaf9nIoN35Fps=; b=hhcP8+WoqQYG//gIZ0hHGdOdSyU2yj6omU1f7N5TVMdwHq2GbxdOEikXD6YyWgpRoXeyiy dLlWDR8Mnb0SccFh//hL0bR+W6vDt+fSiWqO7IjsrNA9Mik/wvg0YoqaWNNZhVvEMuQX2w 3frFc2smwspd0i3FXDtJ5icHSdqxqc9zIlLPIuf7b0OmBAN3nmL/e1RearU3oZyaZ21muY kDYmRG5HpF9447N78GlGMvSlYTuHLO6b6pTL2fIjcZa9/hNcSOU2PX46X7XXtzWA6z0Voi Qs27evJIdEGul1EmaRMj8gaet8r1RlZS3qb6pnTF1iiheLiQLKsDwI6q3EYCCw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1731062543; 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=hZ7T3n9ji38bfDcEZMnrKQTiWeEv9uEaf9nIoN35Fps=; b=KFvBYwKhT7evOVi+BwnX0Mn/HduihryDoCDR9Lz7a5rjCyAy9P1BX5rp+JCGEycl5yXTZ3 4hHU0Jgn84MXGsBw== 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 v3 2/4] scftorture: Wait until scf_cleanup_handler() completes. Date: Fri, 8 Nov 2024 11:39:32 +0100 Message-ID: <20241108104217.3759904-3-bigeasy@linutronix.de> In-Reply-To: <20241108104217.3759904-1-bigeasy@linutronix.de> References: <20241108104217.3759904-1-bigeasy@linutronix.de> MIME-Version: 1.0 X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: A865B140016 X-Stat-Signature: zi9hei73t495kucpt6qzsndkege4yp34 X-Rspam-User: X-HE-Tag: 1731062517-213190 X-HE-Meta: U2FsdGVkX1/kr0fbeViL68s4rh8xneun3PXp89C7JR66+7ecjgGG5ZPMQ73S12ls0Um9EDPJs9vvdDTKfH6VnmA0s7RQHeSjpyrE/MlBUYeI3iHRKnCl/4jodEkEXC/U/NUCkkQEt8WxfHN+Jk1cKrYJfOLnm3g6gztzVsqi4Vi1ecgqkHavBWIa/CPM9JZEWggZSnUp5Rig9/7k2VJgssodgZXn14ilt6CrF5e9NCW/g4U4V9NZebat340KIWzRmVqpiDeApkTOspjkhxwckCNuKGJ/vE4yxZGt9FACKjS9qwEv4QybpN75V1w14ikpXE7S2yJmcVqpW70nwo4e5wDYoeKkyKDk2E7srxvkDlUnse8QScRCnlz9fJSLWzPSEf8uV5MtNbV6GSnWDUu5mYX89JkD406Hb/Kq0leyvWi57A6TvoTGrh5hb9DVolqWhzlF4rJWrVKyNYhbmJzvaRJjFVujZRt5eiaDaHfh7xVTsRv70n5ziEDnTrVPc9i7gQrOnBl1cLWfK06y8n4fAdd7SIwQr8YwhNcqrVVhxKGvuAG8Cp4+yQa/5Zi6CMV6DapN9fgcAXvjFE1F8l+GGPzAcZmvTBciZ5y+SAn7TlivIOEMTRnIjoF+fYI8mPVRmjrUEQbPPDuLmRpEPbwBRAXdONLXkGBfk1aE0oj/AqBR5BPLmL72KK6D6UfKO/6gJEs0HZDKhrX30DEiT8AUQlqix2xwP5TvxP1+aGv0gv5sxxte1v3PIPNZ3EHbn6gahfuBA98rJI9TjWYV4IGgw+GXErhakWRPeWS5vHDQwDYGWGjCA6VMjWaNaywV3oHLHwdMwmbWnoNLizXMTmgbCIHb5hrTjzbSxykeJwXasb7FaJsgG7nQsdNHAScGSihfX/oSAm1qOu6e/nkmyGdPQsRkUrBPUNUSkNf4SzGjGYtqvUzMevZNXKvy7p8ONwhkGQgcDaMRvm/9Ivg8B37 yxXFZ6Qm 1S5g0nHzKJzMXSApTqIn68rLfmtjBFEPaPiTFqgtWu5tLerBtxRNd3oVEGNUcwqfGvuj2rWET3g9ul1W2eY3wnWmDc9T/CFYsPgtj6+rSfEPxmF/HRaCyw9wV2EEAQOp4o7syVEK7a5t6tlmtrv9LHEYswAO5bFqpV/h315orKSIjxDqEuBHWkp6PyeGqoDmkEb6M4L4u20Kqkt+DnbHrii1fsoop9ULr1gmagexNnOQtKNWU44/DHTpYj1hWqJoPLD7NKf4Rc8oTziz64IJzt2ij23q+yJawioCk 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. Tested-by: Paul E. McKenney 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 455cbff35a1a2..654702f75c54b 100644 --- a/kernel/scftorture.c +++ b/kernel/scftorture.c @@ -523,7 +523,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! From patchwork Fri Nov 8 10:39:33 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: 13867918 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 23394D5E156 for ; Fri, 8 Nov 2024 10:42:33 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 3B0256B0099; Fri, 8 Nov 2024 05:42:28 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 312A96B009D; Fri, 8 Nov 2024 05:42:28 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 074EC6B009A; Fri, 8 Nov 2024 05:42:27 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id CF8846B0099 for ; Fri, 8 Nov 2024 05:42:27 -0500 (EST) Received: from smtpin08.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 78875140B79 for ; Fri, 8 Nov 2024 10:42:27 +0000 (UTC) X-FDA: 82762587096.08.1AB3E66 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by imf29.hostedemail.com (Postfix) with ESMTP id 3F05812001D for ; Fri, 8 Nov 2024 10:41:36 +0000 (UTC) Authentication-Results: imf29.hostedemail.com; dkim=pass header.d=linutronix.de header.s=2020 header.b=kM8bbPnu; dkim=pass header.d=linutronix.de header.s=2020e header.b=rKChvvll; dmarc=pass (policy=none) header.from=linutronix.de; spf=pass (imf29.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=1731062374; a=rsa-sha256; cv=none; b=zFac9n+NIFMxkHZyfMvh5YmCv0DfRD7F899OOHwUSmxTOFCMQCfs1+nnLV6uF3dbs6GEv4 XYEvLNk2P/vKxpvrzcF+95P7Fp7Y0nzFAo/2weruYCvuY9pAisRovUEfvz8vomYvmQ4nDj q0BPvVgMQ6qiLzrscby4tXQVCBqt/Q4= ARC-Authentication-Results: i=1; imf29.hostedemail.com; dkim=pass header.d=linutronix.de header.s=2020 header.b=kM8bbPnu; dkim=pass header.d=linutronix.de header.s=2020e header.b=rKChvvll; dmarc=pass (policy=none) header.from=linutronix.de; spf=pass (imf29.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=1731062374; 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=rPuXJvFylkEjsJn/hxrBzgh+RNHJWlCC5YCBuHj3y5U=; b=DFU/+4yqZnoTv38ZQIaLSI1gGfv1O+CeDBKWbo2VNdPc5XtgYkiNMWxcBafkw38x/ELExU 3MIaRGGyk+n6tCwTWMLHwK1ji6xDxkk1W1XEPZdK1xNnr2C8ePqLiugtX2nHLyuKhuHzM1 S4VTI3ENQdk8ZkB03833bPDOWN7eb4k= From: Sebastian Andrzej Siewior DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1731062544; 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=rPuXJvFylkEjsJn/hxrBzgh+RNHJWlCC5YCBuHj3y5U=; b=kM8bbPnufm7rZrkKjsXsZE0yKOyGiuiZ4C+yL7LJ1yWKIx/YdkQSuDCmdjbRW91ME5CD2H fxcdcTsdEcgRz8DSUt38kG0VDpFFk/lHtAPUuDaksn06IPihgPwwagqZoJbkOiE7/qZNlv QffE6A6AT3LOAopHbq/1AtNJtu8TPDq0S9YXx+kZkMp5YC32qqsZcwfWpnquL4DqAcrv2c 7WD46sCmUYEHSl6kLqHi0nmn1NziAglMGNNeP12h04KFRWebfze3o5Q9/NqiEK2xAo3FxD sh5uLzu6YHSGCmw7H4+NfxOj2xvGM61PZFBo7HI+AAri+19EPVhNGQVSYsS9+w== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1731062544; 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=rPuXJvFylkEjsJn/hxrBzgh+RNHJWlCC5YCBuHj3y5U=; b=rKChvvllSS+AA7SRc/2g+HuioD3b44nZ0BQwWt2Y6+ZFARiyQ7h1vvWHdDrsJ8n195Ta10 V18leTB7Ofvpa6CA== 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 v3 3/4] scftorture: Move memory allocation outside of preempt_disable region. Date: Fri, 8 Nov 2024 11:39:33 +0100 Message-ID: <20241108104217.3759904-4-bigeasy@linutronix.de> In-Reply-To: <20241108104217.3759904-1-bigeasy@linutronix.de> References: <20241108104217.3759904-1-bigeasy@linutronix.de> MIME-Version: 1.0 X-Stat-Signature: 68jsbfgt5jhbwrrcqqdzz5chf9t7kuri X-Rspamd-Queue-Id: 3F05812001D X-Rspamd-Server: rspam08 X-Rspam-User: X-HE-Tag: 1731062496-144003 X-HE-Meta: U2FsdGVkX1+vrxRX77ojIGo6F+1HG7argfDuDV1ghGyqdqqTmY9+7b+h1fTADquKVyTsQNTwYPkfDfuc+3bnzvDq/X0MmyoSitCSq0bJcyT4JFbcagp615Rrl6GD2j20hahO1b0bmCJrfEFdBEmmvsnTk/bdXawtKIvLQzv8LbEuOCrM1Uuv/ymsAaFZycXKNutDI3X8VGkNYOWcRLPvu5FnoFlxUx73pywFKT2BaC0ujyix9DE21xE9M8jiyoi9dVyWPeyRHjKjxgnsYb2FFTEJRE0CfHgmizYTrVRXa+VJjkADwR07jOdoUL7KGzmsr9hanReLrFXMgPGqQUsX8//MYFVXQGgVCkGAuHBHDH8UvH75FNoNzvLeaUQ/w9uZMQJg5kGYz22df4ESjO9ZVtWETmGqsB/yDZ/jZ6lMRNoru2kA2i4gYlnRu1oSof/LKSorDhho/O4b4SIax79z1QiNyUm+UEKgN8W4Secs5p2vVqcbBWz7RLKFFonH8l3DjLQNAWPyZpmeqlsPLoE1/Oi6ed7dUu0OMm+0Y27JA1DLrJPilGY6M9QTckooR5B7R1/nMy7wx3Wvl6MKPjPCr9c6EwqDrek0A/eXh9yTQPSIOW/7fAYwcQyh6+8T1cb38Ds6HC+p2k70DuZHvXER7zTqFC+zqHMnqPt5DTh3sEVE3wJ5zbTqQX/k3/966BSDw6m2F6DPi35/hP301U7c294wNAcgRu9y+k9T5tfCCPS7IgjtWRdrRE6GlBKMWmVq0GEC+M5jVCXv+cH50hsoHfaNl4q9wWY5ntqQgyQQhN1WBl+ggnsm4IFUbNa9BAdPrRszDDzQwwW4YDl2SXgz5jSwQ12LiASl7w89RCtDUAjUvbyur3CCEprFJoAURQ1GIwqh8yshwUm2jNXY+/bQdquwNCrJ877G4SvyRfaaxDClI0D8uMHagMCsXT3UslKPVS9zmUE4zxV37jaeS2B xXIIcWaS FOnHGaV4JwUmxNY7ztTSEtdIKbi6FzPFWXBoOebOZgwOVBI3vRmFPg+D1NuAf8Lu92LePNmfTj8367xEf0mB9WNJk4/mq+7YCDpAuncPvhmpbhoJxn5vt9K/63T7pRtHz6q6dz3zt616PiOP40ztZNeW99ZBHOZpP5z7c1+rsUlF+Fmd8VRmYGuQPpW6iTTuqv+emJLNSN+763UPXwgWwhMegIY98b0KLok5r7AMVGob7shMPtfsZayFYAEX+qO1PIubstd0lr790J2f9gxfeVJuXYAtPcGLB148M 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". Tested-by: Paul E. McKenney 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 654702f75c54b..e3c60f6dd5477 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 Fri Nov 8 10:39:34 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: 13867919 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 CC75ED5E157 for ; Fri, 8 Nov 2024 10:42:35 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id AFEB16B009A; Fri, 8 Nov 2024 05:42:28 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id A88426B009D; Fri, 8 Nov 2024 05:42:28 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8B2916B009F; Fri, 8 Nov 2024 05:42:28 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 6739E6B009A for ; Fri, 8 Nov 2024 05:42:28 -0500 (EST) Received: from smtpin27.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 15E66C01EC for ; Fri, 8 Nov 2024 10:42:28 +0000 (UTC) X-FDA: 82762587222.27.1C84244 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by imf04.hostedemail.com (Postfix) with ESMTP id B7C6A40011 for ; Fri, 8 Nov 2024 10:41:39 +0000 (UTC) Authentication-Results: imf04.hostedemail.com; dkim=pass header.d=linutronix.de header.s=2020 header.b=xdgOfCvu; dkim=pass header.d=linutronix.de header.s=2020e header.b="VHh+O/Et"; spf=pass (imf04.hostedemail.com: domain of bigeasy@linutronix.de designates 193.142.43.55 as permitted sender) smtp.mailfrom=bigeasy@linutronix.de; dmarc=pass (policy=none) header.from=linutronix.de ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1731062460; 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=5s/mGxOR1k0iGJwjIgx4Nn5xFVAEP6Fy1K6QavY6cWI=; b=tk9kNQ/KhDbcxkTjOZzQG93LroXrNKwxP6+4N+1pn118TvOx49ZuRQzNUIE0YtNWI9s9wj Qh9248uqqdS/y+OhiX8OapFzdUnv+kpbMkqrpMggznd+JZGAUGGwqZPadhcJfPhE7DyG9f fF2/10osNKmOGitt+h51X55lcdpj3FE= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1731062460; a=rsa-sha256; cv=none; b=DR5wOB51n7neaxm90YWTkYGkY2CXlw7zmhD8feg4yjOeGocMj7gSlkvhI4cer8PEpsMC6L A4o/Lii88AWYIgUqgk03HBBfu3iSlPK85Cb84WZWZ47je6WJaY0RVuubE8MRwI1jmiXWSU IapqAVydUzDcTEyoac1c2PFtBOY17dE= ARC-Authentication-Results: i=1; imf04.hostedemail.com; dkim=pass header.d=linutronix.de header.s=2020 header.b=xdgOfCvu; dkim=pass header.d=linutronix.de header.s=2020e header.b="VHh+O/Et"; spf=pass (imf04.hostedemail.com: domain of bigeasy@linutronix.de designates 193.142.43.55 as permitted sender) smtp.mailfrom=bigeasy@linutronix.de; dmarc=pass (policy=none) header.from=linutronix.de From: Sebastian Andrzej Siewior DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1731062544; 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=5s/mGxOR1k0iGJwjIgx4Nn5xFVAEP6Fy1K6QavY6cWI=; b=xdgOfCvuilQldzQOMpNfqbhLBJWQ8hWgfi7YAXGqIUVsXt8dH2HKhMMZK1UbFE9QY6fyIt Ndu0wL+sCgqAC/jf70Ab7g3JUc+RIBuysBK44EcaCDJDT6QpDFHGFZyaI9tYZrJRVNE0lH 1rvDfnBEtTP6crwTrkM2orUoU4mRhm015yD54+bkX+3gmce+fqFYPLFiSYlI4gn3V7gkBc X843XtQxebo2ejvgd4+2eT99hArk1xL+U1CP8B3rFM4QTQx9MG1wmepd/myNImYUo38nYr SB702ECMD7Wr1hbu4ix/ZGEtwoN9OAKQ5fZgPEdov9XmG257QZwRqDb8c9qcPQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1731062544; 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=5s/mGxOR1k0iGJwjIgx4Nn5xFVAEP6Fy1K6QavY6cWI=; b=VHh+O/EtWZ3A16mOSU7KTf672Jd4VxY+gi5vSUz+Zg2VvhVa/0tjSabgMacEJVyXoKHUPJ JWW3RE0D3a8cazBw== 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 v3 4/4] scftorture: Use a lock-less list to free memory. Date: Fri, 8 Nov 2024 11:39:34 +0100 Message-ID: <20241108104217.3759904-5-bigeasy@linutronix.de> In-Reply-To: <20241108104217.3759904-1-bigeasy@linutronix.de> References: <20241108104217.3759904-1-bigeasy@linutronix.de> MIME-Version: 1.0 X-Rspamd-Server: rspam10 X-Stat-Signature: w1epnty8misrng75c55ja66e7f4iqz8e X-Rspamd-Queue-Id: B7C6A40011 X-Rspam-User: X-HE-Tag: 1731062499-268809 X-HE-Meta: U2FsdGVkX1/b+b300mF4ROg/SrsYH6ocbwsC1uDr5ChwrdLS1FkOJ9Cv+silrUEfkHnO+9RcwNvIEz4QfwwXShCCbkKbVCdmyyJ+l7PQNCJhohpSR8n4vu/U5EQ6W9wOQLC+jdSY85B5Bf0TMR/xEWaB7UVmtf6dDjceeKaWSijCQY9Y1iT/vmr+eVZTmP+AtadpEl2M9H2FmaglQ5/Tpf2iBm4l7H0XWa9CYilBmkkdKVH7lCHWF5pNH6CL2lTD/b6GggVsJY4Wus85b9J1GYUjdpXcFYxRZmpkiClHv7lG9itj3pOIkYgI6i7DVUu0U/NKbYOlD3IZeUhz5r8denAFBJy/Jqpedp9uzHfSFKg357dja4YqfnrmS9fTWA2Ws1dwz7olSxW8HMVpNLxwjnZ42X4YCecv/GQRLAkQhkZiS/vrodTJCafmyIE1J0ebqboO7c2CUYO2JbrjFafGcbofstFPWh2qJZp2/VA8GpyozTZQgoL0tj7W3rjVgF7LGDWcM5QtRX4QvcDEUjWNHLi8ia2Ab/MJ9HeeYgKAvUwPhzwlpcwyAeSZRHMxThXbDkQKvEqbsuoU/mh5S9Nd+XBC5JVDYe7NiUm0vp3Lirg0KzPaX1lhVFPVFOfei9bg/G2thK5GoRSWbEfups4W8miEfagDDPa5mUbaXcTYcFV0W+i43dQQycjCWcxtdmZdbDyl1CdnVOcHaBCBa9+lkup2Z7v1VbDPW+nbqsjvhfc/g/RgAnf1dbHj0pR5e+T24FjsXK+XHlSEOCR5TYv0j+1hJ51ns7Qkp6ad9JdcNxw+YHOMSw83MN6J6sILEKtH5koSD1+LmNTEQh0PZCJexnntvpLzH6VE7J75ZHuLHjaJlShy03TcEa9tl2PcthzZhSNQJSdEMMmlu+sQkzHua6RSXa0Z588fljXH6leZdKH40wsSel1lB7iub9v/RoPj8dz3Q89LrqbGE8NtJ/v fWmaQkw2 th6DEFEzNEGlxN9szzyYgLbGoPP1OQZaSMEHpjJpCA/oEZKJimVorhwV0RjjNQB4yArfdIn46D9gomeML3VVzVQROodngChm9REKFytr+0xiP60cT4WK4TAKgOHxPBAOrkbX3oTt3BJ2Kf4aE9GMcbqzPuhZdVQJ8c8gTqCvVF18yIu47PgCK7N9WJsEDTWmR4kKpTrnhmqjGvGjV6OgslpD9DsIM9nozhC4pVOBLpr71C4eyFCHZDkfTvQ== 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/ Tested-by: Paul E. McKenney Signed-off-by: Sebastian Andrzej Siewior --- kernel/scftorture.c | 40 ++++++++++++++++++++++++++++++++++++---- 1 file changed, 36 insertions(+), 4 deletions(-) diff --git a/kernel/scftorture.c b/kernel/scftorture.c index e3c60f6dd5477..eeafd3fc16820 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); @@ -529,6 +558,9 @@ static void scf_torture_cleanup(void) kfree(scf_stats_p); // -After- the last stats print has completed! scf_stats_p = NULL; + for (i = 0; i < nr_cpu_ids; i++) + scf_cleanup_free_list(i); + if (atomic_read(&n_errs) || atomic_read(&n_mb_in_errs) || atomic_read(&n_mb_out_errs)) scftorture_print_module_parms("End of test: FAILURE"); else if (torture_onoff_failures())