Skip to content

Commit 3c48687

Browse files
akpm00torvalds
authored andcommitted
mm/vmstat.c: fix/cleanup ifdefs
CONFIG_COMPACTION=y, CONFIG_DEBUG_FS=n: mm/vmstat.c:690: warning: 'frag_start' defined but not used mm/vmstat.c:702: warning: 'frag_next' defined but not used mm/vmstat.c:710: warning: 'frag_stop' defined but not used mm/vmstat.c:715: warning: 'walk_zones_in_node' defined but not used It's all a bit of a tangly mess and it's unclear why CONFIG_COMPACTION figures in there at all. Move frag_start/frag_next/frag_stop and migratetype_names[] into the existing CONFIG_PROC_FS block. walk_zones_in_node() gets a special ifdef. Also move the #include lines up to where #include lines live. [[email protected]: fix build error when !CONFIG_PROC_FS] Signed-off-by: Axel Lin <[email protected]> Cc: Mel Gorman <[email protected]> Cc: Joonsoo Kim <[email protected]> Cc: Mel Gorman <[email protected]> Cc: Joonsoo Kim <[email protected]> Tested-by: David Rientjes <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
1 parent 7c4da06 commit 3c48687

File tree

1 file changed

+62
-62
lines changed

1 file changed

+62
-62
lines changed

mm/vmstat.c

Lines changed: 62 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@
1717
#include <linux/cpu.h>
1818
#include <linux/cpumask.h>
1919
#include <linux/vmstat.h>
20+
#include <linux/proc_fs.h>
21+
#include <linux/seq_file.h>
22+
#include <linux/debugfs.h>
2023
#include <linux/sched.h>
2124
#include <linux/math64.h>
2225
#include <linux/writeback.h>
@@ -670,66 +673,6 @@ int fragmentation_index(struct zone *zone, unsigned int order)
670673
}
671674
#endif
672675

673-
#if defined(CONFIG_PROC_FS) || defined(CONFIG_COMPACTION)
674-
#include <linux/proc_fs.h>
675-
#include <linux/seq_file.h>
676-
677-
static char * const migratetype_names[MIGRATE_TYPES] = {
678-
"Unmovable",
679-
"Reclaimable",
680-
"Movable",
681-
"Reserve",
682-
#ifdef CONFIG_CMA
683-
"CMA",
684-
#endif
685-
#ifdef CONFIG_MEMORY_ISOLATION
686-
"Isolate",
687-
#endif
688-
};
689-
690-
static void *frag_start(struct seq_file *m, loff_t *pos)
691-
{
692-
pg_data_t *pgdat;
693-
loff_t node = *pos;
694-
for (pgdat = first_online_pgdat();
695-
pgdat && node;
696-
pgdat = next_online_pgdat(pgdat))
697-
--node;
698-
699-
return pgdat;
700-
}
701-
702-
static void *frag_next(struct seq_file *m, void *arg, loff_t *pos)
703-
{
704-
pg_data_t *pgdat = (pg_data_t *)arg;
705-
706-
(*pos)++;
707-
return next_online_pgdat(pgdat);
708-
}
709-
710-
static void frag_stop(struct seq_file *m, void *arg)
711-
{
712-
}
713-
714-
/* Walk all the zones in a node and print using a callback */
715-
static void walk_zones_in_node(struct seq_file *m, pg_data_t *pgdat,
716-
void (*print)(struct seq_file *m, pg_data_t *, struct zone *))
717-
{
718-
struct zone *zone;
719-
struct zone *node_zones = pgdat->node_zones;
720-
unsigned long flags;
721-
722-
for (zone = node_zones; zone - node_zones < MAX_NR_ZONES; ++zone) {
723-
if (!populated_zone(zone))
724-
continue;
725-
726-
spin_lock_irqsave(&zone->lock, flags);
727-
print(m, pgdat, zone);
728-
spin_unlock_irqrestore(&zone->lock, flags);
729-
}
730-
}
731-
#endif
732-
733676
#if defined(CONFIG_PROC_FS) || defined(CONFIG_SYSFS) || defined(CONFIG_NUMA)
734677
#ifdef CONFIG_ZONE_DMA
735678
#define TEXT_FOR_DMA(xx) xx "_dma",
@@ -907,7 +850,66 @@ const char * const vmstat_text[] = {
907850
#endif /* CONFIG_PROC_FS || CONFIG_SYSFS || CONFIG_NUMA */
908851

909852

853+
#if (defined(CONFIG_DEBUG_FS) && defined(CONFIG_COMPACTION)) || \
854+
defined(CONFIG_PROC_FS)
855+
static void *frag_start(struct seq_file *m, loff_t *pos)
856+
{
857+
pg_data_t *pgdat;
858+
loff_t node = *pos;
859+
860+
for (pgdat = first_online_pgdat();
861+
pgdat && node;
862+
pgdat = next_online_pgdat(pgdat))
863+
--node;
864+
865+
return pgdat;
866+
}
867+
868+
static void *frag_next(struct seq_file *m, void *arg, loff_t *pos)
869+
{
870+
pg_data_t *pgdat = (pg_data_t *)arg;
871+
872+
(*pos)++;
873+
return next_online_pgdat(pgdat);
874+
}
875+
876+
static void frag_stop(struct seq_file *m, void *arg)
877+
{
878+
}
879+
880+
/* Walk all the zones in a node and print using a callback */
881+
static void walk_zones_in_node(struct seq_file *m, pg_data_t *pgdat,
882+
void (*print)(struct seq_file *m, pg_data_t *, struct zone *))
883+
{
884+
struct zone *zone;
885+
struct zone *node_zones = pgdat->node_zones;
886+
unsigned long flags;
887+
888+
for (zone = node_zones; zone - node_zones < MAX_NR_ZONES; ++zone) {
889+
if (!populated_zone(zone))
890+
continue;
891+
892+
spin_lock_irqsave(&zone->lock, flags);
893+
print(m, pgdat, zone);
894+
spin_unlock_irqrestore(&zone->lock, flags);
895+
}
896+
}
897+
#endif
898+
910899
#ifdef CONFIG_PROC_FS
900+
static char * const migratetype_names[MIGRATE_TYPES] = {
901+
"Unmovable",
902+
"Reclaimable",
903+
"Movable",
904+
"Reserve",
905+
#ifdef CONFIG_CMA
906+
"CMA",
907+
#endif
908+
#ifdef CONFIG_MEMORY_ISOLATION
909+
"Isolate",
910+
#endif
911+
};
912+
911913
static void frag_show_print(struct seq_file *m, pg_data_t *pgdat,
912914
struct zone *zone)
913915
{
@@ -1536,8 +1538,6 @@ static int __init setup_vmstat(void)
15361538
module_init(setup_vmstat)
15371539

15381540
#if defined(CONFIG_DEBUG_FS) && defined(CONFIG_COMPACTION)
1539-
#include <linux/debugfs.h>
1540-
15411541

15421542
/*
15431543
* Return an index indicating how much of the available free memory is

0 commit comments

Comments
 (0)