Re: [PATCH] mm: fix potential build error in compaction.h

From: Yu Zhao
Date: Tue Feb 12 2019 - 18:39:04 EST

On Tue, Feb 12, 2019 at 01:03:58PM +0100, Michal Hocko wrote:
> On Fri 08-02-19 01:04:37, Yu Zhao wrote:
> > Declaration of struct node is required regardless. On UMA system,
> > including compaction.h without proceeding node.h shouldn't cause
> > build error.
> Anybody requiring struct node shouldn't depend on compaction.h to get
> the declaration.

Yes, but the problem is the other way around. Build error happens
when somebody includes compaction.h without definition or
declaration of struct node, if CONFIG_NUMA is not set.

compaction.h already has struct node declaration to avoid the error
when CONFIG_NUMA is set, but we need it for both cases.

> Anyway have you seen an actual build breakage?

Yes. I ran into the problem while trying to include compaction.h
in this order, and had to move it to the bottom as a workaround.

#include <linux/backing-dev.h>
#include <linux/compaction.h>
#include <linux/ctype.h>
#include <linux/freezer.h>
#include <linux/hugetlb.h>
#include <linux/kstaled.h>
#include <linux/kthread.h>
#include <linux/mm_inline.h>
#include <linux/mm_types.h>
#include <linux/module.h>
#include <linux/pagemap.h>
#include <linux/sched/task_stack.h>
#include <linux/swap.h>