All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mm: add dummy can_do_mlock() helper
@ 2019-09-09 20:41 Arnd Bergmann
  2019-09-10  7:10 ` Michal Hocko
  0 siblings, 1 reply; 5+ messages in thread
From: Arnd Bergmann @ 2019-09-09 20:41 UTC (permalink / raw)
  To: Andrew Morton
  Cc: linux-mm, linux-rdma, Arnd Bergmann, Jason Gunthorpe,
	Bernard Metzler, Matthew Wilcox (Oracle),
	Michal Hocko, Kirill A. Shutemov, linux-kernel

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")
Suggested-by: Jason Gunthorpe <jgg@mellanox.com>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 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);
+#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 *);
 
-- 
2.20.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] mm: add dummy can_do_mlock() helper
  2019-09-09 20:41 [PATCH] mm: add dummy can_do_mlock() helper Arnd Bergmann
@ 2019-09-10  7:10 ` Michal Hocko
  2019-09-10  7:31     ` Arnd Bergmann
  2019-09-10  8:40   ` Jason Gunthorpe
  0 siblings, 2 replies; 5+ messages in thread
From: Michal Hocko @ 2019-09-10  7:10 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Andrew Morton, linux-mm, linux-rdma, Jason Gunthorpe,
	Bernard Metzler, Matthew Wilcox (Oracle),
	Kirill A. Shutemov, linux-kernel

On Mon 09-09-19 22:41:40, Arnd Bergmann wrote:
> 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")
> Suggested-by: Jason Gunthorpe <jgg@mellanox.com>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>

Makes sense
Acked-by: Michal Hocko <mhocko@suse.com>

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

> ---
>  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);
> +#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 *);
>  
> -- 
> 2.20.0
> 

-- 
Michal Hocko
SUSE Labs

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] mm: add dummy can_do_mlock() helper
  2019-09-10  7:10 ` Michal Hocko
@ 2019-09-10  7:31     ` Arnd Bergmann
  2019-09-10  8:40   ` Jason Gunthorpe
  1 sibling, 0 replies; 5+ messages in thread
From: Arnd Bergmann @ 2019-09-10  7:31 UTC (permalink / raw)
  To: Michal Hocko
  Cc: Andrew Morton, Linux-MM, linux-rdma, Jason Gunthorpe,
	Bernard Metzler, Matthew Wilcox (Oracle),
	Kirill A. Shutemov, linux-kernel

On Tue, Sep 10, 2019 at 9:10 AM Michal Hocko <mhocko@kernel.org> wrote:

> 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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] mm: add dummy can_do_mlock() helper
@ 2019-09-10  7:31     ` Arnd Bergmann
  0 siblings, 0 replies; 5+ messages in thread
From: Arnd Bergmann @ 2019-09-10  7:31 UTC (permalink / raw)
  To: Michal Hocko
  Cc: Andrew Morton, Linux-MM, linux-rdma, Jason Gunthorpe,
	Bernard Metzler, Matthew Wilcox (Oracle),
	Kirill A. Shutemov, linux-kernel

On Tue, Sep 10, 2019 at 9:10 AM Michal Hocko <mhocko@kernel.org> wrote:

> 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


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] mm: add dummy can_do_mlock() helper
  2019-09-10  7:10 ` Michal Hocko
  2019-09-10  7:31     ` Arnd Bergmann
@ 2019-09-10  8:40   ` Jason Gunthorpe
  1 sibling, 0 replies; 5+ messages in thread
From: Jason Gunthorpe @ 2019-09-10  8:40 UTC (permalink / raw)
  To: Michal Hocko
  Cc: Arnd Bergmann, Andrew Morton, linux-mm, linux-rdma,
	Bernard Metzler, Matthew Wilcox (Oracle),
	Kirill A. Shutemov, linux-kernel

On Tue, Sep 10, 2019 at 09:10:30AM +0200, Michal Hocko wrote:
> On Mon 09-09-19 22:41:40, Arnd Bergmann wrote:
> > 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")
> > Suggested-by: Jason Gunthorpe <jgg@mellanox.com>
> > Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> 
> Makes sense
> Acked-by: Michal Hocko <mhocko@suse.com>
> 
> 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

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2019-09-10  8:40 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-09 20:41 [PATCH] mm: add dummy can_do_mlock() helper Arnd Bergmann
2019-09-10  7:10 ` Michal Hocko
2019-09-10  7:31   ` Arnd Bergmann
2019-09-10  7:31     ` Arnd Bergmann
2019-09-10  8:40   ` Jason Gunthorpe

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.