Subject: Re: linux-next: build failure after merge of the akpm tree

From: Andrew Morton <[email-masked]>
Date: Thu, 8 Dec 2011 21:47:44 -0800

On Fri, 9 Dec 2011 16:08:56 +1100 Stephen Rothwell <[email-masked]> wrote:

> Hi Andrew,
> 
> After merging the akpm tree, today's linux-next build (x86_64
> allmodconfig) failed like this:
> 
> In file included from kernel/fork.c:21:0:
> include/linux/mempolicy.h: In function 'task_has_mempolicy':
> include/linux/mempolicy.h:258:13: error: dereferencing pointer to incomplete type
> 
> And several more like that.
> 
> Caused by commit 9d15457f147d
> ("cpusets-stall-when-updating-mems_allowed-for-mempolicy-or-disjoint-nodemask-fix-2").

I suppose this is a good enough fix for that:

 include/linux/mempolicy.h |   10 ----------
 mm/mempolicy.c            |   12 ++++++++++++
 2 files changed, 12 insertions(+), 10 deletions(-)

diff -puN include/linux/mempolicy.h~cpusets-stall-when-updating-mems_allowed-for-mempolicy-or-disjoint-nodemask-fix-2-fix-2 include/linux/mempolicy.h
--- a/include/linux/mempolicy.h~cpusets-stall-when-updating-mems_allowed-for-mempolicy-or-disjoint-nodemask-fix-2-fix-2
+++ a/include/linux/mempolicy.h
@@ -253,11 +253,6 @@ static inline int vma_migratable(struct 
 	return 1;
 }
 
-static inline bool task_has_mempolicy(struct task_struct *task)
-{
-	return task->mempolicy;
-}
-
 #else
 
 struct mempolicy {};
@@ -384,11 +379,6 @@ static inline int mpol_to_str(char *buff
 	return 0;
 }
 
-static inline bool task_has_mempolicy(struct task_struct *task)
-{
-	return false;
-}
-
 #endif /* CONFIG_NUMA */
 #endif /* __KERNEL__ */
 
diff -puN mm/mempolicy.c~cpusets-stall-when-updating-mems_allowed-for-mempolicy-or-disjoint-nodemask-fix-2-fix-2 mm/mempolicy.c
--- a/mm/mempolicy.c~cpusets-stall-when-updating-mems_allowed-for-mempolicy-or-disjoint-nodemask-fix-2-fix-2
+++ a/mm/mempolicy.c
@@ -137,6 +137,18 @@ static const struct mempolicy_operations
 			enum mpol_rebind_step step);
 } mpol_ops[MPOL_MAX];
 
+#ifdef CONFIG_NUMA
+static inline bool task_has_mempolicy(struct task_struct *task)
+{
+	return task->mempolicy;
+}
+#else
+static inline bool task_has_mempolicy(struct task_struct *task)
+{
+	return false;
+}
+#endif
+
 /* Check that the nodemask contains at least one populated zone */
 static int is_valid_nodemask(const nodemask_t *nodemask)
 {
_

> I have reverted that patch for today (and the following trivial patch
> "cpusets-stall-when-updating-mems_allowed-for-mempolicy-or-disjoint-nodemask-fix-2-fix").

And I'll drop that one now.