From mboxrd@z Thu Jan 1 00:00:00 1970 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 AB47A350D76; Fri, 21 Nov 2025 13:59:26 +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=1763733566; cv=none; b=DhfeVPPOmcJngqP0avN/43f5G/q3AlOXyquQ/gd7OB4STtytirYkhw+vPBmOjJE1nNLD8WI/atZLgqbFf7jQ0kNHcWf6CfVQdkoy4mKjhKq82phnlD9FeCAJbsuyIob4awCyXHkOgzQ6BDNRiwWv4P8bZ2zCnnTEe/drLOfjTjg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763733566; c=relaxed/simple; bh=CGrjZB5x1IF6y2TQyeOAgGrRUcKNcz9DOM36rTb9qGw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=YQZQJWJzKN3Gi1hm6BTPZGZb3zgbRb7ErArzpiK63l3oZVwrBLRerD7yf5QTci7gZvEur3vQle2fZfTXICez58ePd/gP4NH2a38hruSCaQqQFRqHGfE2BDDaeIZ3g/WtMaAQfFYppHaJ/ybeD6Lv2viH7XQBNxuMZAOO1gHBkmI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=uFW4SvZh; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="uFW4SvZh" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 00651C4CEF1; Fri, 21 Nov 2025 13:59:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1763733566; bh=CGrjZB5x1IF6y2TQyeOAgGrRUcKNcz9DOM36rTb9qGw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uFW4SvZh//1UNARG8agW4aAcHSNXaiXjRfjsWe8qaAisnrmxXfFjOn77zgPoW3uGF gy/jbdi9PFPtKW5V4hZMIqA7ZMlFUpq+anItpofI5PnX0dZhiwquh+RE5gpl7IM9rF mDPLGZpb0waWjoDvBnn5qR1cTA52RlBDIXDwDScc= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Nhat Pham , Domenico Cerasuolo , Bagas Sanjaya , Yosry Ahmed , Chris Li , Dan Streetman , Johannes Weiner , Michal Hocko , Muchun Song , Roman Gushchin , Seth Jennings , Shakeel Butt , Shuah Khan , Vitaly Wool , Andrew Morton , Leon Huang Fu Subject: [PATCH 6.6 512/529] mm: memcg: add per-memcg zswap writeback stat Date: Fri, 21 Nov 2025 14:13:31 +0100 Message-ID: <20251121130249.256208941@linuxfoundation.org> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20251121130230.985163914@linuxfoundation.org> References: <20251121130230.985163914@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.6-stable review patch. If anyone has any objections, please let me know. ------------------ From: Domenico Cerasuolo [ Upstream commit 7108cc3f765cafd48a6a35f8add140beaecfa75b ] Since zswap now writes back pages from memcg-specific LRUs, we now need a new stat to show writebacks count for each memcg. [nphamcs@gmail.com: rename ZSWP_WB to ZSWPWB] Link: https://lkml.kernel.org/r/20231205193307.2432803-1-nphamcs@gmail.com Link: https://lkml.kernel.org/r/20231130194023.4102148-5-nphamcs@gmail.com Suggested-by: Nhat Pham Signed-off-by: Domenico Cerasuolo Signed-off-by: Nhat Pham Tested-by: Bagas Sanjaya Reviewed-by: Yosry Ahmed Cc: Chris Li Cc: Dan Streetman Cc: Johannes Weiner Cc: Michal Hocko Cc: Muchun Song Cc: Roman Gushchin Cc: Seth Jennings Cc: Shakeel Butt Cc: Shuah Khan Cc: Vitaly Wool Signed-off-by: Andrew Morton Signed-off-by: Leon Huang Fu Signed-off-by: Greg Kroah-Hartman --- include/linux/vm_event_item.h | 1 + mm/memcontrol.c | 1 + mm/vmstat.c | 1 + mm/zswap.c | 4 ++++ 4 files changed, 7 insertions(+) --- a/include/linux/vm_event_item.h +++ b/include/linux/vm_event_item.h @@ -145,6 +145,7 @@ enum vm_event_item { PGPGIN, PGPGOUT, PS #ifdef CONFIG_ZSWAP ZSWPIN, ZSWPOUT, + ZSWPWB, #endif #ifdef CONFIG_X86 DIRECT_MAP_LEVEL2_SPLIT, --- a/mm/memcontrol.c +++ b/mm/memcontrol.c @@ -700,6 +700,7 @@ static const unsigned int memcg_vm_event #if defined(CONFIG_MEMCG_KMEM) && defined(CONFIG_ZSWAP) ZSWPIN, ZSWPOUT, + ZSWPWB, #endif #ifdef CONFIG_TRANSPARENT_HUGEPAGE THP_FAULT_ALLOC, --- a/mm/vmstat.c +++ b/mm/vmstat.c @@ -1397,6 +1397,7 @@ const char * const vmstat_text[] = { #ifdef CONFIG_ZSWAP "zswpin", "zswpout", + "zswpwb", #endif #ifdef CONFIG_X86 "direct_map_level2_splits", --- a/mm/zswap.c +++ b/mm/zswap.c @@ -674,6 +674,10 @@ static int zswap_reclaim_entry(struct zs goto put_unlock; } + if (entry->objcg) + count_objcg_event(entry->objcg, ZSWPWB); + + count_vm_event(ZSWPWB); /* * Writeback started successfully, the page now belongs to the * swapcache. Drop the entry from zswap - unless invalidate already