From patchwork Fri Feb 25 23:01:47 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sebastian Andrzej Siewior X-Patchwork-Id: 12761073 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 EA709C433EF for ; Fri, 25 Feb 2022 23:05:25 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 631A08D0003; Fri, 25 Feb 2022 18:05:25 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 5B7AB8D0001; Fri, 25 Feb 2022 18:05:25 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4599F8D0003; Fri, 25 Feb 2022 18:05:25 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (relay.hostedemail.com [64.99.140.25]) by kanga.kvack.org (Postfix) with ESMTP id 365418D0001 for ; Fri, 25 Feb 2022 18:05:25 -0500 (EST) Received: from smtpin04.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 0860622723 for ; Fri, 25 Feb 2022 23:05:25 +0000 (UTC) X-FDA: 79182835410.04.26085E0 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by imf03.hostedemail.com (Postfix) with ESMTP id CF0DE23402 for ; Fri, 25 Feb 2022 23:01:53 +0000 (UTC) Date: Sat, 26 Feb 2022 00:01:47 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1645830109; 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=eLa2DAYUTcrHbqT9bu1hfoW/mNp9mXnBGQU+a1wSrFo=; b=HhsLwetpyGJFs2/zxUDRAIa9PNAY1BbeDq4Evc1MkFnyHxdsK9dPIGZ5i5aOL/PMFUKjcf xD98AWfMqYC4sVIM0nS2UWlgfRWFUBXx1ZiXNhbpk/zgbnSh2R1Z4uxpaqPorZdUW3xZLe 5pZ5qdjKjGXuC8DcSaZFPEI6x30V3gqq1W7ACNSKObCrRYztOR4Nc/5oQFb/0Xy08JfL9r tGNADO9A++ZGKr3o27100KF1QLAqfdpLFTqKFaIfU/qwkTmyifIjzGlhCe7BK7fKUvChM4 giy/Z1CmicL/cNNwdvrLbIVN0Ik56EGLc61frE66jHcxamyBurt3hhZWjsY1fA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1645830109; 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=eLa2DAYUTcrHbqT9bu1hfoW/mNp9mXnBGQU+a1wSrFo=; b=AsKrXs5arxs4uQjRegtTn8SRZAH3B1ZW9zg7LO4+o3PsHyiYRVcHitgVNhuY9ybY7Cuu9a OiRIivkR/0QEkzCg== From: Sebastian Andrzej Siewior To: Shakeel Butt Cc: Cgroups , Linux MM , Andrew Morton , Johannes Weiner , Michal Hocko , Michal =?utf-8?q?Koutn=C3=BD?= , Peter Zijlstra , Thomas Gleixner , Vladimir Davydov , Waiman Long , Roman Gushchin Subject: [PATCH] mm/memcg: Only perform the debug checks on !PREEMPT_RT Message-ID: References: <20220221182540.380526-1-bigeasy@linutronix.de> <20220221182540.380526-4-bigeasy@linutronix.de> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Rspamd-Queue-Id: CF0DE23402 X-Stat-Signature: rsqd9csc5w9jsmijbjnqq9xrs54rbk7e Authentication-Results: imf03.hostedemail.com; dkim=pass header.d=linutronix.de header.s=2020 header.b=HhsLwetp; dkim=pass header.d=linutronix.de header.s=2020e header.b=AsKrXs5a; spf=pass (imf03.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 X-Rspam-User: X-Rspamd-Server: rspam08 X-HE-Tag: 1645830113-241210 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: On PREEMPT_RT interrupts and preemption is always enabled. The locking function __memcg_stats_lock() always disabled preemptions. The recently added checks need to performed only on !PREEMPT_RT where preemption and disabled interrupts are used. Please fold into: "Protect per-CPU counter by disabling preemption on PREEMPT_RT" Signed-off-by: Sebastian Andrzej Siewior --- Andrew, if this getting to confused at some point, I can fold it myself and repost the whole lot. Whatever works best for your. mm/memcontrol.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/memcontrol.c b/mm/memcontrol.c index 73832cd1e9da4..63287fd03250b 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c @@ -741,7 +741,7 @@ void __mod_memcg_lruvec_state(struct lruvec *lruvec, enum node_stat_item idx, * interrupt context while other caller need to have disabled interrupt. */ __memcg_stats_lock(); - if (IS_ENABLED(CONFIG_DEBUG_VM)) { + if (IS_ENABLED(CONFIG_DEBUG_VM) && !IS_ENABLED(CONFIG_PREEMPT_RT)) { switch (idx) { case NR_ANON_MAPPED: case NR_FILE_MAPPED: