On Wed, 29 Nov 2023 13:43:13 -0800 Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> wrote: > On Wed, 29 Nov 2023 23:42:11 +0800 kernel test robot <lkp@xxxxxxxxx> wrote: > > > >> mm/zswap.c:825:17: error: dereferencing pointer to incomplete type 'struct mem_cgroup' > > css_get(&memcg->css); > > ^~ > > OK, thanks, patchset needs work for CONFIG_MEMCG=n. I'll drop this version. Well that's annoying - the "mm: memcg: subtree stats flushing and thresholds" series had lots of dependencies on this series. So I'll restore this series with this hack: include/linux/memcontrol.h | 5 +++++ mm/zswap.c | 3 +++ 2 files changed, 8 insertions(+) --- a/include/linux/memcontrol.h~zswap-make-shrinking-memcg-aware-fix +++ a/include/linux/memcontrol.h @@ -1165,6 +1165,11 @@ unsigned long mem_cgroup_soft_limit_recl #define MEM_CGROUP_ID_SHIFT 0 +static inline struct mem_cgroup *obj_cgroup_memcg(struct obj_cgroup *objcg) +{ + return NULL; +} + static inline struct mem_cgroup *folio_memcg(struct folio *folio) { return NULL; --- a/mm/zswap.c~zswap-make-shrinking-memcg-aware-fix +++ a/mm/zswap.c @@ -32,6 +32,7 @@ #include <linux/mm_types.h> #include <linux/page-flags.h> #include <linux/swapops.h> +#include <linux/memcontrol.h> #include <linux/writeback.h> #include <linux/pagemap.h> #include <linux/workqueue.h> @@ -822,7 +823,9 @@ static void shrink_worker(struct work_st * Acquire an extra reference to the iterated memcg in case the * original reference is dropped by the zswap offlining callback. */ +#ifdef CONFIG_MEMCG css_get(&memcg->css); +#endif spin_unlock(&zswap_pools_lock); ret = shrink_memcg(memcg); _