Skip to content

Commit

Permalink
mm: compaction: fix compiler warning when CONFIG_COMPACTION=n
Browse files Browse the repository at this point in the history
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.

Link: https://lkml.kernel.org/r/[email protected]
Signed-off-by: Charan Teja Kalla <[email protected]>
Reported-by: kernel test robot <[email protected]>
Acked-by: Vlastimil Babka <[email protected]>
Cc: Nitin Gupta <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
Charan Teja Kalla authored and torvalds committed Apr 15, 2022
1 parent e914d8f commit 31ca72f
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions mm/compaction.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -50,11 +55,6 @@ static inline void count_compact_events(enum vm_event_item item, long delta)
#define pageblock_start_pfn(pfn) block_start_pfn(pfn, pageblock_order)
#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
Expand Down

0 comments on commit 31ca72f

Please sign in to comment.