From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out-189.mta0.migadu.com (out-189.mta0.migadu.com [91.218.175.189]) (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 C9318246782 for ; Fri, 13 Feb 2026 07:18:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.189 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770967136; cv=none; b=t8eNrvphRitv4068L2TYwrDtOES9hUy9wke7luYVmQ0a7rIrGBpMXuS45mxVX5f+JSr0QoDdNHECgriV9Ps4PgHswlBoi8MqIqgDJvt1AS86E8EuBJqSug/RAVBJJL8xxrTYTV3hM+N2uEFN2DgDOj474laeeXAPKIClznP7b/o= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770967136; c=relaxed/simple; bh=OIu4Il4UO+4ipcMmAhGhJILiO6XfQZnYMCTjf3tv/Eg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=f6tWt18WUzEBDGxxx259+lZfziAsixYZI2NM5IC8VwmtvY5EWSK+5E1xgCzNc/XRLOm8u3VGxq2Dpul5eaSksd84EwonWzQP4y4WzhrBgjQ0AfDudZRI1aTlDYlwQl3W8MLj3srrzsGSSjDM1DsJylHcwSt1TdNiJoDzvNI+Mb0= 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=q8s5gGk6; arc=none smtp.client-ip=91.218.175.189 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="q8s5gGk6" X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1770967132; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=mHfHSc3Ob3QWgekFQ3UZMwloiqpQ6O0L56YYA+KphRQ=; b=q8s5gGk6nAy7TfViTElsNOtPlfFYJ5AKUJcxKKqU6N/XWwt2pCyQB3Kb7hQRh7V1JSa5Ew L97yUQC6jl83wBZqHVzK6GLQtifrsAMqT29P+FF2tc20W5qyuG8nD3ekQkwUtTQDRt4B/o WL2zvutLAMTUbwgTkfzHX2BiHTtzGo8= From: Jiayuan Chen To: linux-mm@kvack.org Cc: jiayuan.chen@linux.dev, Jiayuan Chen , Nhat Pham , Shakeel Butt , Yosry Ahmed , SeongJae Park , Tejun Heo , Johannes Weiner , =?UTF-8?q?Michal=20Koutn=C3=BD?= , Jonathan Corbet , Michal Hocko , Roman Gushchin , Muchun Song , Andrew Morton , Chengming Zhou , Shuah Khan , cgroups@vger.kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org Subject: [PATCH mm-new v3 1/2] mm: zswap: add per-memcg stat for incompressible pages Date: Fri, 13 Feb 2026 15:18:22 +0800 Message-ID: <20260213071827.5688-2-jiayuan.chen@linux.dev> In-Reply-To: <20260213071827.5688-1-jiayuan.chen@linux.dev> References: <20260213071827.5688-1-jiayuan.chen@linux.dev> Precedence: bulk X-Mailing-List: cgroups@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Migadu-Flow: FLOW_OUT From: Jiayuan Chen The global zswap_stored_incompressible_pages counter was added in commit dca4437a5861 ("mm/zswap: store Acked-by: Shakeel Butt Reviewed-by: Yosry Ahmed Reviewed-by: SeongJae Park Signed-off-by: Jiayuan Chen --- Documentation/admin-guide/cgroup-v2.rst | 5 +++++ include/linux/memcontrol.h | 1 + mm/memcontrol.c | 6 ++++++ 3 files changed, 12 insertions(+) diff --git a/Documentation/admin-guide/cgroup-v2.rst b/Documentation/admin-guide/cgroup-v2.rst index 7f5b59d95fce..78a329414615 100644 --- a/Documentation/admin-guide/cgroup-v2.rst +++ b/Documentation/admin-guide/cgroup-v2.rst @@ -1737,6 +1737,11 @@ The following nested keys are defined. zswpwb Number of pages written from zswap to swap. + zswap_incomp + Number of incompressible pages currently stored in zswap + without compression. These pages could not be compressed to + a size smaller than PAGE_SIZE, so they are stored as-is. + thp_fault_alloc (npn) Number of transparent hugepages which were allocated to satisfy a page fault. This counter is not present when CONFIG_TRANSPARENT_HUGEPAGE diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h index b6c82c8f73e1..d8ec05dd5d43 100644 --- a/include/linux/memcontrol.h +++ b/include/linux/memcontrol.h @@ -39,6 +39,7 @@ enum memcg_stat_item { MEMCG_KMEM, MEMCG_ZSWAP_B, MEMCG_ZSWAPPED, + MEMCG_ZSWAP_INCOMP, MEMCG_NR_STAT, }; diff --git a/mm/memcontrol.c b/mm/memcontrol.c index 007413a53b45..4c5672169753 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c @@ -341,6 +341,7 @@ static const unsigned int memcg_stat_items[] = { MEMCG_KMEM, MEMCG_ZSWAP_B, MEMCG_ZSWAPPED, + MEMCG_ZSWAP_INCOMP, }; #define NR_MEMCG_NODE_STAT_ITEMS ARRAY_SIZE(memcg_node_stat_items) @@ -1346,6 +1347,7 @@ static const struct memory_stat memory_stats[] = { #ifdef CONFIG_ZSWAP { "zswap", MEMCG_ZSWAP_B }, { "zswapped", MEMCG_ZSWAPPED }, + { "zswap_incomp", MEMCG_ZSWAP_INCOMP }, #endif { "file_mapped", NR_FILE_MAPPED }, { "file_dirty", NR_FILE_DIRTY }, @@ -5458,6 +5460,8 @@ void obj_cgroup_charge_zswap(struct obj_cgroup *objcg, size_t size) memcg = obj_cgroup_memcg(objcg); mod_memcg_state(memcg, MEMCG_ZSWAP_B, size); mod_memcg_state(memcg, MEMCG_ZSWAPPED, 1); + if (size == PAGE_SIZE) + mod_memcg_state(memcg, MEMCG_ZSWAP_INCOMP, 1); rcu_read_unlock(); } @@ -5481,6 +5485,8 @@ void obj_cgroup_uncharge_zswap(struct obj_cgroup *objcg, size_t size) memcg = obj_cgroup_memcg(objcg); mod_memcg_state(memcg, MEMCG_ZSWAP_B, -size); mod_memcg_state(memcg, MEMCG_ZSWAPPED, -1); + if (size == PAGE_SIZE) + mod_memcg_state(memcg, MEMCG_ZSWAP_INCOMP, -1); rcu_read_unlock(); } -- 2.43.0