From patchwork Mon Nov 4 10:50:52 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: 13861232 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 E5EA1D132AC for ; Mon, 4 Nov 2024 10:58:28 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 6B5A06B0088; Mon, 4 Nov 2024 05:58:28 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 665086B008A; Mon, 4 Nov 2024 05:58:28 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 52DC46B008C; Mon, 4 Nov 2024 05:58:28 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 373A56B0088 for ; Mon, 4 Nov 2024 05:58:28 -0500 (EST) Received: from smtpin15.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 4EE95406FD for ; Mon, 4 Nov 2024 10:51:07 +0000 (UTC) X-FDA: 82748094618.15.147CEC0 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by imf26.hostedemail.com (Postfix) with ESMTP id 8AB6714000D for ; Mon, 4 Nov 2024 10:50:41 +0000 (UTC) Authentication-Results: imf26.hostedemail.com; dkim=pass header.d=linutronix.de header.s=2020 header.b=bqSJbLly; dkim=pass header.d=linutronix.de header.s=2020e header.b=m8UVPQXo; 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=1730717417; 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=ktKI//sMmnnCjs54hJYaz5s5ts5YF9AmvSNM3G4N7f4=; b=o4zd+eVplU3brRes4F0Q00fjKT8BYX29FHSMlBXtJSkDyqMZmR0bTAJrdygiRF3f6Rpq2Q I9RRz4ccoJK1+iw3wzn3OUx9/nAPl7IKdYfJBMPh8U7VAHkLO1ru6BzDr29Y8C8bOo/2nS HTI99ZzK7kk67cC0fNx4FMmzmGhbDq8= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1730717417; a=rsa-sha256; cv=none; b=1Kjwh4WB+KSg9N5PM0UJ8M1vbvtQ6NutJXWMAQrU4lj78ttGT7NNUQ7EgeKbLMJiNszJF2 FNABLg/j1qLQ9/9oI/VkEPAFz8h3su4Nk6cBwgIEZhpprRsE7f/fH9kNUxhdX99dEOBrvc OjZzb4I4Y07ApMystesfW+mqr4DuO+A= ARC-Authentication-Results: i=1; imf26.hostedemail.com; dkim=pass header.d=linutronix.de header.s=2020 header.b=bqSJbLly; dkim=pass header.d=linutronix.de header.s=2020e header.b=m8UVPQXo; 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 From: Sebastian Andrzej Siewior DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1730717463; 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=ktKI//sMmnnCjs54hJYaz5s5ts5YF9AmvSNM3G4N7f4=; b=bqSJbLlylEQ2AcG6qDh3kEVWTHGus5P6fdfo3Jrlw4xmNNbnm4xzJICwI8aKw9mgkdy6eC PNT4RHu3ve/GNLutCIO+wHuBdEdnSPgb9t4YGWxXb4IKEhiLRtTxDI5AkPiyx6u7tYJs5J Amya4bviFotCVNltb4rQE9pfPy+NHyLzDM0ecLR2KmJEleJklq2Y4rqN8efsC4peNZrswZ OA3104g/Z6icuUhCawFpcORc0JBCH1Z8qsqCRzkjzprpzvv+oARYJ8TKPR9Zm/DLHRnFpJ VImRB7WxDIIv+zrNOUKnzVdnoPZnquOcihv0hevTweB8DcpiYOMFKtGMBZtorw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1730717463; 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=ktKI//sMmnnCjs54hJYaz5s5ts5YF9AmvSNM3G4N7f4=; b=m8UVPQXoc+16YCShWzyN8Fe07NpM+kXCd6OWtfkqM2d5/axty9p0fFzsP0yXXHo85GL0i3 R4jFWGF7jhrPunAw== To: "Paul E. McKenney" Cc: Boqun Feng , Vlastimil Babka , Marco Elver , linux-kernel@vger.kernel.org, kasan-dev@googlegroups.com, linux-mm@kvack.org, sfr@canb.auug.org.au, longman@redhat.com, cl@linux.com, penberg@kernel.org, rientjes@google.com, iamjoonsoo.kim@lge.com, akpm@linux-foundation.org, Tomas Gleixner , Peter Zijlstra , Sebastian Andrzej Siewior Subject: [PATCH 1/2] scftorture: Move memory allocation outside of preempt_disable region. Date: Mon, 4 Nov 2024 11:50:52 +0100 Message-ID: <20241104105053.2182833-1-bigeasy@linutronix.de> In-Reply-To: <88694240-1eea-4f4c-bb7b-80de25f252e7@paulmck-laptop> References: <88694240-1eea-4f4c-bb7b-80de25f252e7@paulmck-laptop> MIME-Version: 1.0 X-Stat-Signature: cytmzcpuowx1kr5w74up5u3o64axuuup X-Rspam-User: X-Rspamd-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4bLo+aCbQestVWB3FE3VeXCzOF/HwKWi+js40jvSNWHv2aiIPol0tNRwUGq0rc5CLIlYNPEAmIdOBOaIamxEc8A/5SOnbtqIpj96Iz18qKMHfDMvQStDpQXpQ74ibeF9kUmElGjoJyruGCX0n0YglHK+9VVVxQDNzQPbME/cQQ163oaJxiJs4iXLKm38PeB3+NCEquw+5tSvjtkPxGECWTGKfGd8eJ7Y4vImdDEsCUlizkFY= 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 44e83a6462647..e5546fe256329 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)) {