From: Geert Uytterhoeven Date: Wed, 3 Aug 2016 17:58:19 +0000 (+0200) Subject: shmem: Fix link error if huge pages support is disabled X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=4620a06e4b3c5d076feb9a42ab43dce77c385358;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git shmem: Fix link error if huge pages support is disabled If CONFIG_TRANSPARENT_HUGE_PAGECACHE=n, HPAGE_PMD_NR evaluates to BUILD_BUG_ON(), and may cause (e.g. with gcc 4.12): mm/built-in.o: In function `shmem_alloc_hugepage': shmem.c:(.text+0x17570): undefined reference to `__compiletime_assert_1365' To fix this, move the assignment to hindex after the check for huge pages support. Fixes: 800d8c63b2e9 ("shmem: add huge pages support") Signed-off-by: Geert Uytterhoeven Acked-by: Kirill A. Shutemov Cc: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/mm/shmem.c b/mm/shmem.c index 2ac19a61d565..7f7748a0f9e1 100644 --- a/mm/shmem.c +++ b/mm/shmem.c @@ -1362,13 +1362,14 @@ static struct page *shmem_alloc_hugepage(gfp_t gfp, struct vm_area_struct pvma; struct inode *inode = &info->vfs_inode; struct address_space *mapping = inode->i_mapping; - pgoff_t idx, hindex = round_down(index, HPAGE_PMD_NR); + pgoff_t idx, hindex; void __rcu **results; struct page *page; if (!IS_ENABLED(CONFIG_TRANSPARENT_HUGE_PAGECACHE)) return NULL; + hindex = round_down(index, HPAGE_PMD_NR); rcu_read_lock(); if (radix_tree_gang_lookup_slot(&mapping->page_tree, &results, &idx, hindex, 1) && idx < hindex + HPAGE_PMD_NR) {