If zswap_store() successfully stores an mTHP, it will be
counted under the per-order sysfs "zswpout" stats:
/sys/kernel/mm/transparent_hugepage/hugepages-*kB/stats/zswpout
Other block dev/fs mTHP swap-out events will be counted under
the existing sysfs "swpout" stats:
/sys/kernel/mm/transparent_hugepage/hugepages-*kB/stats/swpout
Signed-off-by: Kanchana P Sridhar <kanchana.p.sridhar@intel.com>
---
mm/page_io.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/mm/page_io.c b/mm/page_io.c
index ff8c99ee3af7..debd04fbdfd0 100644
--- a/mm/page_io.c
+++ b/mm/page_io.c
@@ -172,6 +172,12 @@ int generic_swapfile_activate(struct swap_info_struct *sis,
goto out;
}
+static inline void count_mthp_zswpout_vm_event(struct folio *folio)
+{
+ if (IS_ENABLED(CONFIG_THP_SWAP))
+ count_mthp_stat(folio_order(folio), MTHP_STAT_ZSWPOUT);
+}
+
/*
* We may have stale swap cache pages in memory: notice
* them here and get rid of the unnecessary final write.
@@ -196,6 +202,7 @@ int swap_writepage(struct page *page, struct writeback_control *wbc)
return ret;
}
if (zswap_store(folio)) {
+ count_mthp_zswpout_vm_event(folio);
folio_unlock(folio);
return 0;
}
--
2.27.0
Hi Kanchana,
kernel test robot noticed the following build errors:
[auto build test ERROR on linus/master]
[also build test ERROR on v6.11-rc3]
[cannot apply to akpm-mm/mm-everything next-20240816]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Kanchana-P-Sridhar/mm-zswap-zswap_is_folio_same_filled-takes-an-index-in-the-folio/20240816-134948
base: linus/master
patch link: https://lore.kernel.org/r/20240816054805.5201-5-kanchana.p.sridhar%40intel.com
patch subject: [PATCH v2 4/4] mm: swap: Count successful mTHP ZSWAP stores in sysfs mTHP stats.
config: arm-randconfig-002-20240816 (https://download.01.org/0day-ci/archive/20240817/202408170059.sq8QoVWB-lkp@intel.com/config)
compiler: clang version 20.0.0git (https://github.com/llvm/llvm-project 26670e7fa4f032a019d23d56c6a02926e854e8af)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240817/202408170059.sq8QoVWB-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202408170059.sq8QoVWB-lkp@intel.com/
All errors (new ones prefixed by >>):
In file included from mm/page_io.c:14:
In file included from include/linux/mm.h:2228:
include/linux/vmstat.h:514:36: warning: arithmetic between different enumeration types ('enum node_stat_item' and 'enum lru_list') [-Wenum-enum-conversion]
514 | return node_stat_name(NR_LRU_BASE + lru) + 3; // skip "nr_"
| ~~~~~~~~~~~ ^ ~~~
>> mm/page_io.c:178:3: error: call to undeclared function 'count_mthp_stat'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
178 | count_mthp_stat(folio_order(folio), MTHP_STAT_ZSWPOUT);
| ^
>> mm/page_io.c:178:39: error: use of undeclared identifier 'MTHP_STAT_ZSWPOUT'
178 | count_mthp_stat(folio_order(folio), MTHP_STAT_ZSWPOUT);
| ^
1 warning and 2 errors generated.
vim +/count_mthp_stat +178 mm/page_io.c
174
175 static inline void count_mthp_zswpout_vm_event(struct folio *folio)
176 {
177 if (IS_ENABLED(CONFIG_THP_SWAP))
> 178 count_mthp_stat(folio_order(folio), MTHP_STAT_ZSWPOUT);
179 }
180
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
Hi Kanchana,
kernel test robot noticed the following build errors:
[auto build test ERROR on linus/master]
[also build test ERROR on v6.11-rc3]
[cannot apply to akpm-mm/mm-everything next-20240816]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Kanchana-P-Sridhar/mm-zswap-zswap_is_folio_same_filled-takes-an-index-in-the-folio/20240816-134948
base: linus/master
patch link: https://lore.kernel.org/r/20240816054805.5201-5-kanchana.p.sridhar%40intel.com
patch subject: [PATCH v2 4/4] mm: swap: Count successful mTHP ZSWAP stores in sysfs mTHP stats.
config: i386-buildonly-randconfig-005-20240816 (https://download.01.org/0day-ci/archive/20240816/202408162056.MQnreTgK-lkp@intel.com/config)
compiler: gcc-11 (Debian 11.3.0-12) 11.3.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240816/202408162056.MQnreTgK-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202408162056.MQnreTgK-lkp@intel.com/
All errors (new ones prefixed by >>):
mm/page_io.c: In function 'count_mthp_zswpout_vm_event':
>> mm/page_io.c:178:17: error: implicit declaration of function 'count_mthp_stat' [-Werror=implicit-function-declaration]
178 | count_mthp_stat(folio_order(folio), MTHP_STAT_ZSWPOUT);
| ^~~~~~~~~~~~~~~
>> mm/page_io.c:178:53: error: 'MTHP_STAT_ZSWPOUT' undeclared (first use in this function)
178 | count_mthp_stat(folio_order(folio), MTHP_STAT_ZSWPOUT);
| ^~~~~~~~~~~~~~~~~
mm/page_io.c:178:53: note: each undeclared identifier is reported only once for each function it appears in
cc1: some warnings being treated as errors
vim +/count_mthp_stat +178 mm/page_io.c
174
175 static inline void count_mthp_zswpout_vm_event(struct folio *folio)
176 {
177 if (IS_ENABLED(CONFIG_THP_SWAP))
> 178 count_mthp_stat(folio_order(folio), MTHP_STAT_ZSWPOUT);
179 }
180
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
© 2016 - 2026 Red Hat, Inc.