public inbox for llvm@lists.linux.dev
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: Gregory Price <gourry@gourry.net>
Cc: llvm@lists.linux.dev, oe-kbuild-all@lists.linux.dev,
	Gregory Price <gourry@gourry.net>
Subject: [gourryinverse:movable_gigantic 1/1] mm/hugetlb.c:505:9: error: incomplete definition of type 'struct hugetlb_cgroup'
Date: Wed, 26 Nov 2025 21:09:43 +0800	[thread overview]
Message-ID: <202511262147.qCAsmUek-lkp@intel.com> (raw)

tree:   https://github.com/gourryinverse/linux movable_gigantic
head:   ba138827f6a776a1b329ebd87f3510e2d45302bd
commit: ba138827f6a776a1b329ebd87f3510e2d45302bd [1/1] mm, hugetlb: implement movable_gigantic_pages sysctl
config: loongarch-defconfig (https://download.01.org/0day-ci/archive/20251126/202511262147.qCAsmUek-lkp@intel.com/config)
compiler: clang version 19.1.7 (https://github.com/llvm/llvm-project cd708029e0b2869e80abe31ddb175f7c35361f90)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20251126/202511262147.qCAsmUek-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/202511262147.qCAsmUek-lkp@intel.com/

All errors (new ones prefixed by >>):

   mm/hugetlb.c:497:56: warning: declaration of 'struct hugetlb_cgroup' will not be visible outside of this function [-Wvisibility]
     497 | static void record_hugetlb_cgroup_uncharge_info(struct hugetlb_cgroup *h_cg,
         |                                                        ^
>> mm/hugetlb.c:505:9: error: incomplete definition of type 'struct hugetlb_cgroup'
     505 |                         &h_cg->rsvd_hugepage[hstate_index(h)];
         |                          ~~~~^
   mm/hugetlb.c:497:56: note: forward declaration of 'struct hugetlb_cgroup'
     497 | static void record_hugetlb_cgroup_uncharge_info(struct hugetlb_cgroup *h_cg,
         |                                                        ^
   mm/hugetlb.c:506:19: error: incomplete definition of type 'struct hugetlb_cgroup'
     506 |                 nrg->css = &h_cg->css;
         |                             ~~~~^
   mm/hugetlb.c:497:56: note: forward declaration of 'struct hugetlb_cgroup'
     497 | static void record_hugetlb_cgroup_uncharge_info(struct hugetlb_cgroup *h_cg,
         |                                                        ^
   mm/hugetlb.c:517:16: error: incomplete definition of type 'struct hugetlb_cgroup'
     517 |                 css_get(&h_cg->css);
         |                          ~~~~^
   mm/hugetlb.c:497:56: note: forward declaration of 'struct hugetlb_cgroup'
     497 | static void record_hugetlb_cgroup_uncharge_info(struct hugetlb_cgroup *h_cg,
         |                                                        ^
   mm/hugetlb.c:580:42: warning: declaration of 'struct hugetlb_cgroup' will not be visible outside of this function [-Wvisibility]
     580 |                      long to, struct hstate *h, struct hugetlb_cgroup *cg,
         |                                                        ^
>> mm/hugetlb.c:587:39: error: incompatible pointer types passing 'struct hugetlb_cgroup *' to parameter of type 'struct hugetlb_cgroup *' [-Werror,-Wincompatible-pointer-types]
     587 |                 record_hugetlb_cgroup_uncharge_info(cg, h, map, nrg);
         |                                                     ^~
   mm/hugetlb.c:497:72: note: passing argument to parameter 'h_cg' here
     497 | static void record_hugetlb_cgroup_uncharge_info(struct hugetlb_cgroup *h_cg,
         |                                                                        ^
   mm/hugetlb.c:605:17: warning: declaration of 'struct hugetlb_cgroup' will not be visible outside of this function [-Wvisibility]
     605 |                                      struct hugetlb_cgroup *h_cg,
         |                                             ^
   mm/hugetlb.c:646:26: error: incompatible pointer types passing 'struct hugetlb_cgroup *' to parameter of type 'struct hugetlb_cgroup *' [-Werror,-Wincompatible-pointer-types]
     646 |                                                     iter->from, h, h_cg,
         |                                                                    ^~~~
   mm/hugetlb.c:580:58: note: passing argument to parameter 'cg' here
     580 |                      long to, struct hstate *h, struct hugetlb_cgroup *cg,
         |                                                                        ^
   mm/hugetlb.c:659:16: error: incompatible pointer types passing 'struct hugetlb_cgroup *' to parameter of type 'struct hugetlb_cgroup *' [-Werror,-Wincompatible-pointer-types]
     659 |                                             t, h, h_cg, regions_needed);
         |                                                   ^~~~
   mm/hugetlb.c:580:58: note: passing argument to parameter 'cg' here
     580 |                      long to, struct hstate *h, struct hugetlb_cgroup *cg,
         |                                                                        ^
   mm/hugetlb.c:739:17: warning: declaration of 'struct hugetlb_cgroup' will not be visible outside of this function [-Wvisibility]
     739 |                        struct hugetlb_cgroup *h_cg)
         |                               ^
   mm/hugetlb.c:776:45: error: incompatible pointer types passing 'struct hugetlb_cgroup *' to parameter of type 'struct hugetlb_cgroup *' [-Werror,-Wincompatible-pointer-types]
     776 |         add = add_reservation_in_range(resv, f, t, h_cg, h, NULL);
         |                                                    ^~~~
   mm/hugetlb.c:605:33: note: passing argument to parameter 'h_cg' here
     605 |                                      struct hugetlb_cgroup *h_cg,
         |                                                             ^
>> mm/hugetlb.c:909:4: error: call to undeclared function 'hugetlb_cgroup_uncharge_file_region'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
     909 |                         hugetlb_cgroup_uncharge_file_region(
         |                         ^
   mm/hugetlb.c:930:4: error: call to undeclared function 'hugetlb_cgroup_uncharge_file_region'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
     930 |                         hugetlb_cgroup_uncharge_file_region(resv, rg,
         |                         ^
   mm/hugetlb.c:938:4: error: call to undeclared function 'hugetlb_cgroup_uncharge_file_region'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
     938 |                         hugetlb_cgroup_uncharge_file_region(resv, rg,
         |                         ^
   mm/hugetlb.c:944:4: error: call to undeclared function 'hugetlb_cgroup_uncharge_file_region'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
     944 |                         hugetlb_cgroup_uncharge_file_region(resv, rg,
         |                         ^
   mm/hugetlb.c:1097:15: warning: declaration of 'struct hugetlb_cgroup' will not be visible outside of this function [-Wvisibility]
    1097 |                                           struct hugetlb_cgroup *h_cg,
         |                                                  ^
   mm/hugetlb.c:1107:9: error: incomplete definition of type 'struct hugetlb_cgroup'
    1107 |                         &h_cg->rsvd_hugepage[hstate_index(h)];
         |                          ~~~~^
   mm/hugetlb.c:1097:15: note: forward declaration of 'struct hugetlb_cgroup'
    1097 |                                           struct hugetlb_cgroup *h_cg,
         |                                                  ^
   mm/hugetlb.c:1109:24: error: incomplete definition of type 'struct hugetlb_cgroup'
    1109 |                 resv_map->css = &h_cg->css;
         |                                  ~~~~^
   mm/hugetlb.c:1097:15: note: forward declaration of 'struct hugetlb_cgroup'
    1097 |                                           struct hugetlb_cgroup *h_cg,
         |                                                  ^
>> mm/hugetlb.c:1287:3: error: call to undeclared function 'resv_map_put_hugetlb_cgroup_uncharge_info'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
    1287 |                 resv_map_put_hugetlb_cgroup_uncharge_info(reservations);
         |                 ^
   mm/hugetlb.c:1287:3: note: did you mean 'resv_map_set_hugetlb_cgroup_uncharge_info'?
   mm/hugetlb.c:1096:1: note: 'resv_map_set_hugetlb_cgroup_uncharge_info' declared here
    1096 | resv_map_set_hugetlb_cgroup_uncharge_info(struct resv_map *resv_map,
         | ^
>> mm/hugetlb.c:1479:18: error: call to undeclared function 'hugetlb_cgroup_from_folio'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
    1479 |         VM_BUG_ON_FOLIO(hugetlb_cgroup_from_folio(folio), folio);
         |                         ^
   mm/hugetlb.c:1479:18: note: did you mean 'get_obj_cgroup_from_folio'?
   include/linux/memcontrol.h:1689:20: note: 'get_obj_cgroup_from_folio' declared here
    1689 | struct obj_cgroup *get_obj_cgroup_from_folio(struct folio *folio);
         |                    ^
>> mm/hugetlb.c:1480:18: error: call to undeclared function 'hugetlb_cgroup_from_folio_rsvd'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
    1480 |         VM_BUG_ON_FOLIO(hugetlb_cgroup_from_folio_rsvd(folio), folio);
         |                         ^
>> mm/hugetlb.c:1483:6: error: call to undeclared function 'hstate_is_gigantic_no_runtime'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
    1483 |         if (hstate_is_gigantic_no_runtime(h))
         |             ^
   mm/hugetlb.c:1474:6: warning: no previous prototype for function 'remove_hugetlb_folio' [-Wmissing-prototypes]
    1474 | void remove_hugetlb_folio(struct hstate *h, struct folio *folio,
         |      ^
   mm/hugetlb.c:1474:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
    1474 | void remove_hugetlb_folio(struct hstate *h, struct folio *folio,
         | ^
         | static 
   mm/hugetlb.c:1510:6: warning: no previous prototype for function 'add_hugetlb_folio' [-Wmissing-prototypes]
    1510 | void add_hugetlb_folio(struct hstate *h, struct folio *folio,
         |      ^
   mm/hugetlb.c:1510:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
    1510 | void add_hugetlb_folio(struct hstate *h, struct folio *folio,
         | ^
         | static 
   mm/hugetlb.c:1545:6: error: call to undeclared function 'hstate_is_gigantic_no_runtime'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
    1545 |         if (hstate_is_gigantic_no_runtime(h))
         |             ^
>> mm/hugetlb.c:1807:2: error: call to undeclared function 'hugetlb_cgroup_uncharge_folio'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
    1807 |         hugetlb_cgroup_uncharge_folio(hstate_index(h),
         |         ^
   fatal error: too many errors emitted, stopping now [-ferror-limit=]
   7 warnings and 20 errors generated.


vim +505 mm/hugetlb.c

075a61d07a8eca Mina Almasry  2020-04-01  495  
075a61d07a8eca Mina Almasry  2020-04-01  496  /* Helper that records hugetlb_cgroup uncharge info. */
075a61d07a8eca Mina Almasry  2020-04-01  497  static void record_hugetlb_cgroup_uncharge_info(struct hugetlb_cgroup *h_cg,
075a61d07a8eca Mina Almasry  2020-04-01  498  						struct hstate *h,
075a61d07a8eca Mina Almasry  2020-04-01  499  						struct resv_map *resv,
075a61d07a8eca Mina Almasry  2020-04-01  500  						struct file_region *nrg)
075a61d07a8eca Mina Almasry  2020-04-01  501  {
075a61d07a8eca Mina Almasry  2020-04-01  502  #ifdef CONFIG_CGROUP_HUGETLB
075a61d07a8eca Mina Almasry  2020-04-01  503  	if (h_cg) {
075a61d07a8eca Mina Almasry  2020-04-01  504  		nrg->reservation_counter =
075a61d07a8eca Mina Almasry  2020-04-01 @505  			&h_cg->rsvd_hugepage[hstate_index(h)];
075a61d07a8eca Mina Almasry  2020-04-01  506  		nrg->css = &h_cg->css;
d85aecf2844ff0 Miaohe Lin    2021-03-24  507  		/*
d85aecf2844ff0 Miaohe Lin    2021-03-24  508  		 * The caller will hold exactly one h_cg->css reference for the
d85aecf2844ff0 Miaohe Lin    2021-03-24  509  		 * whole contiguous reservation region. But this area might be
d85aecf2844ff0 Miaohe Lin    2021-03-24  510  		 * scattered when there are already some file_regions reside in
d85aecf2844ff0 Miaohe Lin    2021-03-24  511  		 * it. As a result, many file_regions may share only one css
d85aecf2844ff0 Miaohe Lin    2021-03-24  512  		 * reference. In order to ensure that one file_region must hold
d85aecf2844ff0 Miaohe Lin    2021-03-24  513  		 * exactly one h_cg->css reference, we should do css_get for
d85aecf2844ff0 Miaohe Lin    2021-03-24  514  		 * each file_region and leave the reference held by caller
d85aecf2844ff0 Miaohe Lin    2021-03-24  515  		 * untouched.
d85aecf2844ff0 Miaohe Lin    2021-03-24  516  		 */
d85aecf2844ff0 Miaohe Lin    2021-03-24  517  		css_get(&h_cg->css);
075a61d07a8eca Mina Almasry  2020-04-01  518  		if (!resv->pages_per_hpage)
075a61d07a8eca Mina Almasry  2020-04-01  519  			resv->pages_per_hpage = pages_per_huge_page(h);
075a61d07a8eca Mina Almasry  2020-04-01  520  		/* pages_per_hpage should be the same for all entries in
075a61d07a8eca Mina Almasry  2020-04-01  521  		 * a resv_map.
075a61d07a8eca Mina Almasry  2020-04-01  522  		 */
075a61d07a8eca Mina Almasry  2020-04-01  523  		VM_BUG_ON(resv->pages_per_hpage != pages_per_huge_page(h));
075a61d07a8eca Mina Almasry  2020-04-01  524  	} else {
075a61d07a8eca Mina Almasry  2020-04-01  525  		nrg->reservation_counter = NULL;
075a61d07a8eca Mina Almasry  2020-04-01  526  		nrg->css = NULL;
075a61d07a8eca Mina Almasry  2020-04-01  527  	}
075a61d07a8eca Mina Almasry  2020-04-01  528  #endif
075a61d07a8eca Mina Almasry  2020-04-01  529  }
075a61d07a8eca Mina Almasry  2020-04-01  530  
d85aecf2844ff0 Miaohe Lin    2021-03-24  531  static void put_uncharge_info(struct file_region *rg)
d85aecf2844ff0 Miaohe Lin    2021-03-24  532  {
d85aecf2844ff0 Miaohe Lin    2021-03-24  533  #ifdef CONFIG_CGROUP_HUGETLB
d85aecf2844ff0 Miaohe Lin    2021-03-24  534  	if (rg->css)
d85aecf2844ff0 Miaohe Lin    2021-03-24  535  		css_put(rg->css);
d85aecf2844ff0 Miaohe Lin    2021-03-24  536  #endif
d85aecf2844ff0 Miaohe Lin    2021-03-24  537  }
d85aecf2844ff0 Miaohe Lin    2021-03-24  538  
a9b3f867404b35 Mina Almasry  2020-04-01  539  static bool has_same_uncharge_info(struct file_region *rg,
a9b3f867404b35 Mina Almasry  2020-04-01  540  				   struct file_region *org)
a9b3f867404b35 Mina Almasry  2020-04-01  541  {
a9b3f867404b35 Mina Almasry  2020-04-01  542  #ifdef CONFIG_CGROUP_HUGETLB
0739eb437f3d39 Baolin Wang   2021-11-05  543  	return rg->reservation_counter == org->reservation_counter &&
a9b3f867404b35 Mina Almasry  2020-04-01  544  	       rg->css == org->css;
a9b3f867404b35 Mina Almasry  2020-04-01  545  
a9b3f867404b35 Mina Almasry  2020-04-01  546  #else
a9b3f867404b35 Mina Almasry  2020-04-01  547  	return true;
a9b3f867404b35 Mina Almasry  2020-04-01  548  #endif
a9b3f867404b35 Mina Almasry  2020-04-01  549  }
a9b3f867404b35 Mina Almasry  2020-04-01  550  
a9b3f867404b35 Mina Almasry  2020-04-01  551  static void coalesce_file_region(struct resv_map *resv, struct file_region *rg)
a9b3f867404b35 Mina Almasry  2020-04-01  552  {
3259914f8cab1b XU pengfei    2022-09-14  553  	struct file_region *nrg, *prg;
a9b3f867404b35 Mina Almasry  2020-04-01  554  
a9b3f867404b35 Mina Almasry  2020-04-01  555  	prg = list_prev_entry(rg, link);
a9b3f867404b35 Mina Almasry  2020-04-01  556  	if (&prg->link != &resv->regions && prg->to == rg->from &&
a9b3f867404b35 Mina Almasry  2020-04-01  557  	    has_same_uncharge_info(prg, rg)) {
a9b3f867404b35 Mina Almasry  2020-04-01  558  		prg->to = rg->to;
a9b3f867404b35 Mina Almasry  2020-04-01  559  
a9b3f867404b35 Mina Almasry  2020-04-01  560  		list_del(&rg->link);
d85aecf2844ff0 Miaohe Lin    2021-03-24  561  		put_uncharge_info(rg);
a9b3f867404b35 Mina Almasry  2020-04-01  562  		kfree(rg);
a9b3f867404b35 Mina Almasry  2020-04-01  563  
7db5e7b67e3e8d Wei Yang      2020-10-13  564  		rg = prg;
a9b3f867404b35 Mina Almasry  2020-04-01  565  	}
a9b3f867404b35 Mina Almasry  2020-04-01  566  
a9b3f867404b35 Mina Almasry  2020-04-01  567  	nrg = list_next_entry(rg, link);
a9b3f867404b35 Mina Almasry  2020-04-01  568  	if (&nrg->link != &resv->regions && nrg->from == rg->to &&
a9b3f867404b35 Mina Almasry  2020-04-01  569  	    has_same_uncharge_info(nrg, rg)) {
a9b3f867404b35 Mina Almasry  2020-04-01  570  		nrg->from = rg->from;
a9b3f867404b35 Mina Almasry  2020-04-01  571  
a9b3f867404b35 Mina Almasry  2020-04-01  572  		list_del(&rg->link);
d85aecf2844ff0 Miaohe Lin    2021-03-24  573  		put_uncharge_info(rg);
a9b3f867404b35 Mina Almasry  2020-04-01  574  		kfree(rg);
a9b3f867404b35 Mina Almasry  2020-04-01  575  	}
a9b3f867404b35 Mina Almasry  2020-04-01  576  }
a9b3f867404b35 Mina Almasry  2020-04-01  577  
2103cf9c3f3ba0 Peter Xu      2021-03-12  578  static inline long
84448c8ecd9a13 Jakob Koschel 2022-04-28  579  hugetlb_resv_map_add(struct resv_map *map, struct list_head *rg, long from,
2103cf9c3f3ba0 Peter Xu      2021-03-12  580  		     long to, struct hstate *h, struct hugetlb_cgroup *cg,
2103cf9c3f3ba0 Peter Xu      2021-03-12  581  		     long *regions_needed)
2103cf9c3f3ba0 Peter Xu      2021-03-12  582  {
2103cf9c3f3ba0 Peter Xu      2021-03-12  583  	struct file_region *nrg;
2103cf9c3f3ba0 Peter Xu      2021-03-12  584  
2103cf9c3f3ba0 Peter Xu      2021-03-12  585  	if (!regions_needed) {
2103cf9c3f3ba0 Peter Xu      2021-03-12  586  		nrg = get_file_region_entry_from_cache(map, from, to);
2103cf9c3f3ba0 Peter Xu      2021-03-12 @587  		record_hugetlb_cgroup_uncharge_info(cg, h, map, nrg);
84448c8ecd9a13 Jakob Koschel 2022-04-28  588  		list_add(&nrg->link, rg);
2103cf9c3f3ba0 Peter Xu      2021-03-12  589  		coalesce_file_region(map, nrg);
2103cf9c3f3ba0 Peter Xu      2021-03-12  590  	} else
2103cf9c3f3ba0 Peter Xu      2021-03-12  591  		*regions_needed += 1;
2103cf9c3f3ba0 Peter Xu      2021-03-12  592  
2103cf9c3f3ba0 Peter Xu      2021-03-12  593  	return to - from;
2103cf9c3f3ba0 Peter Xu      2021-03-12  594  }
2103cf9c3f3ba0 Peter Xu      2021-03-12  595  

:::::: The code at line 505 was first introduced by commit
:::::: 075a61d07a8eca2fe980acd94105ed5d6429c55d hugetlb_cgroup: add accounting for shared mappings

:::::: TO: Mina Almasry <almasrymina@google.com>
:::::: CC: Linus Torvalds <torvalds@linux-foundation.org>

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

                 reply	other threads:[~2025-11-26 13:09 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=202511262147.qCAsmUek-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=gourry@gourry.net \
    --cc=llvm@lists.linux.dev \
    --cc=oe-kbuild-all@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox