Received: by 2002:a05:6500:1b8f:b0:1fa:5c73:8e2d with SMTP id df15csp34343lqb; Tue, 28 May 2024 08:10:17 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWst7N88GWa45lU/3PHdw+Og7vRq/RyG9kE3F116qplyllAQ1FVf5Z0XSoywFVxW88u/FKtgvtVKqtNQSRlaYagZp0lsYuetyFlXAiZkg== X-Google-Smtp-Source: AGHT+IEViPLvbjpXN0svdGFxHp+lc2sh8ng2opoPZxDhI0ZTrGsZXe4BwlT7RdjRSmScD6OsS8RE X-Received: by 2002:a17:90a:c290:b0:2c0:17b4:858c with SMTP id 98e67ed59e1d1-2c017b48783mr1226658a91.43.1716909016757; Tue, 28 May 2024 08:10:16 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716909016; cv=pass; d=google.com; s=arc-20160816; b=NBTMgwuhtNIbzE2z3Fhtl0xum9wnUTZqscn1jIGv77jV4qK2Hl2S97hCEm/48A5C8R W4btQABNmme53gJPH9IUcFthfZGpBuXVIyyfu8BOLkoivYzewfctF67h1uv+MOaL+PZF gCUX4Ercf+AdwGFDpz14eaoyBsInS8NBfud+YtTujTGEAxVVIso/nRLnCf8JmLeQBrwv lxBGWkV5YETCorDSYnsX6NrJKZy+nwzqKzebBIpfJv41yObLYFX018+ZAWhiH+4ymOf1 YImbheURQzTG2oT6T5+wynP3qdokDSyMlto74AHdjKjyRw/BmKUgmcWWlv6yWbVq9kRt l3MQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature; bh=gl44w8amPY2vCrtwVn4ELMDZoB94VVs4vwr86NOVyWg=; fh=yjsQRF4Bf8LtJ4xKHPLcczUEoGpulXP6kYsomycV4dQ=; b=kmSqtMg+dnJBdxFYZuz1NTG+7DLic08W2LdcheFgoDA8HVqH2yw37ohZ8xUZzbMpd6 egAl2Gb6i/scEDF3U6lJ57FJpeBbesr93+16u1yesGQKGZdGIYhTh/CNCVwDGeNgouWu mJ7NMAsSx4p2zLDBcEAIijp1xuQglOEqsfRrYHdxhd29vIal7A+Znnk3KjYhJEH0QKcR eQz/I90ck1TE6pmiD7uLD8sRgBFzVhvMWvKq4IoWKD6qawUO6WJ593LJACgHgZqdO47F HeUANsLpqpJbS1Q5RGARNk+GgYjgBuCaB0qbVCdYYdmBB8LjAY4eMLtER3+ZtPUYHheb MRWw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=s12TwydI; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-192615-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-192615-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id 98e67ed59e1d1-2bf73883b39si7324037a91.132.2024.05.28.08.10.16 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 May 2024 08:10:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-192615-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=s12TwydI; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-192615-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-192615-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id C7D3D285625 for ; Tue, 28 May 2024 15:09:40 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E1DF2172BCC; Tue, 28 May 2024 15:07:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="s12TwydI" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 18CA4172BC3 for ; Tue, 28 May 2024 15:07:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716908831; cv=none; b=kMgR9Y8PNpy33OdN2DJHMJ5YroLzZsvfO5PLH7Ab+weRVuRosKK/gFsD2gPD8wHrb50luCpZ99l9DJgDbcQxMStylH3V4Gq09PNwloZgPGXaMRzHtKEtGyiBR1EcEuhg05MP2ZFewZdhRIYCpBDC9f2JHRffuTG8pjeC35l87IY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716908831; c=relaxed/simple; bh=bqgQfeocbpfMkksERSp1895rbSELWnveQUM/jhUVweo=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=WGixf7xGTPyjLhlJvAkL6WhywOBFBKwvZFib/9b2CepuTTic45qb7sgSCn+MW4WnKtFf+ZYpG86PRGBvWah45gXq3jp/zYuVYary+srOorERyg5AKP03x3RD6mE3/F+BwkZJAV5a6ljTsn8ga0+jyRaV2OLh/z7aLteGEZm+wv4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=s12TwydI; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id B6B7FC3277B; Tue, 28 May 2024 15:07:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1716908830; bh=bqgQfeocbpfMkksERSp1895rbSELWnveQUM/jhUVweo=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=s12TwydIpV3sydIr3BalADafyre2uwqbeoAJwzzEqfFVBnyyGSji1U01f5Ny3JVOE 1MtRs0lS+M1T3TilgAt3O5BT9LHmV6dn4TAIo5mRNygL49bnm76NcbLOGPup9O5Foi 5Cl9qisZDzB1ONtLmQNyPSXwHzCGG7Blt7JMwICkxNEI9bQbYpn8p7OWIQh+11/J8r tTnSyuuJWDi4fwNPRzLKKNedf9w1ivSOLNqgNoorCGHMjs+hv1f9QPdae1SLUN0b+J CXDJ+TI7OQP9vc9WdokuBFf7mJBdKZzhrEvU9WZAhezrRUA9N3cs51b75KTeSpGIwR 2QK9/PNqpxJyQ== Message-ID: <897354c6-764b-4f3f-9ece-2feafb0222e9@kernel.org> Date: Tue, 28 May 2024 17:07:06 +0200 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v2] memcg: Remove the lockdep assert from __mod_objcg_mlstate(). Content-Language: en-US To: Shakeel Butt , Sebastian Andrzej Siewior Cc: Andrew Morton , Johannes Weiner , Michal Hocko , Roman Gushchin , Muchun Song , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Thomas Gleixner References: <20240528121928.i-Gu7Jvg@linutronix.de> <09e085bb-f09e-4901-a2dd-a0b789bb8a4d@kernel.org> <20240528134027.OxDASsS3@linutronix.de> <20240528141341.rz_rytN_@linutronix.de> From: "Vlastimil Babka (SUSE)" In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On 5/28/24 4:59 PM, Shakeel Butt wrote: > On Tue, May 28, 2024 at 04:13:41PM GMT, Sebastian Andrzej Siewior wrote: >> 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. > > One question on VM_WARN_ON_IRQS_ENABLED() in __mod_memcg_lruvec_state(). > On a PREEMPT_RT kernel with CONFIG_DEBUG_VM, will that > VM_WARN_ON_IRQS_ENABLED() cause a splat or VM_WARN_ON_IRQS_ENABLED is > special on PREEMPT_RT kernels? It only does something with CONFIG_DEBUG_VM_IRQSOFF and that's disabled by dependencies on PREEMPT_RT :) >> >> 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 >> --- >> 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);