diff mbox series

[v9,52/96] mm/memcg: Add folio_uncharge_cgroup

Message ID 20210505150628.111735-53-willy@infradead.org (mailing list archive)
State New
Headers show
Series Memory folios | expand

Commit Message

Matthew Wilcox May 5, 2021, 3:05 p.m. UTC
Reimplement mem_cgroup_uncharge() as a wrapper around
folio_uncharge_cgroup().

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
---
 include/linux/memcontrol.h |  5 +++++
 mm/folio-compat.c          |  5 +++++
 mm/memcontrol.c            | 14 +++++++-------
 3 files changed, 17 insertions(+), 7 deletions(-)

Comments

kernel test robot May 5, 2021, 8:24 p.m. UTC | #1
Hi "Matthew,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on next-20210505]
[cannot apply to hnaz-linux-mm/master xfs-linux/for-next tip/perf/core shaggy/jfs-next block/for-next linus/master asm-generic/master v5.12 v5.12-rc8 v5.12-rc7 v5.12]
[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]

url:    https://github.com/0day-ci/linux/commits/Matthew-Wilcox-Oracle/Memory-folios/20210506-014108
base:    29955e0289b3255c5f609a7564a0f0bb4ae35c7a
config: powerpc-randconfig-r013-20210505 (attached as .config)
compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project 8f5a2a5836cc8e4c1def2bdeb022e7b496623439)
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # install powerpc cross compiling tool for clang build
        # apt-get install binutils-powerpc-linux-gnu
        # https://github.com/0day-ci/linux/commit/10f8a1d9657c57cdbad467d07ea326e6c831ac81
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Matthew-Wilcox-Oracle/Memory-folios/20210506-014108
        git checkout 10f8a1d9657c57cdbad467d07ea326e6c831ac81
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 ARCH=powerpc 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All warnings (new ones prefixed by >>):

   In file included from arch/powerpc/kernel/asm-offsets.c:23:
   In file included from include/linux/suspend.h:5:
   In file included from include/linux/swap.h:9:
>> include/linux/memcontrol.h:1213:56: warning: omitting the parameter name in a function definition is a C2x extension [-Wc2x-extensions]
   static inline void folio_uncharge_cgroup(struct folio *)
                                                          ^
   1 warning generated.
--
   In file included from mm/shmem.c:35:
   In file included from include/linux/swap.h:9:
>> include/linux/memcontrol.h:1213:56: warning: omitting the parameter name in a function definition is a C2x extension [-Wc2x-extensions]
   static inline void folio_uncharge_cgroup(struct folio *)
                                                          ^
   mm/shmem.c:1464:20: warning: unused function 'shmem_show_mpol' [-Wunused-function]
   static inline void shmem_show_mpol(struct seq_file *seq, struct mempolicy *mpol)
                      ^
   2 warnings generated.
--
   In file included from mm/page_alloc.c:21:
   In file included from include/linux/swap.h:9:
>> include/linux/memcontrol.h:1213:56: warning: omitting the parameter name in a function definition is a C2x extension [-Wc2x-extensions]
   static inline void folio_uncharge_cgroup(struct folio *)
                                                          ^
   mm/page_alloc.c:3651:15: warning: no previous prototype for function 'should_fail_alloc_page' [-Wmissing-prototypes]
   noinline bool should_fail_alloc_page(gfp_t gfp_mask, unsigned int order)
                 ^
   mm/page_alloc.c:3651:10: note: declare 'static' if the function is not intended to be used outside of this translation unit
   noinline bool should_fail_alloc_page(gfp_t gfp_mask, unsigned int order)
            ^
            static 
   2 warnings generated.
--
   In file included from mm/sparse.c:14:
   In file included from include/linux/swap.h:9:
