Skip to content

Commit

Permalink
mm: add dummy can_do_mlock() helper
Browse files Browse the repository at this point in the history
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.

Link: http://lkml.kernel.org/r/[email protected]
Fixes: 2251334 ("rdma/siw: application buffer management")
Signed-off-by: Arnd Bergmann <[email protected]>
Suggested-by: Jason Gunthorpe <[email protected]>
Acked-by: Michal Hocko <[email protected]>
Cc: Bernard Metzler <[email protected]>
Cc: "Matthew Wilcox (Oracle)" <[email protected]>
Cc: "Kirill A. Shutemov" <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
arndb authored and torvalds committed Sep 24, 2019
1 parent 6e73fd2 commit 710ec38
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions include/linux/mm.h
Original file line number Diff line number Diff line change
Expand Up @@ -1405,7 +1405,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 *);

Expand Down

0 comments on commit 710ec38

Please sign in to comment.