linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mm/shmem: Enclose shmem_mcopy_atomic_pte() with 'CONFIG_USERFAULTFD'
@ 2021-03-16  9:49 SeongJae Park
  2021-03-16 15:39 ` [PATCH v2] " SeongJae Park
  0 siblings, 1 reply; 4+ messages in thread
From: SeongJae Park @ 2021-03-16  9:49 UTC (permalink / raw)
  To: akpm; +Cc: hughd, axelrasmussen, amit, linux-mm, linux-kernel, SeongJae Park

From: SeongJae Park <sjpark@amazon.de>

Commit 49eeab03fa0a ("userfaultfd: support minor fault handling for
shmem") introduced shmem_mcopy_atomic_pte().  The function is declared
in 'userfaultfd_k.h' when 'CONFIG_USERFAULTFD' is defined, and defined
as 'BUG()' if the config is unset.  However, the definition of the
function in 'shmem.c' is not protected by the '#ifdef' macro.  As a
result, the build fails when the config is not set.  This commit fixes
the problem.

Fixes: 49eeab03fa0a ("userfaultfd: support minor fault handling for shmem")
Signed-off-by: SeongJae Park <sjpark@amazon.de>

cr https://code.amazon.com/reviews/CR-47204463
---
 mm/shmem.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/mm/shmem.c b/mm/shmem.c
index 547df2b766f7..c0d3abefeb3f 100644
--- a/mm/shmem.c
+++ b/mm/shmem.c
@@ -2359,6 +2359,7 @@ static struct inode *shmem_get_inode(struct super_block *sb, const struct inode
 	return inode;
 }
 
+#ifdef CONFIG_USERFAULTFD
 int shmem_mcopy_atomic_pte(struct mm_struct *dst_mm, pmd_t *dst_pmd,
 			   struct vm_area_struct *dst_vma,
 			   unsigned long dst_addr, unsigned long src_addr,
@@ -2492,6 +2493,7 @@ int shmem_mcopy_atomic_pte(struct mm_struct *dst_mm, pmd_t *dst_pmd,
 	shmem_inode_unacct_blocks(inode, 1);
 	goto out;
 }
+#endif
 
 #ifdef CONFIG_TMPFS
 static const struct inode_operations shmem_symlink_inode_operations;
-- 
2.17.1




Amazon Development Center Germany GmbH
Krausenstr. 38
10117 Berlin
Geschaeftsfuehrung: Christian Schlaeger, Jonathan Weiss
Eingetragen am Amtsgericht Charlottenburg unter HRB 149173 B
Sitz: Berlin
Ust-ID: DE 289 237 879





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

* [PATCH v2] mm/shmem: Enclose shmem_mcopy_atomic_pte() with 'CONFIG_USERFAULTFD'
  2021-03-16  9:49 [PATCH] mm/shmem: Enclose shmem_mcopy_atomic_pte() with 'CONFIG_USERFAULTFD' SeongJae Park
@ 2021-03-16 15:39 ` SeongJae Park
  2021-03-16 16:16   ` Axel Rasmussen
  0 siblings, 1 reply; 4+ messages in thread
From: SeongJae Park @ 2021-03-16 15:39 UTC (permalink / raw)
  To: akpm; +Cc: hughd, axelrasmussen, amit, linux-mm, linux-kernel, SeongJae Park

From: SeongJae Park <sjpark@amazon.de>

Commit 49eeab03fa0a ("userfaultfd: support minor fault handling for
shmem") introduced shmem_mcopy_atomic_pte().  The function is declared
in 'userfaultfd_k.h' when 'CONFIG_USERFAULTFD' is defined, and defined
as 'BUG()' if the config is unset.  However, the definition of the
function in 'shmem.c' is not protected by the '#ifdef' macro.  As a
result, the build fails when the config is not set.  This commit fixes
the problem.

Fixes: 49eeab03fa0a ("userfaultfd: support minor fault handling for shmem")
Signed-off-by: SeongJae Park <sjpark@amazon.de>
---

Changes from v1
- Remove unnecessary internal code review URL

---
 mm/shmem.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/mm/shmem.c b/mm/shmem.c
index 547df2b766f7..c0d3abefeb3f 100644
--- a/mm/shmem.c
+++ b/mm/shmem.c
@@ -2359,6 +2359,7 @@ static struct inode *shmem_get_inode(struct super_block *sb, const struct inode
 	return inode;
 }
 
+#ifdef CONFIG_USERFAULTFD
 int shmem_mcopy_atomic_pte(struct mm_struct *dst_mm, pmd_t *dst_pmd,
 			   struct vm_area_struct *dst_vma,
 			   unsigned long dst_addr, unsigned long src_addr,
@@ -2492,6 +2493,7 @@ int shmem_mcopy_atomic_pte(struct mm_struct *dst_mm, pmd_t *dst_pmd,
 	shmem_inode_unacct_blocks(inode, 1);
 	goto out;
 }
+#endif
 
 #ifdef CONFIG_TMPFS
 static const struct inode_operations shmem_symlink_inode_operations;
-- 
2.17.1




Amazon Development Center Germany GmbH
Krausenstr. 38
10117 Berlin
Geschaeftsfuehrung: Christian Schlaeger, Jonathan Weiss
Eingetragen am Amtsgericht Charlottenburg unter HRB 149173 B
Sitz: Berlin
Ust-ID: DE 289 237 879





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

* Re: [PATCH v2] mm/shmem: Enclose shmem_mcopy_atomic_pte() with 'CONFIG_USERFAULTFD'
  2021-03-16 15:39 ` [PATCH v2] " SeongJae Park
