Skip to contentSkip to conversation

mm/huge_memory.c:80:24: warning: 'huge_anon_orders_lock' defined but not used

PATCH New kernel test robot 2 participants 2 messages Dec 11, 2023

Subsystems (2)
lore
Share & tools
lore

kernel test robot

author build bot
#0 lore raw
tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head:   bbd220ce4e29ed55ab079007cff0b550895258eb
commit: b197f32bc3d3d9f60977f31ad3e9eadb2123ca60 [6443/6992] mm: thp: introduce multi-size THP sysfs interface
config: s390-randconfig-r006-20230501 (https://download.01.org/0day-ci/archive/20231211/[email protected]/config)
compiler: s390-linux-gcc (GCC) 13.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20231211/[email protected]/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 <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All warnings (new ones prefixed by >>):

In file included from include/linux/spinlock.h:89,
from include/linux/mmzone.h:8, from include/linux/gfp.h:7, from include/linux/mm.h:7, from mm/huge_memory.c:8:

>> mm/huge_memory.c:80:24: warning: 'huge_anon_orders_lock' defined but not used [-Wunused-variable]
      80 | static DEFINE_SPINLOCK(huge_anon_orders_lock);
         |                        ^~~~~~~~~~~~~~~~~~~~~

include/linux/spinlock_types.h:43:44: note: in definition of macro 'DEFINE_SPINLOCK'
43 | #define DEFINE_SPINLOCK(x) spinlock_t x = __SPIN_LOCK_UNLOCKED(x)
| ^

vim +/huge_anon_orders_lock +80 mm/huge_memory.c

    48	
    49	/*
    50	 * By default, transparent hugepage support is disabled in order to avoid
    51	 * risking an increased memory footprint for applications that are not
    52	 * guaranteed to benefit from it. When transparent hugepage support is
    53	 * enabled, it is for all mappings, and khugepaged scans all mappings.
    54	 * Defrag is invoked by khugepaged hugepage allocations and by page faults
    55	 * for all hugepage allocations.
    56	 */
    57	unsigned long transparent_hugepage_flags __read_mostly =
    58	#ifdef CONFIG_TRANSPARENT_HUGEPAGE_ALWAYS
    59		(1<<TRANSPARENT_HUGEPAGE_FLAG)|
    60	#endif
    61	#ifdef CONFIG_TRANSPARENT_HUGEPAGE_MADVISE
    62		(1<<TRANSPARENT_HUGEPAGE_REQ_MADV_FLAG)|
    63	#endif
    64		(1<<TRANSPARENT_HUGEPAGE_DEFRAG_REQ_MADV_FLAG)|
    65		(1<<TRANSPARENT_HUGEPAGE_DEFRAG_KHUGEPAGED_FLAG)|
    66		(1<<TRANSPARENT_HUGEPAGE_USE_ZERO_PAGE_FLAG);
    67	
    68	static struct shrinker *deferred_split_shrinker;
    69	static unsigned long deferred_split_count(struct shrinker *shrink,
    70						  struct shrink_control *sc);
    71	static unsigned long deferred_split_scan(struct shrinker *shrink,
    72						 struct shrink_control *sc);
    73	
    74	static atomic_t huge_zero_refcount;
    75	struct page *huge_zero_page __read_mostly;
    76	unsigned long huge_zero_pfn __read_mostly = ~0UL;
    77	unsigned long huge_anon_orders_always __read_mostly;
    78	unsigned long huge_anon_orders_madvise __read_mostly;
    79	unsigned long huge_anon_orders_inherit __read_mostly;
  > 80	static DEFINE_SPINLOCK(huge_anon_orders_lock);
    81	
Signature · 2 lines
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
reviewer
#1 lore raw

PATCH 1/1 mm: thp: Fix build warning when CONFIG_SYSFS is disabled

huge_anon_orders_lock is used only to serialize sysfs writers. So move its definition so that it is within the CONFIG_SYSFS ifdefery to suppress "defined but not used" warning when sysfs is disabled.

Fixes fe2c9313a8c0 ("mm: thp: Introduce multi-size THP sysfs interface")

---

Hi Andrew,

David mentioned that your preference is to squash minor fixes into patches in mm-unstable? Could you please squash this into commit fe2c9313a8c0 ("mm: thp:
Introduce multi-size THP sysfs interface")?

Thanks,
Ryan

 mm/huge_memory.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
mm/huge_memory.c +1 -1
index cfb1d04a71b1..ddf73422d3b5 100644
@@ -77,7 +77,6 @@ unsigned long huge_zero_pfn __read_mostly = ~0UL;
 unsigned long huge_anon_orders_always __read_mostly;
 unsigned long huge_anon_orders_madvise __read_mostly;
 unsigned long huge_anon_orders_inherit __read_mostly;
-static DEFINE_SPINLOCK(huge_anon_orders_lock);
 
 unsigned long __thp_vma_allowable_orders(struct vm_area_struct *vma,
 					 unsigned long vm_flags, bool smaps,
@@ -442,6 +441,7 @@ static const struct attribute_group hugepage_attr_group = {
 
 static void hugepage_exit_sysfs(struct kobject *hugepage_kobj);
 static void thpsize_release(struct kobject *kobj);
+static DEFINE_SPINLOCK(huge_anon_orders_lock);
 static LIST_HEAD(thpsize_list);
 
 struct thpsize {

--
2.25.1