All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mm: compaction: fix compiler warning when CONFIG_COMPACTION=n
@ 2022-03-18 13:01 Charan Teja Kalla
  2022-03-18 15:11 ` Vlastimil Babka
  0 siblings, 1 reply; 2+ messages in thread
From: Charan Teja Kalla @ 2022-03-18 13:01 UTC (permalink / raw)
  To: akpm, nigupta, vbabka; +Cc: linux-mm, linux-kernel, Charan Teja Kalla

The below warning is reported when CONFIG_COMPACTION=n:

   mm/compaction.c:56:27: warning: 'HPAGE_FRAG_CHECK_INTERVAL_MSEC'
defined but not used [-Wunused-const-variable=]
      56 | static const unsigned int HPAGE_FRAG_CHECK_INTERVAL_MSEC =
500;
         |                           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Fix it by moving 'HPAGE_FRAG_CHECK_INTERVAL_MSEC' under
CONFIG_COMPACTION defconfig. Also since this is just a 'static const
int' type, use #define for it.

Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Charan Teja Kalla <quic_charante@quicinc.com>
---
 mm/compaction.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/mm/compaction.c b/mm/compaction.c
index b4e94cd..4d86d04 100644
--- a/mm/compaction.c
+++ b/mm/compaction.c
@@ -26,6 +26,11 @@
 #include "internal.h"
 
 #ifdef CONFIG_COMPACTION
+/*
+ * Fragmentation score check interval for proactive compaction purposes.
+ */
+#define HPAGE_FRAG_CHECK_INTERVAL_MSEC	(500)
+
 static inline void count_compact_event(enum vm_event_item item)
 {
 	count_vm_event(item);
@@ -51,11 +56,6 @@ static inline void count_compact_events(enum vm_event_item item, long delta)
 #define pageblock_end_pfn(pfn)		block_end_pfn(pfn, pageblock_order)
 
 /*
- * Fragmentation score check interval for proactive compaction purposes.
- */
-static const unsigned int HPAGE_FRAG_CHECK_INTERVAL_MSEC = 500;
-
-/*
  * Page order with-respect-to which proactive compaction
  * calculates external fragmentation, which is used as
  * the "fragmentation score" of a node/zone.
-- 
2.7.4


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

* Re: [PATCH] mm: compaction: fix compiler warning when CONFIG_COMPACTION=n
  2022-03-18 13:01 [PATCH] mm: compaction: fix compiler warning when CONFIG_COMPACTION=n Charan Teja Kalla
@ 2022-03-18 15:11 ` Vlastimil Babka
  0 siblings, 0 replies; 2+ messages in thread
From: Vlastimil Babka @ 2022-03-18 15:11 UTC (permalink / raw)
  To: Charan Teja Kalla, akpm, nigupta; +Cc: linux-mm, linux-kernel

On 3/18/22 14:01, Charan Teja Kalla wrote:
> The below warning is reported when CONFIG_COMPACTION=n:
> 
>    mm/compaction.c:56:27: warning: 'HPAGE_FRAG_CHECK_INTERVAL_MSEC'
> defined but not used [-Wunused-const-variable=]
>       56 | static const unsigned int HPAGE_FRAG_CHECK_INTERVAL_MSEC =
> 500;
>          |                           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> 
> Fix it by moving 'HPAGE_FRAG_CHECK_INTERVAL_MSEC' under
> CONFIG_COMPACTION defconfig. Also since this is just a 'static const
> int' type, use #define for it.
> 
> Reported-by: kernel test robot <lkp@intel.com>
> Signed-off-by: Charan Teja Kalla <quic_charante@quicinc.com>

Acked-by: Vlastimil Babka <vbabka@suse.cz>

> ---
>  mm/compaction.c | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/mm/compaction.c b/mm/compaction.c
> index b4e94cd..4d86d04 100644
> --- a/mm/compaction.c
> +++ b/mm/compaction.c
> @@ -26,6 +26,11 @@
>  #include "internal.h"
>  
>  #ifdef CONFIG_COMPACTION
> +/*
> + * Fragmentation score check interval for proactive compaction purposes.
> + */
> +#define HPAGE_FRAG_CHECK_INTERVAL_MSEC	(500)
> +
>  static inline void count_compact_event(enum vm_event_item item)
>  {
>  	count_vm_event(item);
> @@ -51,11 +56,6 @@ static inline void count_compact_events(enum vm_event_item item, long delta)
>  #define pageblock_end_pfn(pfn)		block_end_pfn(pfn, pageblock_order)
>  
>  /*
> - * Fragmentation score check interval for proactive compaction purposes.
> - */
> -static const unsigned int HPAGE_FRAG_CHECK_INTERVAL_MSEC = 500;
> -
> -/*
>   * Page order with-respect-to which proactive compaction
>   * calculates external fragmentation, which is used as
>   * the "fragmentation score" of a node/zone.


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

end of thread, other threads:[~2022-03-18 15:11 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-18 13:01 [PATCH] mm: compaction: fix compiler warning when CONFIG_COMPACTION=n Charan Teja Kalla
2022-03-18 15:11 ` Vlastimil Babka

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.