UPSTREAM: mm/mremap: fix BUILD_BUG_ON() error in get_extent

clang can't evaluate this function argument at compile time when the
function is not inlined, which leads to a link time failure:

  ld.lld: error: undefined symbol: __compiletime_assert_414
  >>> referenced by mremap.c
  >>>               mremap.o:(get_extent) in archive mm/built-in.a

Mark the function as __always_inline to avoid it.

Link: https://lkml.kernel.org/r/20201230154104.522605-1-arnd@kernel.org
Fixes: 9ad9718bfa ("mm/mremap: calculate extent in one place")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Tested-by: Nick Desaulniers <ndesaulniers@google.com>
Reviewed-by: Nathan Chancellor <natechancellor@gmail.com>
Tested-by: Sedat Dilek <sedat.dilek@gmail.com>
Cc: Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>
Cc: Wei Yang <richard.weiyang@linux.alibaba.com>
Cc: Vlastimil Babka <vbabka@suse.cz>
Cc: Dmitry Safonov <0x7f454c46@gmail.com>
Cc: Brian Geffon <bgeffon@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

Bug: 199373673
(cherry picked from commit a30a29091b5a6d4c64b5fc77040720a65e2dd4e6)
Change-Id: I02055457d396b59eea974331a876cde049623423
Signed-off-by: Yee Lee <yee.lee@mediatek.com>
This commit is contained in:
Arnd Bergmann
2021-02-09 13:42:10 -08:00
committed by Todd Kjos
parent 66379c1ee5
commit 45b1eb7115

View File

@@ -336,8 +336,9 @@ enum pgt_entry {
* valid. Else returns a smaller extent bounded by the end of the source and * valid. Else returns a smaller extent bounded by the end of the source and
* destination pgt_entry. * destination pgt_entry.
*/ */
static unsigned long get_extent(enum pgt_entry entry, unsigned long old_addr, static __always_inline unsigned long get_extent(enum pgt_entry entry,
unsigned long old_end, unsigned long new_addr) unsigned long old_addr, unsigned long old_end,
unsigned long new_addr)
{ {
unsigned long next, extent, mask, size; unsigned long next, extent, mask, size;