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-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3vRmFPg+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)) {