From patchwork Tue May 28 14:13:41 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: 13676841 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 4DEFFC25B78 for ; Tue, 28 May 2024 14:13:49 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id AD1406B0095; Tue, 28 May 2024 10:13:48 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id A80866B0098; Tue, 28 May 2024 10:13:48 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 947C96B0099; Tue, 28 May 2024 10:13:48 -0400 (EDT) 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 765BA6B0095 for ; Tue, 28 May 2024 10:13:48 -0400 (EDT) Received: from smtpin25.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 257B91603CC for ; Tue, 28 May 2024 14:13:48 +0000 (UTC) X-FDA: 82167998136.25.F3CA59E Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by imf02.hostedemail.com (Postfix) with ESMTP id 4AFDF8000F for ; Tue, 28 May 2024 14:13:45 +0000 (UTC) Authentication-Results: imf02.hostedemail.com; dkim=pass header.d=linutronix.de header.s=2020 header.b=wFSLxzoB; dkim=pass header.d=linutronix.de header.s=2020e header.b="QP/pyYu1"; dmarc=pass (policy=none) header.from=linutronix.de; spf=pass (imf02.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=1716905625; 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-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=vTOgAjTKulp1YcH/LU4x95O4AvhUBSt+M3+DMT8WODI=; b=VK2QJZxdmcENbxJ0AjZeycI5zbgBk9IVlFKIvVN/j5XBzMlRVUXxyL/dJqXDU8rb2HL+Mr oRNMJZLy1lFywd6KcmWNc6MypzFVgIRHt47EEbmNByFTE0b/nxTS6s4/Tt8zz/ngQdnazt AzX+1x9k1EJMVBlrdL85thPnY1+1NCY= ARC-Authentication-Results: i=1; imf02.hostedemail.com; dkim=pass header.d=linutronix.de header.s=2020 header.b=wFSLxzoB; dkim=pass header.d=linutronix.de header.s=2020e header.b="QP/pyYu1"; dmarc=pass (policy=none) header.from=linutronix.de; spf=pass (imf02.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=1716905625; a=rsa-sha256; cv=none; b=tW5AWYc1szdRu95/lnSeZ9kaljdC4UxqjW/LZhITyjyZp2cIAeCKiVJdMn2fE/0g0Fnfkd FNRO1OTNk0pE5h3d17M/N9FUyJWpcpOqAd4Wu0MQZDElrqRMF2LHy+t8+tCet2C2/PxXhu HMaJCz8Z7s76/9/nIU8fdpfUMROkkfo= Date: Tue, 28 May 2024 16:13:41 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1716905623; 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=vTOgAjTKulp1YcH/LU4x95O4AvhUBSt+M3+DMT8WODI=; b=wFSLxzoBVfwAtCCftNneGnf1GCgI3etrzLApZhe+KVi6LYCS0Bh+V0msc0WPKEkanbNa+W WY8YiyKsCYMHgB9o8sSwPjki7Yc83Vd+kt0HwL6xw7BvzlDBru09I6gRkXwfEB8IumYjy/ 4hYOlMRkS4Q/f6P6xZTboAWt1bNKZ+hES9s+VkuKNi1blqLJoNnIuh8KLOOKzqlXpNwnV0 rGVxkaoNcXIHFo8J+/WvBAgx2FlzcoL7I/Cejd6Sm6hISTvFGcrFFFYkesIVKF6cLTyncq HEF1e1ecx3U9UgqxfogtdrjiGM9PAXRy1g7pHXiCEF/JhXXN1+LZAA2Yssacyg== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1716905623; 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=vTOgAjTKulp1YcH/LU4x95O4AvhUBSt+M3+DMT8WODI=; b=QP/pyYu1WTVN5VEjvoSr5awhkcFfSSc5ke5CgQ2wgvJ0vcdgW3vJKZQHLQPBKMm/rqjHlL PRb86YH1xWGdHRAA== From: Sebastian Andrzej Siewior To: "Vlastimil Babka (SUSE)" Cc: Shakeel Butt , Andrew Morton , Johannes Weiner , Michal Hocko , Roman Gushchin , Muchun Song , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Thomas Gleixner Subject: [PATCH v2] memcg: Remove the lockdep assert from __mod_objcg_mlstate(). Message-ID: <20240528141341.rz_rytN_@linutronix.de> References: <20240528121928.i-Gu7Jvg@linutronix.de> <09e085bb-f09e-4901-a2dd-a0b789bb8a4d@kernel.org> <20240528134027.OxDASsS3@linutronix.de> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Rspamd-Queue-Id: 4AFDF8000F X-Stat-Signature: ywbjkw5ct9edcz9ojwczu7xgggqcitfz X-Rspam-User: X-Rspamd-Server: rspam04 X-HE-Tag: 1716905625-597805 X-HE-Meta: U2FsdGVkX1+A5BWiuAEIteHT6Ac7+GpO6jLFIl2spz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EscTL06oJjKnpJny5HqNgBVV7huPu0rTE7FcwwuW4Qsj25yi1kUAY+5mZsI= 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 assert was introduced in the commit cited below as an insurance that the semantic is the same after the local_irq_save() has been removed and the function has been made static. The original requirement to disable interrupt was due the modification of per-CPU counters which require interrupts to be disabled because the counter update operation is not atomic and some of the counters are updated from interrupt context. All callers of __mod_objcg_mlstate() acquire a lock (memcg_stock.stock_lock) which disables interrupts on !PREEMPT_RT and the lockdep assert is satisfied. On PREEMPT_RT the interrupts are not disabled and the assert triggers. The safety of the counter update is already ensured by VM_WARN_ON_IRQS_ENABLED() which is part of __mod_memcg_lruvec_state() and does not require yet another check. Remove the lockdep assert from __mod_objcg_mlstate(). Fixes: 91882c1617c15 ("memcg: simple cleanup of stats update functions") Link: https://lore.kernel.org/r/20240528121928.i-Gu7Jvg@linutronix.de Signed-off-by: Sebastian Andrzej Siewior Acked-by: Vlastimil Babka Acked-by: Shakeel Butt Acked-by: Michal Hocko --- On 2024-05-28 15:44:51 [+0200], Vlastimil Babka (SUSE) wrote: > I think just s/memcg_stats_lock()/__mod_memcg_lruvec_state()/ in your > phrasing, since we are removing the lockdep assert from path that calls > __mod_memcg_lruvec_state() and not memcg_stats_lock()? > Or am I missing something? Yeah, makes sense. mm/memcontrol.c | 2 -- 1 file changed, 2 deletions(-) --- a/mm/memcontrol.c +++ b/mm/memcontrol.c @@ -3147,8 +3147,6 @@ static inline void __mod_objcg_mlstate(s struct mem_cgroup *memcg; struct lruvec *lruvec; - lockdep_assert_irqs_disabled(); - rcu_read_lock(); memcg = obj_cgroup_memcg(objcg); lruvec = mem_cgroup_lruvec(memcg, pgdat);