mm: allow page_cache_get_speculative in interrupt context
authorKan Liang <>
Wed, 2 Aug 2017 20:32:27 +0000 (13:32 -0700)
committerLinus Torvalds <>
Thu, 3 Aug 2017 00:16:13 +0000 (17:16 -0700)
Kernel panic when calling the IRQ-safe __get_user_pages_fast in NMI

The bug was introduced by commit 2947ba054a4d ("x86/mm/gup: Switch GUP
to the generic get_user_page_fast() implementation").

The original x86 __get_user_page_fast used plain get_page() or
page_ref_add().  However, the generic __get_user_page_fast uses
page_cache_get_speculative(), which has VM_BUG_ON(in_interrupt()).

There is no reason to prevent page_cache_get_speculative from using in
interrupt context.  According to the author, putting a BUG_ON there is
just because the code is not verifying correctness of interrupt races.
I did some tests in interrupt context.  There is no issue found.

Removing VM_BUG_ON(in_interrupt()) for page_cache_get_speculative().

Fixes: 2947ba054a4d ("x86/mm/gup: Switch GUP to the generic get_user_page_fast() implementation")
Signed-off-by: Kan Liang <>
Cc: Jens Axboe <>
Cc: Al Viro <>
Cc: Kirill A. Shutemov <>
Cc: Ying Huang <>
Cc: Nicholas Piggin <>
Cc: Ingo Molnar <>
Signed-off-by: Andrew Morton <>
Signed-off-by: Linus Torvalds <>

index baa9344dcd10deb9aaf418a76afa901d2a7f1558..79b36f57c3ba42271b4f09f1d771fb80a835c0ad 100644 (file)
@@ -163,8 +163,6 @@ void release_pages(struct page **pages, int nr, bool cold);
 static inline int page_cache_get_speculative(struct page *page)
 static inline int page_cache_get_speculative(struct page *page)
-       VM_BUG_ON(in_interrupt());
        VM_BUG_ON(!in_atomic() && !irqs_disabled());
        VM_BUG_ON(!in_atomic() && !irqs_disabled());