@ 2021-03-16 16:16   ` Axel Rasmussen
  2021-03-16 16:22     ` SeongJae Park
  0 siblings, 1 reply; 4+ messages in thread
From: Axel Rasmussen @ 2021-03-16 16:16 UTC (permalink / raw)
  To: SeongJae Park
  Cc: Andrew Morton, Hugh Dickins, amit, Linux MM, LKML, SeongJae Park

Sorry for the build failure! I sent a new version of my patch with
this same fix on the 10th
(https://lore.kernel.org/patchwork/patch/1392464/), and I believe
Andrew has already included it in his tree.

On Tue, Mar 16, 2021 at 8:40 AM SeongJae Park <sjpark@amazon.com> wrote:
>
> From: SeongJae Park <sjpark@amazon.de>
>
> Commit 49eeab03fa0a ("userfaultfd: support minor fault handling for
> shmem") introduced shmem_mcopy_atomic_pte().  The function is declared
> in 'userfaultfd_k.h' when 'CONFIG_USERFAULTFD' is defined, and defined
> as 'BUG()' if the config is unset.  However, the definition of the
> function in 'shmem.c' is not protected by the '#ifdef' macro.  As a
> result, the build fails when the config is not set.  This commit fixes
> the problem.
>
> Fixes: 49eeab03fa0a ("userfaultfd: support minor fault handling for shmem")
> Signed-off-by: SeongJae Park <sjpark@amazon.de>
> ---
>
> Changes from v1
> - Remove unnecessary internal code review URL
>
> ---
>  mm/shmem.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/mm/shmem.c b/mm/shmem.c
> index 547df2b766f7..c0d3abefeb3f 100644
> --- a/mm/shmem.c
> +++ b/mm/shmem.c
> @@ -2359,6 +2359,7 @@ static struct inode *shmem_get_inode(struct super_block *sb, const struct inode
>         return inode;
>  }
>
> +#ifdef CONFIG_USERFAULTFD
>  int shmem_mcopy_atomic_pte(struct mm_struct *dst_mm, pmd_t *dst_pmd,
>                            struct vm_area_struct *dst_vma,
>                            unsigned long dst_addr, unsigned long src_addr,
> @@ -2492,6 +2493,7 @@ int shmem_mcopy_atomic_pte(struct mm_struct *dst_mm, pmd_t *dst_pmd,
>         shmem_inode_unacct_blocks(inode, 1);
>         goto out;
>  }
> +#endif
>
>  #ifdef CONFIG_TMPFS
>  static const struct inode_operations shmem_symlink_inode_operations;
> --
> 2.17.1
>
>
>
>
> Amazon Development Center Germany GmbH
> Krausenstr. 38
> 10117 Berlin
> Geschaeftsfuehrung: Christian Schlaeger, Jonathan Weiss
> Eingetragen am Amtsgericht Charlottenburg unter HRB 149173 B
> Sitz: Berlin
> Ust-ID: DE 289 237 879
>
>
>


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

* Re: [PATCH v2] mm/shmem: Enclose shmem_mcopy_atomic_pte() with 'CONFIG_USERFAULTFD'
  2021-03-16 16:16   ` Axel Rasmussen
@ 2021-03-16 16:22     ` SeongJae Park
  0 siblings, 0 replies; 4+ messages in thread
From: SeongJae Park @ 2021-03-16 16:22 UTC (permalink / raw)
  To: Axel Rasmussen
  Cc: SeongJae Park, Andrew Morton, Hugh Dickins, amit, Linux MM, LKML,
	SeongJae Park

On Tue, 16 Mar 2021 09:16:57 -0700 Axel Rasmussen <axelrasmussen@google.com> wrote:

> Sorry for the build failure! I sent a new version of my patch with
> this same fix on the 10th
> (https://lore.kernel.org/patchwork/patch/1392464/), and I believe
> Andrew has already included it in his tree.

No problem at all, thank you for letting me know! :)

FYI, I tested on 'master' of https://github.com/hnaz/linux-mm.


Thanks,
SeongJae Park

[...]



Amazon Development Center Germany GmbH
Krausenstr. 38
10117 Berlin
Geschaeftsfuehrung: Christian Schlaeger, Jonathan Weiss
Eingetragen am Amtsgericht Charlottenburg unter HRB 149173 B
Sitz: Berlin
Ust-ID: DE 289 237 879





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

end of thread, other threads:[~2021-03-16 16:22 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-16  9:49 [PATCH] mm/shmem: Enclose shmem_mcopy_atomic_pte() with 'CONFIG_USERFAULTFD' SeongJae Park
2021-03-16 15:39 ` [PATCH v2] " SeongJae Park
2021-03-16 16:16   ` Axel Rasmussen
2021-03-16 16:22     ` 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).