Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1455924 > unrolled thread

[PATCH] shmem: Fix link error if huge pages support is disabled

Started byGeert Uytterhoeven <geert@linux-m68k.org>
First post2016-08-03 20:00 +0200
Last post2016-08-03 21:10 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] shmem: Fix link error if huge pages support is disabled Geert Uytterhoeven <geert@linux-m68k.org> - 2016-08-03 20:00 +0200
    Re: [PATCH] shmem: Fix link error if huge pages support is disabled "Kirill A. Shutemov" <kirill@shutemov.name> - 2016-08-03 21:10 +0200

#1455924 — [PATCH] shmem: Fix link error if huge pages support is disabled

FromGeert Uytterhoeven <geert@linux-m68k.org>
Date2016-08-03 20:00 +0200
Subject[PATCH] shmem: Fix link error if huge pages support is disabled
Message-ID<s28Ct-5J5-3@gated-at.bofh.it>
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: 800d8c63b2e989c2 ("shmem: add huge pages support")
Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
---
 mm/shmem.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/mm/shmem.c b/mm/shmem.c
index 2ac19a61d5655b82..7f7748a0f9e1f738 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) {
-- 
1.9.1

[toc] | [next] | [standalone]


#1455975

From"Kirill A. Shutemov" <kirill@shutemov.name>
Date2016-08-03 21:10 +0200
Message-ID<s29Ie-6D8-27@gated-at.bofh.it>
In reply to#1455924
On Wed, Aug 03, 2016 at 07:58:19PM +0200, Geert Uytterhoeven wrote:
> 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: 800d8c63b2e989c2 ("shmem: add huge pages support")
> Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>

Acked-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>

-- 
 Kirill A. Shutemov

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web