Linux-mm Archive on
 help / color / Atom feed
From: Arnd Bergmann <>
To: Andrew Morton <>
	Arnd Bergmann <>, Jason Gunthorpe <>,
	Bernard Metzler <>,
	"Matthew Wilcox (Oracle)" <>,
	Michal Hocko <>,
	"Kirill A. Shutemov" <>,
Subject: [PATCH] mm: add dummy can_do_mlock() helper
Date: Mon,  9 Sep 2019 22:41:40 +0200
Message-ID: <> (raw)

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

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")
Suggested-by: Jason Gunthorpe <>
Signed-off-by: Arnd Bergmann <>
 include/linux/mm.h | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/include/linux/mm.h b/include/linux/mm.h
index 66f296181bcc..cc292273e6ba 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -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);
+static inline bool can_do_mlock(void) { return false; }
 extern int user_shm_lock(size_t, struct user_struct *);
 extern void user_shm_unlock(size_t, struct user_struct *);

             reply index

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-09 20:41 Arnd Bergmann [this message]
2019-09-10  7:10 ` Michal Hocko
2019-09-10  7:31   ` Arnd Bergmann
2019-09-10  8:40   ` Jason Gunthorpe

Reply instructions:

You may reply publically to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \ \ \ \ \ \ \ \ \ \ \ \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Linux-mm Archive on

Archives are clonable:
	git clone --mirror linux-mm/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-mm linux-mm/ \
	public-inbox-index linux-mm

Example config snippet for mirrors

Newsgroup available over NNTP:

AGPL code for this site: git clone public-inbox