From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out-172.mta0.migadu.com (out-172.mta0.migadu.com [91.218.175.172]) (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 D6E4821FF30 for ; Tue, 11 Nov 2025 08:36:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1762850201; cv=none; b=eQv5+Iz1RsnltCfYjw0vEUvTQSCNa6T7iPXWLt2rvmhW0B4kA1/rKy45AADlD8Pc04ERyS8yp7XC/B2XD8UI12SUXj89ib1856hOFbtTXYFl2nlDOKWCmal2B4FOm4lBe0ouJet3xomjuckQPlOezMtVoUDC0TNIyD5mjJWcRZc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1762850201; c=relaxed/simple; bh=cS8osK4BzNveAQJzepJcDWiGlSaOD1CHuN9fiKEnKQI=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=hrXZjQexEDs4dtkiQy7FSPnfMN9MBVlhnWeQ0mSCf690CB8crOwzkf3Qax+ych6INCpwOQnWT7Si7SFP/e7Vq+TPFmjSQu4vnVDI+JgUou2LQn84GTIxQAP2TmKu2QryIZBmmznhu33vykxIYAFpdo4hwOKggjSXCxhYvVvK0H8= 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=lyd9yXcK; arc=none smtp.client-ip=91.218.175.172 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="lyd9yXcK" Message-ID: <0618ea79-fed3-4d4d-9573-2be49de728cf@linux.dev> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1762850183; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=oYW7uwo5YmrbKTsOhY6HR/nNpnR25sBnCicgt/mIAYI=; b=lyd9yXcKgVyy5ObtM77OrHWo0Dxr+4i4HTrXVudYHhVkwnMGRUPM/IbZOc1d9CnGGgLNJ0 ioIhGiUkn5YLIwJs1ZXguIXPhWyXOZte/exkLOwZ35rlxE9hDZ4mkej6SQDbTXei3S78nV BRjknCA95GHxC8ux0HjhPJGdOqZ2vqM= Date: Tue, 11 Nov 2025 16:36:14 +0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Subject: Re: [PATCH 0/4] memcg: cleanup the memcg stats interfaces To: Shakeel Butt Cc: Johannes Weiner , Michal Hocko , Roman Gushchin , Muchun Song , Harry Yoo , Vlastimil Babka , linux-mm@kvack.org, cgroups@vger.kernel.org, linux-kernel@vger.kernel.org, Meta kernel team , Andrew Morton References: <20251110232008.1352063-1-shakeel.butt@linux.dev> X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Qi Zheng In-Reply-To: <20251110232008.1352063-1-shakeel.butt@linux.dev> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Migadu-Flow: FLOW_OUT Hi Shakeel, On 11/11/25 7:20 AM, Shakeel Butt wrote: > The memcg stats are safe against irq (and nmi) context and thus does not > require disabling irqs. However for some stats which are also maintained > at node level, it is using irq unsafe interface and thus requiring the > users to still disables irqs or use interfaces which explicitly disables > irqs. Let's move memcg code to use irq safe node level stats function > which is already optimized for architectures with HAVE_CMPXCHG_LOCAL > (all major ones), so there will not be any performance penalty for its > usage. Generally, places that call __mod_lruvec_state() also call __mod_zone_page_state(), and it also has the corresponding optimized version (mod_zone_page_state()). It seems necessary to clean that up as well, so that those disabling-IRQs that are only used for updating vmstat can be removed. Thanks, Qi > > Shakeel Butt (4): > memcg: use mod_node_page_state to update stats > memcg: remove __mod_lruvec_kmem_state > memcg: remove __mod_lruvec_state > memcg: remove __lruvec_stat_mod_folio > > include/linux/memcontrol.h | 28 ++++------------------ > include/linux/mm_inline.h | 2 +- > include/linux/vmstat.h | 48 ++------------------------------------ > mm/filemap.c | 20 ++++++++-------- > mm/huge_memory.c | 4 ++-- > mm/khugepaged.c | 8 +++---- > mm/memcontrol.c | 20 ++++++++-------- > mm/migrate.c | 20 ++++++++-------- > mm/page-writeback.c | 2 +- > mm/rmap.c | 4 ++-- > mm/shmem.c | 6 ++--- > mm/vmscan.c | 4 ++-- > mm/workingset.c | 2 +- > 13 files changed, 53 insertions(+), 115 deletions(-) >