linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [linux-next:master 6443/6992] mm/huge_memory.c:80:24: warning: 'huge_anon_orders_lock' defined but not used
@ 2023-12-11 11:37 kernel test robot
  2023-12-11 12:53 ` [PATCH] mm: thp: Fix build warning when CONFIG_SYSFS is disabled Ryan Roberts
  0 siblings, 1 reply; 2+ messages in thread
From: kernel test robot @ 2023-12-11 11:37 UTC (permalink / raw)
  To: Ryan Roberts
  Cc: oe-kbuild-all, Linux Memory Management List, Andrew Morton, Barry Song

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/202312111916.YbsHxKPq-lkp@intel.com/config)
compiler: s390-linux-gcc (GCC) 13.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20231211/202312111916.YbsHxKPq-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/202312111916.YbsHxKPq-lkp@intel.com/

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	

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


^ permalink raw reply	[flat|nested] 2+ messages in thread

* [PATCH] mm: thp: Fix build warning when CONFIG_SYSFS is disabled
  2023-12-11 11:37 [linux-next:master 6443/6992] mm/huge_memory.c:80:24: warning: 'huge_anon_orders_lock' defined but not used kernel test robot
@ 2023-12-11 12:53 ` Ryan Roberts
  0 siblings, 0 replies; 2+ messages in thread
From: Ryan Roberts @ 2023-12-11 12:53 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Ryan Roberts, kernel test robot, oe-kbuild-all,
	Linux Memory Management List, Barry Song

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")
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202312111916.YbsHxKPq-lkp@intel.com/
Signed-off-by: Ryan Roberts <ryan.roberts@arm.com>
---

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(-)

diff --git a/mm/huge_memory.c b/mm/huge_memory.c
index cfb1d04a71b1..ddf73422d3b5 100644
--- a/mm/huge_memory.c
+++ b/mm/huge_memory.c
@@ -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



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-12-11 12:53 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-12-11 11:37 [linux-next:master 6443/6992] mm/huge_memory.c:80:24: warning: 'huge_anon_orders_lock' defined but not used kernel test robot
2023-12-11 12:53 ` [PATCH] mm: thp: Fix build warning when CONFIG_SYSFS is disabled Ryan Roberts

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox