Received: by 2002:a05:6500:1b8f:b0:1fa:5c73:8e2d with SMTP id df15csp25870lqb; Tue, 28 May 2024 08:00:39 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXdkR45ZYrDODGgEQ0QvZeK7s7XnxhtwQ4rj8AGvk1UAV8NDnKMQoEZZNWHxbN4JVxX6JJ0uwf5YxSX1GCvlgovkHf54xVDzDfRz4ao7Q== X-Google-Smtp-Source: AGHT+IG5Qr7t8G8JnF6Z4Qy1I2eDt7lq1mJwrn20PPjuWgzVIhDYkoaSAkCGiZR8sZZ0fegGrm6j X-Received: by 2002:a0c:f802:0:b0:6ad:5ae7:e596 with SMTP id 6a1803df08f44-6ad5ae7e8f8mr143338846d6.31.1716908439372; Tue, 28 May 2024 08:00:39 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716908439; cv=pass; d=google.com; s=arc-20160816; b=rU7qmBpwBlaqABQQYg4nNe5uMuoaI07Xce2IgtQPjj+uXn0I5P27T5MppZ4NIBKnwm htRIPf4wlGtQ/1q2eiR7PpTtghmurpvoXqwsIdyROkY5THl/3lZZ+nyxhRvkqhRB9sv6 LO0/RIsTu2Xc7IINtgFQd8SLPQMbeOnr5W1/4c1qqeAut8OHXShpJyIPV1wZrzOW1+eU FOFBGXG3d1RCUu1M/c+qXZJ1RFc8uX00x/p6nLC2btHPA9j/wUapnTU/e2pvvcUZNFfh 0NfOxNcYKl7k6p67sSJSbkGf4xuh+tDRX7WnXkZyp+3XPKArD7XpPgB8hYGiDdMHQ9xg eXyA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=8ELpKrf3yGg/U1k60rinfhuNPqARS7v2TuZgtOoQ2sk=; fh=UTwFoNoRPs5fVM5t32PDjtFy+0Je/E62EGomTFLzp10=; b=VVDwE8oXj+jbMi1zTLAviQr0bTA9xfQqvPQmPhQxZlLhZLTAVMW+YYS9hnQBnduUV8 jU1kq5MUruAl1MKeEcGLDL4SpgRqmSszPFP2NEWj7/Za5D4+RxEBfr3jgUcz0Kt2rEBc Qy2SU6qT5P8NibegYwDL/ej516SDX6TMe9b7yZbTPEFN/2TMM1OidTGSr9OyPXnXhe1V 93Aa3EAOseQ1IvZXj3121T5eJfYuybl2cxD3eNxbiBnKgMm+9/4mMR6g005uUvjcQ7qH 7vhcPv4C15IG0OUwZ7z714yOCHD0YgxjF17k6f+XdCE5P4q4IgSLVNWo2wkFZ5I00D1K cd3w==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=NlGiyNP2; arc=pass (i=1 spf=pass spfdomain=linux.dev dkim=pass dkdomain=linux.dev dmarc=pass fromdomain=linux.dev); spf=pass (google.com: domain of linux-kernel+bounces-192584-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-192584-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id 6a1803df08f44-6ac11428481si106253926d6.318.2024.05.28.08.00.39 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 May 2024 08:00:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-192584-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=NlGiyNP2; arc=pass (i=1 spf=pass spfdomain=linux.dev dkim=pass dkdomain=linux.dev dmarc=pass fromdomain=linux.dev); spf=pass (google.com: domain of linux-kernel+bounces-192584-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-192584-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev 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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 1D0E41C22B9C for ; Tue, 28 May 2024 15:00:39 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4B7CD170835; Tue, 28 May 2024 15:00:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="NlGiyNP2" Received: from out-183.mta0.migadu.com (out-183.mta0.migadu.com [91.218.175.183]) (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 B69EA1667C5 for ; Tue, 28 May 2024 15:00:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.183 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716908406; cv=none; b=Nn+jeMWxWivWUzzKDc0w9sNBXlyNEMXuTvyNrvNqpilwX/xFmiNqbzTfGtZkHAhlaoRLkB1zG39Hw6qbDwg4ABqU9taDR2GTbbVII9nQ4cIiAHPCDnF36AxCr1kyCTwv70pVKAPC26VOEG+cmCI5IJW2azBBAnAP/A6J3MXHlXU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716908406; c=relaxed/simple; bh=/AmBie/cpg2EO4euYtI9iMGd1p4j1CSfgwVjth6e9rc=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=FDgwQmfc0x1iFYIYCYRRDNqDpAAhiu2H6+2JmFr/wPk5yMkGvB0DDuo/47JIkBUd8uMrL4UqR2lhs47r/mX6GRnkCBZt6KvhhtqZbR5RgaX/byzEWHt0DUptUaAo+mOJ4dRfwIpL7Ba2AT1j9norBDtZ5Y5AQNj6atNH/RZMgKs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=NlGiyNP2; arc=none smtp.client-ip=91.218.175.183 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev X-Envelope-To: bigeasy@linutronix.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1716908402; 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=8ELpKrf3yGg/U1k60rinfhuNPqARS7v2TuZgtOoQ2sk=; b=NlGiyNP284ZecaX4V/B7HHJ/PIVBiPiBRiayMqi2qcwUHFR9EdHinOz8+C5Z+LPXhLLXMu 285nXeDPZG4Gt0zR/nRSQ/U339mugT/puBl7oUtFcKyWYLS1cx9Q6nEl3M+VyrDg5Uzt/N uq7h4aoNm0kyf+CbSWmRhYmCjRl2qhQ= X-Envelope-To: vbabka@kernel.org X-Envelope-To: akpm@linux-foundation.org X-Envelope-To: hannes@cmpxchg.org X-Envelope-To: mhocko@kernel.org X-Envelope-To: roman.gushchin@linux.dev X-Envelope-To: muchun.song@linux.dev X-Envelope-To: linux-mm@kvack.org X-Envelope-To: linux-kernel@vger.kernel.org X-Envelope-To: tglx@linutronix.de Date: Tue, 28 May 2024 07:59:57 -0700 X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Shakeel Butt To: Sebastian Andrzej Siewior Cc: "Vlastimil Babka (SUSE)" , Andrew Morton , Johannes Weiner , Michal Hocko , Roman Gushchin , Muchun Song , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Thomas Gleixner Subject: Re: [PATCH v2] memcg: Remove the lockdep assert from __mod_objcg_mlstate(). Message-ID: References: <20240528121928.i-Gu7Jvg@linutronix.de> <09e085bb-f09e-4901-a2dd-a0b789bb8a4d@kernel.org> <20240528134027.OxDASsS3@linutronix.de> <20240528141341.rz_rytN_@linutronix.de> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240528141341.rz_rytN_@linutronix.de> X-Migadu-Flow: FLOW_OUT 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? > > 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);