Skip to contentSkip to conversation

mm: add dummy can_do_mlock() helper

PATCH In review Arnd Bergmann 3 participants 4 messages Sep 9, 2019 – Sep 10, 2019

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

PATCH 1/1 mm: add dummy can_do_mlock() helper

On kernels without CONFIG_MMU, we get a link error for the siw driver:

drivers/infiniband/sw/siw/siw_mem.o: In function `siw_umem_get':
siw_mem.c:(.text+0x4c8): undefined reference to `can_do_mlock'

This is probably not the only driver that needs the function and could otherwise build correctly without CONFIG_MMU, so add a dummy variant that always returns false.

Fixes 2251334dcac9 ("rdma/siw: application buffer management")
---
 include/linux/mm.h | 4 ++++
 1 file changed, 4 insertions(+)
include/linux/mm.h +4 -0
index 66f296181bcc..cc292273e6ba 100644
@@ -1424,7 +1424,11 @@ extern void pagefault_out_of_memory(void);
 
 extern void show_free_areas(unsigned int flags, nodemask_t *nodemask);
 
+#ifdef CONFIG_MMU
 extern bool can_do_mlock(void);
+#else
+static inline bool can_do_mlock(void) { return false; }
+#endif
 extern int user_shm_lock(size_t, struct user_struct *);
 extern void user_shm_unlock(size_t, struct user_struct *);
 
Signature · 1 line
2.20.0
Acked-by on v1 1/1
#1 lore raw
Quoted 6 lines · Arnd Bergmann

On kernels without CONFIG_MMU, we get a link error for the siw driver:

drivers/infiniband/sw/siw/siw_mem.o: In function `siw_umem_get':
siw_mem.c:(.text+0x4c8): undefined reference to `can_do_mlock'

Quoted 7 lines

This is probably not the only driver that needs the function and could otherwise build correctly without CONFIG_MMU, so add a dummy variant that always returns false.

Fixes 2251334dcac9 ("rdma/siw: application buffer management")

Makes sense

but IB on nonMMU? Whut? Is there any HW that actually supports this? Just wondering...

Quoted 23 lines
---
 include/linux/mm.h | 4 ++++
 1 file changed, 4 insertions(+)
include/linux/mm.h +4 -0
index 66f296181bcc..cc292273e6ba 100644
@@ -1424,7 +1424,11 @@ extern void pagefault_out_of_memory(void);
 
 extern void show_free_areas(unsigned int flags, nodemask_t *nodemask);
 
+#ifdef CONFIG_MMU
 extern bool can_do_mlock(void);
+#else
+static inline bool can_do_mlock(void) { return false; }
+#endif
 extern int user_shm_lock(size_t, struct user_struct *);
 extern void user_shm_unlock(size_t, struct user_struct *);
 
Signature · 1 line
2.20.0
Signature · 2 lines
Michal Hocko
SUSE Labs
#2 lore raw
Quoted 2 lines · Michal Hocko

but IB on nonMMU? Whut? Is there any HW that actually supports this? Just wondering...

Probably not, but I can't think of a good reason to completely disable it in Kconfig.
Almost everything can be built without MMU at the moment, but the subset of things that are actually useful is hard to know.

Arnd

#3 lore raw
In reply to Michal Hocko
Quoted 15 lines · Michal Hocko
Quoted 6 lines · Arnd Bergmann

On kernels without CONFIG_MMU, we get a link error for the siw driver:

drivers/infiniband/sw/siw/siw_mem.o: In function `siw_umem_get':
siw_mem.c:(.text+0x4c8): undefined reference to `can_do_mlock'

Quoted 7 lines

This is probably not the only driver that needs the function and could otherwise build correctly without CONFIG_MMU, so add a dummy variant that always returns false.

Fixes 2251334dcac9 ("rdma/siw: application buffer management")
Quoted 5 lines

Makes sense

but IB on nonMMU? Whut? Is there any HW that actually supports this? Just wondering...

I've never heard of anyone doing this configuration, and I don't really know much about nommu to comment if it could even potentially work or not..

Jason