* [PATCH for-mm 0/2] Fix trivial build errors on -mm tree
@ 2022-02-09 9:41 SeongJae Park
2022-02-09 9:41 ` [PATCH for-mm 1/2] mm/internal: Implement no-op mlock_page_drain() for !CONFIG_MMU SeongJae Park
2022-02-09 9:41 ` [PATCH for-mm 2/2] mm/gup: Make migrate_device_page() fails always if !CONFIG_DEVICE_PRIVATE SeongJae Park
0 siblings, 2 replies; 9+ messages in thread
From: SeongJae Park @ 2022-02-09 9:41 UTC (permalink / raw)
To: akpm; +Cc: linux-mm, linux-kernel, SeongJae Park
This patchset fixes a couple of build errors of latest -mm tree.
SeongJae Park (2):
mm/internal: Implement no-op mlock_page_drain() for !CONFIG_MMU
mm/gup: Make migrate_device_page() fails always if
!CONFIG_DEVICE_PRIVATE
mm/gup.c | 9 +++++++++
mm/internal.h | 1 +
2 files changed, 10 insertions(+)
--
2.17.1
^ permalink raw reply [flat|nested] 9+ messages in thread* [PATCH for-mm 1/2] mm/internal: Implement no-op mlock_page_drain() for !CONFIG_MMU 2022-02-09 9:41 [PATCH for-mm 0/2] Fix trivial build errors on -mm tree SeongJae Park @ 2022-02-09 9:41 ` SeongJae Park 2022-02-09 15:37 ` Hugh Dickins 2022-02-09 9:41 ` [PATCH for-mm 2/2] mm/gup: Make migrate_device_page() fails always if !CONFIG_DEVICE_PRIVATE SeongJae Park 1 sibling, 1 reply; 9+ messages in thread From: SeongJae Park @ 2022-02-09 9:41 UTC (permalink / raw) To: akpm; +Cc: linux-mm, linux-kernel, SeongJae Park, hughd 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 Signed-off-by: SeongJae Park <sj@kernel.org> --- mm/internal.h | 1 + 1 file changed, 1 insertion(+) diff --git a/mm/internal.h b/mm/internal.h index 0d240e876831..248224369b34 100644 --- a/mm/internal.h +++ b/mm/internal.h @@ -508,6 +508,7 @@ 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 void mlock_page_drain(int cpu) { } static inline void vunmap_range_noflush(unsigned long start, unsigned long end) { } -- 2.17.1 ^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH for-mm 1/2] mm/internal: Implement no-op mlock_page_drain() for !CONFIG_MMU 2022-02-09 9:41 ` [PATCH for-mm 1/2] mm/internal: Implement no-op mlock_page_drain() for !CONFIG_MMU SeongJae Park @ 2022-02-09 15:37 ` Hugh Dickins 2022-02-09 16:19 ` Geert Uytterhoeven 0 siblings, 1 reply; 9+ messages in thread From: Hugh Dickins @ 2022-02-09 15:37 UTC (permalink / raw) To: SeongJae Park; +Cc: akpm, linux-mm, linux-kernel, hughd, geert On Wed, 9 Feb 2022, SeongJae Park wrote: > 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 > > Signed-off-by: SeongJae Park <sj@kernel.org> > --- > mm/internal.h | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/mm/internal.h b/mm/internal.h > index 0d240e876831..248224369b34 100644 > --- a/mm/internal.h > +++ b/mm/internal.h > @@ -508,6 +508,7 @@ 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 void mlock_page_drain(int cpu) { } > static inline void vunmap_range_noflush(unsigned long start, unsigned long end) > { > } Thank you, SeongJae, and thank you Geert for reporting. This patch is good as far as it goes, but Andrew, please don't add it right now: I need to think a bit more, and will send another (or Ack SeongJae's) later in the day. The thing is, SeongJae's patch makes me wonder, why did it not need a !CONFIG_MMU definition for need_mlock_page_drain() too? That's because mm/swap.c's call to it is under an #ifdef CONFIG_SMP, and I imagine that CONFIG_MMU=n usually goes along with (but does not necessarily imply?) CONFIG_SMP=n. It'll be safer to add a need_mlock_page_drain() stub too. But more seriously, is the mlock_page_drain() going to be called when it's wanted, when CONFIG_SMP is not set? I had forgotten how mm/swap.c goes in different directions (for some things but not for others) according to CONFIG_SMP. I'll look into it and come back later. Thanks, Hugh ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH for-mm 1/2] mm/internal: Implement no-op mlock_page_drain() for !CONFIG_MMU 2022-02-09 15:37 ` Hugh Dickins @ 2022-02-09 16:19 ` Geert Uytterhoeven 2022-02-10 4:37 ` Hugh Dickins 2022-02-10 4:44 ` [PATCH for-mm 1/2 v2] " Hugh Dickins 0 siblings, 2 replies; 9+ messages in thread From: Geert Uytterhoeven @ 2022-02-09 16:19 UTC (permalink / raw) To: Hugh Dickins Cc: SeongJae Park, Andrew Morton, Linux MM, Linux Kernel Mailing List Hi Hugh, On Wed, Feb 9, 2022 at 4:38 PM Hugh Dickins <hughd@google.com> wrote: > The thing is, SeongJae's patch makes me wonder, why did it not need a > !CONFIG_MMU definition for need_mlock_page_drain() too? That's because > mm/swap.c's call to it is under an #ifdef CONFIG_SMP, and I imagine that > CONFIG_MMU=n usually goes along with (but does not necessarily imply?) > CONFIG_SMP=n. It'll be safer to add a need_mlock_page_drain() stub too. RISC-V K210 is SMP without MMU. Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH for-mm 1/2] mm/internal: Implement no-op mlock_page_drain() for !CONFIG_MMU 2022-02-09 16:19 ` Geert Uytterhoeven @ 2022-02-10 4:37 ` Hugh Dickins 2022-02-10 4:44 ` [PATCH for-mm 1/2 v2] " Hugh Dickins 1 sibling, 0 replies; 9+ messages in thread From: Hugh Dickins @ 2022-02-10 4:37 UTC (permalink / raw) To: Geert Uytterhoeven Cc: Hugh Dickins, SeongJae Park, Andrew Morton, Linux MM, Linux Kernel Mailing List On Wed, 9 Feb 2022, Geert Uytterhoeven wrote: > On Wed, Feb 9, 2022 at 4:38 PM Hugh Dickins <hughd@google.com> wrote: > > The thing is, SeongJae's patch makes me wonder, why did it not need a > > !CONFIG_MMU definition for need_mlock_page_drain() too? That's because > > mm/swap.c's call to it is under an #ifdef CONFIG_SMP, and I imagine that > > CONFIG_MMU=n usually goes along with (but does not necessarily imply?) > > CONFIG_SMP=n. It'll be safer to add a need_mlock_page_drain() stub too. > > RISC-V K210 is SMP without MMU. Thanks Geert, that makes it very clear that we also want the stub for need_mlock_page_drain(). I'll follow now with update of SeongJae's patch. My fear of wider implications of not having CONFIG_SMP turned out to be a false alarm. The UP lru_add_drain_cpu() calls mlock_page_drain() just like the SMP one does: the difference between them is merely that the UP case doesn't need an efficient way for asking in advance whether drain on another cpu will be needed. Hugh ^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH for-mm 1/2 v2] mm/internal: Implement no-op mlock_page_drain() for !CONFIG_MMU 2022-02-09 16:19 ` Geert Uytterhoeven 2022-02-10 4:37 ` Hugh Dickins @ 2022-02-10 4:44 ` Hugh Dickins 2022-02-10 7:58 ` SeongJae Park 2022-02-11 3:58 ` Stephen Rothwell 1 sibling, 2 replies; 9+ messages in thread From: Hugh Dickins @ 2022-02-10 4:44 UTC (permalink / raw) To: Andrew Morton, Stephen Rothwell Cc: Hugh Dickins, SeongJae Park, Andrew Morton, Geert Uytterhoeven, Naresh Kamboju, Linux MM, Linux Kernel Mailing List 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) { } ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH for-mm 1/2 v2] mm/internal: Implement no-op mlock_page_drain() for !CONFIG_MMU 2022-02-10 4:44 ` [PATCH for-mm 1/2 v2] " Hugh Dickins @ 2022-02-10 7:58 ` SeongJae Park 2022-02-11 3:58 ` Stephen Rothwell 1 sibling, 0 replies; 9+ messages in thread From: SeongJae Park @ 2022-02-10 7:58 UTC (permalink / raw) To: Hugh Dickins Cc: Andrew Morton, Stephen Rothwell, SeongJae Park, Geert Uytterhoeven, Naresh Kamboju, Linux MM, Linux Kernel Mailing List 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) > { > } > ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH for-mm 1/2 v2] mm/internal: Implement no-op mlock_page_drain() for !CONFIG_MMU 2022-02-10 4:44 ` [PATCH for-mm 1/2 v2] " Hugh Dickins 2022-02-10 7:58 ` SeongJae Park @ 2022-02-11 3:58 ` Stephen Rothwell 1 sibling, 0 replies; 9+ messages in thread From: Stephen Rothwell @ 2022-02-11 3:58 UTC (permalink / raw) To: Hugh Dickins Cc: Andrew Morton, SeongJae Park, Geert Uytterhoeven, Naresh Kamboju, Linux MM, Linux Kernel Mailing List [-- Attachment #1: Type: text/plain, Size: 1997 bytes --] 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. -- Cheers, Stephen Rothwell [-- Attachment #2: OpenPGP digital signature --] [-- Type: application/pgp-signature, Size: 488 bytes --] ^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH for-mm 2/2] mm/gup: Make migrate_device_page() fails always if !CONFIG_DEVICE_PRIVATE 2022-02-09 9:41 [PATCH for-mm 0/2] Fix trivial build errors on -mm tree SeongJae Park 2022-02-09 9:41 ` [PATCH for-mm 1/2] mm/internal: Implement no-op mlock_page_drain() for !CONFIG_MMU SeongJae Park @ 2022-02-09 9:41 ` SeongJae Park 1 sibling, 0 replies; 9+ messages in thread From: SeongJae Park @ 2022-02-09 9:41 UTC (permalink / raw) To: akpm; +Cc: linux-mm, linux-kernel, SeongJae Park, apopple Commit 7059ac82be44 ("mm/gup.c: migrate device coherent pages when pinning instead of failing") in -mm tree[1] introduces 'migrate_device_page()', which uses several functions that defined under CONFIG_DEVICE_RIVATE. As a result, build under 'CONFIG_MIGRATION && !CONFIG_DEVICE_PRIVATE' fails as below. LD .tmp_vmlinux.kallsyms1 mm/gup.o: In function `migrate_device_page': /linux/mm/gup.c:1856: undefined reference to `migrate_vma_setup' /linux/mm/gup.c:1876: undefined reference to `migrate_vma_pages' /linux/mm/gup.c:1879: undefined reference to `migrate_vma_finalize' /linux/Makefile:1222: recipe for target 'vmlinux' failed make[1]: *** [vmlinux] Error 1 This commit fixes it by implementing an always-failing version of the function for !CONFIG_DEVICE_PRIVATE'. [1] https://www.ozlabs.org/~akpm/mmotm/broken-out/mm-gupc-migrate-device-coherent-pages-when-pinning-instead-of-failing.patch Signed-off-by: SeongJae Park <sj@kernel.org> --- mm/gup.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/mm/gup.c b/mm/gup.c index 1df99a5e90cf..0cf59858114d 100644 --- a/mm/gup.c +++ b/mm/gup.c @@ -1834,6 +1834,7 @@ struct page *get_dump_page(unsigned long addr) #endif /* CONFIG_ELF_CORE */ #ifdef CONFIG_MIGRATION +#ifdef CONFIG_DEVICE_PRIVATE /* * Migrates a device coherent page back to normal memory. Caller should have a * reference on page which will be copied to the new page if migration is @@ -1887,6 +1888,14 @@ static struct page *migrate_device_page(struct page *page, return dpage; } +#else +static inline struct page *migrate_device_page(struct page *page, + unsigned int gup_flags) +{ + return NULL; +} +#endif /* CONFIG_DEVICE_PRIVATE */ + /* * Check whether all pages are pinnable, if so return number of pages. If some -- 2.17.1 ^ permalink raw reply related [flat|nested] 9+ messages in thread
end of thread, other threads:[~2022-02-11 3:59 UTC | newest] Thread overview: 9+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2022-02-09 9:41 [PATCH for-mm 0/2] Fix trivial build errors on -mm tree SeongJae Park 2022-02-09 9:41 ` [PATCH for-mm 1/2] mm/internal: Implement no-op mlock_page_drain() for !CONFIG_MMU SeongJae Park 2022-02-09 15:37 ` Hugh Dickins 2022-02-09 16:19 ` Geert Uytterhoeven 2022-02-10 4:37 ` Hugh Dickins 2022-02-10 4:44 ` [PATCH for-mm 1/2 v2] " Hugh Dickins 2022-02-10 7:58 ` SeongJae Park 2022-02-11 3:58 ` Stephen Rothwell 2022-02-09 9:41 ` [PATCH for-mm 2/2] mm/gup: Make migrate_device_page() fails always if !CONFIG_DEVICE_PRIVATE SeongJae Park
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).