[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210316153930.29827-1-sjpark@amazon.com>
Date: Tue, 16 Mar 2021 16:39:30 +0100
From: SeongJae Park <sjpark@...zon.com>
To: <akpm@...ux-foundation.org>
CC: <hughd@...gle.com>, <axelrasmussen@...gle.com>, <amit@...nel.org>,
<linux-mm@...ck.org>, <linux-kernel@...r.kernel.org>,
SeongJae Park <sjpark@...zon.de>
Subject: [PATCH v2] mm/shmem: Enclose shmem_mcopy_atomic_pte() with 'CONFIG_USERFAULTFD'
From: SeongJae Park <sjpark@...zon.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@...zon.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
Powered by blists - more mailing lists