mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] sparc64: Fix hugepage page table free
@ 2017-04-17 22:46 Nitin Gupta
  2017-04-18 20:11 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Nitin Gupta @ 2017-04-17 22:46 UTC (permalink / raw)
  To: David S. Miller
  Cc: Nitin Gupta, David S. Miller, Mike Kravetz, Ingo Molnar,
	sparclinux, linux-kernel

Make sure the start adderess is aligned to PMD_SIZE
boundary when freeing page table backing a hugepage
region. The issue was causing segfaults when a region
backed by 64K pages was unmapped since such a region
is in general not PMD_SIZE aligned.

Signed-off-by: Nitin Gupta <nitin.m.gupta@oracle.com>
---
 arch/sparc/mm/hugetlbpage.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/arch/sparc/mm/hugetlbpage.c b/arch/sparc/mm/hugetlbpage.c
index ee5273a..7c29d38 100644
--- a/arch/sparc/mm/hugetlbpage.c
+++ b/arch/sparc/mm/hugetlbpage.c
@@ -461,6 +461,22 @@ void hugetlb_free_pgd_range(struct mmu_gather *tlb,
 	pgd_t *pgd;
 	unsigned long next;
 
+	addr &= PMD_MASK;
+	if (addr < floor) {
+		addr += PMD_SIZE;
+		if (!addr)
+			return;
+	}
+	if (ceiling) {
+		ceiling &= PMD_MASK;
+		if (!ceiling)
+			return;
+	}
+	if (end - 1 > ceiling - 1)
+		end -= PMD_SIZE;
+	if (addr > end - 1)
+		return;
+
 	pgd = pgd_offset(tlb->mm, addr);
 	do {
 		next = pgd_addr_end(addr, end);
-- 
2.9.2

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

* Re: [PATCH] sparc64: Fix hugepage page table free
  2017-04-17 22:46 [PATCH] sparc64: Fix hugepage page table free Nitin Gupta
@ 2017-04-18 20:11 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2017-04-18 20:11 UTC (permalink / raw)
  To: nitin.m.gupta; +Cc: mike.kravetz, mingo, sparclinux, linux-kernel

From: Nitin Gupta <nitin.m.gupta@oracle.com>
Date: Mon, 17 Apr 2017 15:46:41 -0700

> Make sure the start adderess is aligned to PMD_SIZE
> boundary when freeing page table backing a hugepage
> region. The issue was causing segfaults when a region
> backed by 64K pages was unmapped since such a region
> is in general not PMD_SIZE aligned.
> 
> Signed-off-by: Nitin Gupta <nitin.m.gupta@oracle.com>

Applied, thank you.

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

end of thread, other threads:[~2017-04-18 20:11 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-17 22:46 [PATCH] sparc64: Fix hugepage page table free Nitin Gupta
2017-04-18 20:11 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®