>> include/linux/memcontrol.h:1213:56: warning: omitting the parameter name in a function definition is a C2x extension [-Wc2x-extensions]
   static inline void folio_uncharge_cgroup(struct folio *)
                                                          ^
   mm/sparse.c:720:25: warning: no previous prototype for function 'populate_section_memmap' [-Wmissing-prototypes]
   struct page * __meminit populate_section_memmap(unsigned long pfn,
                           ^
   mm/sparse.c:720:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
   struct page * __meminit populate_section_memmap(unsigned long pfn,
   ^
   static 
   2 warnings generated.
--
   In file included from mm/slub.c:14:
   In file included from include/linux/swap.h:9:
>> include/linux/memcontrol.h:1213:56: warning: omitting the parameter name in a function definition is a C2x extension [-Wc2x-extensions]
   static inline void folio_uncharge_cgroup(struct folio *)
                                                          ^
   mm/slub.c:1534:21: warning: unused function 'kmalloc_large_node_hook' [-Wunused-function]
   static inline void *kmalloc_large_node_hook(void *ptr, size_t size, gfp_t flags)
                       ^
   2 warnings generated.
--
   In file included from kernel/sched/core.c:13:
   In file included from kernel/sched/sched.h:65:
   In file included from include/linux/suspend.h:5:
   In file included from include/linux/swap.h:9:
>> include/linux/memcontrol.h:1213:56: warning: omitting the parameter name in a function definition is a C2x extension [-Wc2x-extensions]
   static inline void folio_uncharge_cgroup(struct folio *)
                                                          ^
   kernel/sched/core.c:2850:6: warning: no previous prototype for function 'sched_set_stop_task' [-Wmissing-prototypes]
   void sched_set_stop_task(int cpu, struct task_struct *stop)
        ^
   kernel/sched/core.c:2850:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
   void sched_set_stop_task(int cpu, struct task_struct *stop)
   ^
   static 
   2 warnings generated.
--
   In file included from kernel/sched/cputime.c:5:
   In file included from kernel/sched/sched.h:65:
   In file included from include/linux/suspend.h:5:
   In file included from include/linux/swap.h:9:
>> include/linux/memcontrol.h:1213:56: warning: omitting the parameter name in a function definition is a C2x extension [-Wc2x-extensions]
   static inline void folio_uncharge_cgroup(struct folio *)
                                                          ^
   kernel/sched/cputime.c:256:19: warning: unused function 'account_other_time' [-Wunused-function]
   static inline u64 account_other_time(u64 max)
                     ^
   kernel/sched/cputime.c:399:20: warning: unused function 'irqtime_account_idle_ticks' [-Wunused-function]
   static inline void irqtime_account_idle_ticks(int ticks) { }
                      ^
   kernel/sched/cputime.c:400:20: warning: unused function 'irqtime_account_process_tick' [-Wunused-function]
   static inline void irqtime_account_process_tick(struct task_struct *p, int user_tick,
                      ^
   4 warnings generated.
--
   In file included from kernel/sched/rt.c:6:
   In file included from kernel/sched/sched.h:65:
   In file included from include/linux/suspend.h:5:
   In file included from include/linux/swap.h:9:
>> include/linux/memcontrol.h:1213:56: warning: omitting the parameter name in a function definition is a C2x extension [-Wc2x-extensions]
   static inline void folio_uncharge_cgroup(struct folio *)
                                                          ^
   kernel/sched/rt.c:669:6: warning: no previous prototype for function 'sched_rt_bandwidth_account' [-Wmissing-prototypes]
   bool sched_rt_bandwidth_account(struct rt_rq *rt_rq)
        ^
   kernel/sched/rt.c:669:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
   bool sched_rt_bandwidth_account(struct rt_rq *rt_rq)
   ^
   static 
   2 warnings generated.
--
   In file included from kernel/sched/topology.c:5:
   In file included from kernel/sched/sched.h:65:
   In file included from include/linux/suspend.h:5:
   In file included from include/linux/swap.h:9:
>> include/linux/memcontrol.h:1213:56: warning: omitting the parameter name in a function definition is a C2x extension [-Wc2x-extensions]
   static inline void folio_uncharge_cgroup(struct folio *)
                                                          ^
   kernel/sched/topology.c:157:20: warning: unused function 'sched_debug' [-Wunused-function]
   static inline bool sched_debug(void)
                      ^
   2 warnings generated.
--
   error: no override and no default toolchain set
   init/Kconfig:70:warning: 'RUSTC_VERSION': number is invalid
   In file included from arch/powerpc/kernel/asm-offsets.c:23:
   In file included from include/linux/suspend.h:5:
   In file included from include/linux/swap.h:9:
>> include/linux/memcontrol.h:1213:56: warning: omitting the parameter name in a function definition is a C2x extension [-Wc2x-extensions]
   static inline void folio_uncharge_cgroup(struct folio *)
                                                          ^
   1 warning generated.


vim +1213 include/linux/memcontrol.h

  1212	
> 1213	static inline void folio_uncharge_cgroup(struct folio *)
  1214	{
  1215	}
  1216	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
diff mbox series

Patch

diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h
index d0798d54f637..2e68c9848432 100644
--- a/include/linux/memcontrol.h
+++ b/include/linux/memcontrol.h
@@ -700,6 +700,7 @@  static inline bool mem_cgroup_below_min(struct mem_cgroup *memcg)
 }
 
 int folio_charge_cgroup(struct folio *, struct mm_struct *, gfp_t);
+void folio_uncharge_cgroup(struct folio *);
 
 int mem_cgroup_charge(struct page *page, struct mm_struct *mm, gfp_t gfp_mask);
 int mem_cgroup_swapin_charge_page(struct page *page, struct mm_struct *mm,
@@ -1209,6 +1210,10 @@  static inline int folio_charge_cgroup(struct folio *folio,
 	return 0;
 }
 
+static inline void folio_uncharge_cgroup(struct folio *)
+{
+}
+
 static inline int mem_cgroup_charge(struct page *page, struct mm_struct *mm,
 				    gfp_t gfp_mask)
 {
diff --git a/mm/folio-compat.c b/mm/folio-compat.c
index 1d71b8b587f8..d229b979b00d 100644
--- a/mm/folio-compat.c
+++ b/mm/folio-compat.c
@@ -54,4 +54,9 @@  int mem_cgroup_charge(struct page *page, struct mm_struct *mm, gfp_t gfp)
 {
 	return folio_charge_cgroup(page_folio(page), mm, gfp);
 }
+
+void mem_cgroup_uncharge(struct page *page)
+{
+	folio_uncharge_cgroup(page_folio(page));
+}
 #endif
diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index 529b10e72d5a..4ca2661cf891 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -6717,24 +6717,24 @@  static void uncharge_page(struct page *page, struct uncharge_gather *ug)
 }
 
 /**
- * mem_cgroup_uncharge - uncharge a page
- * @page: page to uncharge
+ * folio_uncharge_cgroup - Uncharge a folio.
+ * @folio: Folio to uncharge.
  *
- * Uncharge a page previously charged with mem_cgroup_charge().
+ * Uncharge a folio previously charged with folio_charge_cgroup().
  */
-void mem_cgroup_uncharge(struct page *page)
+void folio_uncharge_cgroup(struct folio *folio)
 {
 	struct uncharge_gather ug;
 
 	if (mem_cgroup_disabled())
 		return;
 
-	/* Don't touch page->lru of any random page, pre-check: */
-	if (!page_memcg(page))
+	/* Don't touch folio->lru of any random page, pre-check: */
+	if (!folio_memcg(folio))
 		return;
 
 	uncharge_gather_clear(&ug);
-	uncharge_page(page, &ug);
+	uncharge_page(&folio->page, &ug);
 	uncharge_batch(&ug);
 }