diff mbox series

[for-mm,1/2,v2] mm/internal: Implement no-op mlock_page_drain() for !CONFIG_MMU

Message ID 8eae6026-098-befb-92d3-b9ad2ad57776@google.com (mailing list archive)
State New
Headers show
Series [for-mm,1/2,v2] mm/internal: Implement no-op mlock_page_drain() for !CONFIG_MMU | expand

Commit Message

Hugh Dickins Feb. 10, 2022, 4:44 a.m. UTC
From: SeongJae Park <sj@kernel.org>

Commit 4b3b8bd6c8287 ("mm/munlock: mlock_page() munlock_page() batch by
pagevec") in -mm tree[1] implements 'mlock_page_drain()' under
CONFIG_MMU only, but the function is used by 'lru_add_drain_cpu()',
which defined outside of CONFIG_MMU.  As a result, below build error
occurs.

    /linux/mm/swap.c: In function 'lru_add_drain_cpu':
    /linux/mm/swap.c:637:2: error: implicit declaration of function 'mlock_page_drain' [-Werror=implicit-function-declaration]
      637 |  mlock_page_drain(cpu);
          |  ^~~~~~~~~~~~~~~~
    cc1: some warnings being treated as errors
    /linux/scripts/Makefile.build:289: recipe for target 'mm/swap.o' failed

This commit fixes it by implementing no-op 'mlock_page_drain()' for
!CONFIG_MMU case, similar to 'mlock_new_page()'.

[1] https://www.ozlabs.org/~akpm/mmotm/broken-out/mm-munlock-mlock_page-munlock_page-batch-by-pagevec.patch

[hughd: add need_mlock_page_drain() stub too]
Signed-off-by: SeongJae Park <sj@kernel.org>
Signed-off-by: Hugh Dickins <hughd@google.com>
---
Andrew, Stephen, please add as fix to
mm-munlock-mlock_page-munlock_page-batch-by-pagevec.patch
Thanks!

 mm/internal.h |    2 ++
 1 file changed, 2 insertions(+)

Comments

SeongJae Park Feb. 10, 2022, 7:58 a.m. UTC | #1
On Wed, 9 Feb 2022 20:44:02 -0800 (PST) Hugh Dickins <hughd@google.com> wrote:

> From: SeongJae Park <sj@kernel.org>
> 
> Commit 4b3b8bd6c8287 ("mm/munlock: mlock_page() munlock_page() batch by
> pagevec") in -mm tree[1] implements 'mlock_page_drain()' under
> CONFIG_MMU only, but the function is used by 'lru_add_drain_cpu()',
> which defined outside of CONFIG_MMU.  As a result, below build error
> occurs.
> 
>     /linux/mm/swap.c: In function 'lru_add_drain_cpu':
>     /linux/mm/swap.c:637:2: error: implicit declaration of function 'mlock_page_drain' [-Werror=implicit-function-declaration]
>       637 |  mlock_page_drain(cpu);
>           |  ^~~~~~~~~~~~~~~~
>     cc1: some warnings being treated as errors
>     /linux/scripts/Makefile.build:289: recipe for target 'mm/swap.o' failed
> 
> This commit fixes it by implementing no-op 'mlock_page_drain()' for
> !CONFIG_MMU case, similar to 'mlock_new_page()'.
> 
> [1] https://www.ozlabs.org/~akpm/mmotm/broken-out/mm-munlock-mlock_page-munlock_page-batch-by-pagevec.patch
> 
> [hughd: add need_mlock_page_drain() stub too]
> Signed-off-by: SeongJae Park <sj@kernel.org>
> Signed-off-by: Hugh Dickins <hughd@google.com>
> ---
> Andrew, Stephen, please add as fix to
> mm-munlock-mlock_page-munlock_page-batch-by-pagevec.patch
> Thanks!

Thank you, Hugh!


Thanks,
SJ

> 
>  mm/internal.h |    2 ++
>  1 file changed, 2 insertions(+)
> 
> --- a/mm/internal.h
> +++ b/mm/internal.h
> @@ -508,6 +508,8 @@ static inline void mlock_vma_page(struct page *page,
>  static inline void munlock_vma_page(struct page *page,
>  			struct vm_area_struct *vma, bool compound) { }
>  static inline void mlock_new_page(struct page *page) { }
> +static inline bool need_mlock_page_drain(int cpu) { return false; }
> +static inline void mlock_page_drain(int cpu) { }
>  static inline void vunmap_range_noflush(unsigned long start, unsigned long end)
>  {
>  }
>
Stephen Rothwell Feb. 11, 2022, 3:58 a.m. UTC | #2
Hi Hugh,

On Wed, 9 Feb 2022 20:44:02 -0800 (PST) Hugh Dickins <hughd@google.com> wrote:
>
> From: SeongJae Park <sj@kernel.org>
> 
> Commit 4b3b8bd6c8287 ("mm/munlock: mlock_page() munlock_page() batch by
> pagevec") in -mm tree[1] implements 'mlock_page_drain()' under
> CONFIG_MMU only, but the function is used by 'lru_add_drain_cpu()',
> which defined outside of CONFIG_MMU.  As a result, below build error
> occurs.
> 
>     /linux/mm/swap.c: In function 'lru_add_drain_cpu':
>     /linux/mm/swap.c:637:2: error: implicit declaration of function 'mlock_page_drain' [-Werror=implicit-function-declaration]
>       637 |  mlock_page_drain(cpu);
>           |  ^~~~~~~~~~~~~~~~
>     cc1: some warnings being treated as errors
>     /linux/scripts/Makefile.build:289: recipe for target 'mm/swap.o' failed
> 
> This commit fixes it by implementing no-op 'mlock_page_drain()' for
> !CONFIG_MMU case, similar to 'mlock_new_page()'.
> 
> [1] https://www.ozlabs.org/~akpm/mmotm/broken-out/mm-munlock-mlock_page-munlock_page-batch-by-pagevec.patch
> 
> [hughd: add need_mlock_page_drain() stub too]
> Signed-off-by: SeongJae Park <sj@kernel.org>
> Signed-off-by: Hugh Dickins <hughd@google.com>
> ---
> Andrew, Stephen, please add as fix to
> mm-munlock-mlock_page-munlock_page-batch-by-pagevec.patch
> Thanks!
> 
>  mm/internal.h |    2 ++
>  1 file changed, 2 insertions(+)
> 
> --- a/mm/internal.h
> +++ b/mm/internal.h
> @@ -508,6 +508,8 @@ static inline void mlock_vma_page(struct page *page,
>  static inline void munlock_vma_page(struct page *page,
>  			struct vm_area_struct *vma, bool compound) { }
>  static inline void mlock_new_page(struct page *page) { }
> +static inline bool need_mlock_page_drain(int cpu) { return false; }
> +static inline void mlock_page_drain(int cpu) { }
>  static inline void vunmap_range_noflush(unsigned long start, unsigned long end)
>  {
>  }

Added to linux-next from today.
diff mbox series

Patch

--- a/mm/internal.h
+++ b/mm/internal.h
@@ -508,6 +508,8 @@  static inline void mlock_vma_page(struct page *page,
 static inline void munlock_vma_page(struct page *page,
 			struct vm_area_struct *vma, bool compound) { }
 static inline void mlock_new_page(struct page *page) { }
+static inline bool need_mlock_page_drain(int cpu) { return false; }
+static inline void mlock_page_drain(int cpu) { }
 static inline void vunmap_range_noflush(unsigned long start, unsigned long end)
 {
 }