Skip to contentSkip to conversation

KSM broken in the CONFIG_MMU=n case

PATCH David Howells 1 participant 1 message Dec 16, 2009

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

Hi Hugh,

The KSM code is broken in the CONFIG_MMU=n case as enum ttu_flags is required, but not defined. Simply predeclaring it doesn't help as the argument isn't a pointer to a value of that type.

I've attached a patch below to deal with it; it's a bit messy, though, as the fallback ksm_exit() is required in both the NOMMU and no-KSM cases.

David
---
From: David Howells <[email protected]>
Subject: [PATCH] NOMMU: Fix KSM in the CONFIG_MMU=n case

Fix KSM in the CONFIG_MMU=n case:

In file included from kernel/fork.c:52:
include/linux/ksm.h:129: warning: 'enum ttu_flags' declared inside parameter list include/linux/ksm.h:129: warning: its scope is only this definition or declaration, which is probably not what you want include/linux/ksm.h:129: error: parameter 2 ('flags') has incomplete type

by making most of linux/ksm.h contingent on CONFIG_MMU=y. The fallback version of ksm_exit() requires special handling as that is also used in the MMU=y, KSM=n case.

---

 include/linux/ksm.h |   12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)
include/linux/ksm.h +8 -4
index bed5f16..7f1e1f0 100644
@@ -16,6 +16,7 @@
 struct stable_node;
 struct mem_cgroup;
 
+#ifdef CONFIG_MMU
 #ifdef CONFIG_KSM
 int ksm_madvise(struct vm_area_struct *vma, unsigned long start,
 		unsigned long end, int advice, unsigned long *vm_flags);
@@ -105,10 +106,6 @@ static inline int ksm_fork(struct mm_struct *mm, struct mm_struct *oldmm)
 	return 0;
 }
 
-static inline void ksm_exit(struct mm_struct *mm)
-{
-}
-
 static inline int PageKsm(struct page *page)
 {
 	return 0;
@@ -141,5 +138,12 @@ static inline void ksm_migrate_page(struct page *newpage, struct page *oldpage)
 {
 }
 #endif /* !CONFIG_KSM */
+#endif /* CONFIG_MMU */
+
+#if !defined(CONFIG_MMU) || !defined(CONFIG_KSM)
+static inline void ksm_exit(struct mm_struct *mm)
+{
+}
+#endif
 
 #endif /* __LINUX_KSM_H */

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>