linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mm: fix potential build error in compaction.h
@ 2019-02-08  8:04 Yu Zhao
  2019-02-12 12:03 ` Michal Hocko
  0 siblings, 1 reply; 4+ messages in thread
From: Yu Zhao @ 2019-02-08  8:04 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-kernel, Yu Zhao

Declaration of struct node is required regardless. On UMA system,
including compaction.h without proceeding node.h shouldn't cause
build error.

Signed-off-by: Yu Zhao <yuzhao@google.com>
---
 include/linux/compaction.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/linux/compaction.h b/include/linux/compaction.h
index 68250a57aace..be165b220996 100644
--- a/include/linux/compaction.h
+++ b/include/linux/compaction.h
@@ -220,22 +220,22 @@ static inline int kcompactd_run(int nid)
 static inline void kcompactd_stop(int nid)
 {
 }
 
 static inline void wakeup_kcompactd(pg_data_t *pgdat, int order, int classzone_idx)
 {
 }
 
 #endif /* CONFIG_COMPACTION */
 
-#if defined(CONFIG_COMPACTION) && defined(CONFIG_SYSFS) && defined(CONFIG_NUMA)
 struct node;
+#if defined(CONFIG_COMPACTION) && defined(CONFIG_SYSFS) && defined(CONFIG_NUMA)
 extern int compaction_register_node(struct node *node);
 extern void compaction_unregister_node(struct node *node);
 
 #else
 
 static inline int compaction_register_node(struct node *node)
 {
 	return 0;
 }
 
-- 
2.20.1.791.gb4d0f1c61a-goog


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

* Re: [PATCH] mm: fix potential build error in compaction.h
  2019-02-08  8:04 [PATCH] mm: fix potential build error in compaction.h Yu Zhao
@ 2019-02-12 12:03 ` Michal Hocko
  2019-02-12 23:38   ` Yu Zhao
  0 siblings, 1 reply; 4+ messages in thread
From: Michal Hocko @ 2019-02-12 12:03 UTC (permalink / raw)
  To: Yu Zhao; +Cc: Andrew Morton, linux-kernel

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. Anyway have you seen an actual build breakage?
-- 
Michal Hocko
SUSE Labs

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

* Re: [PATCH] mm: fix potential build error in compaction.h
  2019-02-12 12:03 ` Michal Hocko
@ 2019-02-12 23:38   ` Yu Zhao
  2019-02-13 13:00     ` Michal Hocko
  0 siblings, 1 reply; 4+ messages in thread
From: Yu Zhao @ 2019-02-12 23:38 UTC (permalink / raw)
  To: Michal Hocko; +Cc: Andrew Morton, linux-kernel

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>

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

* Re: [PATCH] mm: fix potential build error in compaction.h
  2019-02-12 23:38   ` Yu Zhao
@ 2019-02-13 13:00     ` Michal Hocko
  0 siblings, 0 replies; 4+ messages in thread
From: Michal Hocko @ 2019-02-13 13:00 UTC (permalink / raw)
  To: Yu Zhao; +Cc: Andrew Morton, linux-kernel

On Tue 12-02-19 16:38:58, Yu Zhao wrote:
> 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>

OK, fair enough. A subtle header file ordering dependencies are PITA.

Acked-by: Michal Hocko <mhocko@suse.com>

-- 
Michal Hocko
SUSE Labs

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

end of thread, other threads:[~2019-02-13 13:00 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-02-08  8:04 [PATCH] mm: fix potential build error in compaction.h Yu Zhao
2019-02-12 12:03 ` Michal Hocko
2019-02-12 23:38   ` Yu Zhao
2019-02-13 13:00     ` Michal Hocko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).