linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mm,numa: remove BUG_ON in __handle_mm_fault
@ 2014-04-25 18:41 Rik van Riel
  2014-04-29 19:26 ` n-horiguchi
       [not found] ` <1398799576-9pfzypnu@n-horiguchi@ah.jp.nec.com>
  0 siblings, 2 replies; 3+ messages in thread
From: Rik van Riel @ 2014-04-25 18:41 UTC (permalink / raw)
  To: linux-kernel
  Cc: linux-mm, lwoodman, peterz, mgorman, dave.hansen, sunil.k.pandey

Changing PTEs and PMDs to pte_numa & pmd_numa is done with the
mmap_sem held for reading, which means a pmd can be instantiated
and/or turned into a numa one while __handle_mm_fault is examining
the value of orig_pmd.

If that happens, __handle_mm_fault should just return and let
the page fault retry, instead of throwing an oops.

Signed-off-by: Rik van Riel <riel@redhat.com>
Reported-by: Sunil Pandey <sunil.k.pandey@intel.com>
---
 mm/memory.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/mm/memory.c b/mm/memory.c
index d0f0bef..9edccb2 100644
--- a/mm/memory.c
+++ b/mm/memory.c
@@ -3900,8 +3900,9 @@ static int __handle_mm_fault(struct mm_struct *mm, struct vm_area_struct *vma,
 		}
 	}
 
-	/* THP should already have been handled */
-	BUG_ON(pmd_numa(*pmd));
+	/* The PMD became NUMA while we examined orig_pmd. Return & retry */
+	if (pmd_numa(*pmd))
+		return 0;
 
 	/*
 	 * Use __pte_alloc instead of pte_alloc_map, because we can't

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

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

* Re: [PATCH] mm,numa: remove BUG_ON in __handle_mm_fault
  2014-04-25 18:41 [PATCH] mm,numa: remove BUG_ON in __handle_mm_fault Rik van Riel
@ 2014-04-29 19:26 ` n-horiguchi
       [not found] ` <1398799576-9pfzypnu@n-horiguchi@ah.jp.nec.com>
  1 sibling, 0 replies; 3+ messages in thread
From: n-horiguchi @ 2014-04-29 19:26 UTC (permalink / raw)
  To: riel
  Cc: linux-kernel, linux-mm, lwoodman, peterz, mgorman, dave.hansen,
	sunil.k.pandey

On Fri, Apr 25, 2014 at 02:41:47PM -0400, Rik van Riel wrote:
> Changing PTEs and PMDs to pte_numa & pmd_numa is done with the
> mmap_sem held for reading, which means a pmd can be instantiated
> and/or turned into a numa one while __handle_mm_fault is examining
> the value of orig_pmd.
> 
> If that happens, __handle_mm_fault should just return and let
> the page fault retry, instead of throwing an oops.
> 
> Signed-off-by: Rik van Riel <riel@redhat.com>
> Reported-by: Sunil Pandey <sunil.k.pandey@intel.com>

Looks good to me.
Reviewed-by: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

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

* [PATCH -v2] mm,numa: remove BUG_ON in __handle_mm_fault
       [not found] ` <1398799576-9pfzypnu@n-horiguchi@ah.jp.nec.com>
@ 2014-04-29 19:36   ` Rik van Riel
  0 siblings, 0 replies; 3+ messages in thread
From: Rik van Riel @ 2014-04-29 19:36 UTC (permalink / raw)
  To: n-horiguchi
  Cc: linux-kernel, linux-mm, lwoodman, peterz, mgorman, dave.hansen,
	sunil.k.pandey

Peter pointed out we can do this slightly simpler, since we already
have a test for pmd_trans_huge(*pmd) below...

---8<---

Changing PTEs and PMDs to pte_numa & pmd_numa is done with the
mmap_sem held for reading, which means a pmd can be instantiated
and turned into a numa one while __handle_mm_fault is examining
the value of old_pmd.

If that happens, __handle_mm_fault should just return and let
the page fault retry, instead of throwing an oops. This is
handled by the test for pmd_trans_huge(*pmd) below.

Signed-off-by: Rik van Riel <riel@redhat.com>
Reviewed-by: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
Reported-by: Sunil Pandey <sunil.k.pandey@intel.com>
Cc: stable@kernel.org
---
 mm/memory.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/mm/memory.c b/mm/memory.c
index d0f0bef..9c2dc65 100644
--- a/mm/memory.c
+++ b/mm/memory.c
@@ -3900,9 +3900,6 @@ static int __handle_mm_fault(struct mm_struct *mm, struct vm_area_struct *vma,
 		}
 	}
 
-	/* THP should already have been handled */
-	BUG_ON(pmd_numa(*pmd));
-
 	/*
 	 * Use __pte_alloc instead of pte_alloc_map, because we can't
 	 * run pte_offset_map on the pmd, if an huge pmd could

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

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

end of thread, other threads:[~2014-04-29 19:36 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-04-25 18:41 [PATCH] mm,numa: remove BUG_ON in __handle_mm_fault Rik van Riel
2014-04-29 19:26 ` n-horiguchi
     [not found] ` <1398799576-9pfzypnu@n-horiguchi@ah.jp.nec.com>
2014-04-29 19:36   ` [PATCH -v2] " Rik van Riel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).