Re: [PATCH 12/12] vmstat: include compaction.h whenCONFIG_COMPACTION

From: Andrew Morton
Date: Tue Oct 05 2010 - 17:28:27 EST



Some of these patches do make the code significantly more complex to
read and follow. Boy, I hope it's all useful!

On Thu, 30 Sep 2010 12:50:21 +0900
Namhyung Kim <namhyung@xxxxxxxxx> wrote:

> This removes following warning from sparse:
>
> mm/vmstat.c:466:5: warning: symbol 'fragmentation_index' was not declared. Should it be static?
>
> Signed-off-by: Namhyung Kim <namhyung@xxxxxxxxx>
> ---
> mm/vmstat.c | 2 ++
> 1 files changed, 2 insertions(+), 0 deletions(-)
>
> diff --git a/mm/vmstat.c b/mm/vmstat.c
> index 355a9e6..30054ea 100644
> --- a/mm/vmstat.c
> +++ b/mm/vmstat.c
> @@ -394,6 +394,8 @@ void zone_statistics(struct zone *preferred_zone, struct zone *z)
> #endif
>
> #ifdef CONFIG_COMPACTION
> +#include <linux/compaction.h>
> +
> struct contig_page_info {
> unsigned long free_pages;
> unsigned long free_blocks_total;

This isn't a good idea: there's a good chance that someone will later
add a #include <linux/compaction.h> at the top of the file to support
future changes. So we end up including it twice.

So I assume the below will work OK??

--- a/mm/vmstat.c~vmstat-include-compactionh-when-config_compaction-fix
+++ a/mm/vmstat.c
@@ -18,6 +18,7 @@
#include <linux/sched.h>
#include <linux/math64.h>
#include <linux/writeback.h>
+#include <linux/compaction.h>

#ifdef CONFIG_VM_EVENT_COUNTERS
DEFINE_PER_CPU(struct vm_event_state, vm_event_states) = {{0}};
@@ -395,7 +396,6 @@ void zone_statistics(struct zone *prefer
#endif

#ifdef CONFIG_COMPACTION
-#include <linux/compaction.h>

struct contig_page_info {
unsigned long free_pages;
_

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/