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: fu6oumyh97u4dg81yfghwj6dzp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RkyqNPuLlfImwITkuGDDoH2aQQ/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)) {