diff options
-rw-r--r-- | include/linux/mm.h | 5 | ||||
-rw-r--r-- | mm/madvise.c | 2 | ||||
-rw-r--r-- | mm/memory-failure.c | 5 |
3 files changed, 8 insertions, 4 deletions
diff --git a/include/linux/mm.h b/include/linux/mm.h index 68c84bb2ad3f..135e19198cd3 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h | |||
@@ -1331,8 +1331,11 @@ extern int account_locked_memory(struct mm_struct *mm, struct rlimit *rlim, | |||
1331 | size_t size); | 1331 | size_t size); |
1332 | extern void refund_locked_memory(struct mm_struct *mm, size_t size); | 1332 | extern void refund_locked_memory(struct mm_struct *mm, size_t size); |
1333 | 1333 | ||
1334 | enum mf_flags { | ||
1335 | MF_COUNT_INCREASED = 1 << 0, | ||
1336 | }; | ||
1334 | extern void memory_failure(unsigned long pfn, int trapno); | 1337 | extern void memory_failure(unsigned long pfn, int trapno); |
1335 | extern int __memory_failure(unsigned long pfn, int trapno, int ref); | 1338 | extern int __memory_failure(unsigned long pfn, int trapno, int flags); |
1336 | extern int sysctl_memory_failure_early_kill; | 1339 | extern int sysctl_memory_failure_early_kill; |
1337 | extern int sysctl_memory_failure_recovery; | 1340 | extern int sysctl_memory_failure_recovery; |
1338 | extern void shake_page(struct page *p); | 1341 | extern void shake_page(struct page *p); |
diff --git a/mm/madvise.c b/mm/madvise.c index 18970aec0d2f..6ca34f0cd4aa 100644 --- a/mm/madvise.c +++ b/mm/madvise.c | |||
@@ -237,7 +237,7 @@ static int madvise_hwpoison(unsigned long start, unsigned long end) | |||
237 | printk(KERN_INFO "Injecting memory failure for page %lx at %lx\n", | 237 | printk(KERN_INFO "Injecting memory failure for page %lx at %lx\n", |
238 | page_to_pfn(p), start); | 238 | page_to_pfn(p), start); |
239 | /* Ignore return value for now */ | 239 | /* Ignore return value for now */ |
240 | __memory_failure(page_to_pfn(p), 0, 1); | 240 | __memory_failure(page_to_pfn(p), 0, MF_COUNT_INCREASED); |
241 | } | 241 | } |
242 | return ret; | 242 | return ret; |
243 | } | 243 | } |
diff --git a/mm/memory-failure.c b/mm/memory-failure.c index 4253e14fa709..3338c443272c 100644 --- a/mm/memory-failure.c +++ b/mm/memory-failure.c | |||
@@ -737,7 +737,7 @@ static void hwpoison_user_mappings(struct page *p, unsigned long pfn, | |||
737 | ret != SWAP_SUCCESS, pfn); | 737 | ret != SWAP_SUCCESS, pfn); |
738 | } | 738 | } |
739 | 739 | ||
740 | int __memory_failure(unsigned long pfn, int trapno, int ref) | 740 | int __memory_failure(unsigned long pfn, int trapno, int flags) |
741 | { | 741 | { |
742 | unsigned long lru_flag; | 742 | unsigned long lru_flag; |
743 | struct page_state *ps; | 743 | struct page_state *ps; |
@@ -773,7 +773,8 @@ int __memory_failure(unsigned long pfn, int trapno, int ref) | |||
773 | * In fact it's dangerous to directly bump up page count from 0, | 773 | * In fact it's dangerous to directly bump up page count from 0, |
774 | * that may make page_freeze_refs()/page_unfreeze_refs() mismatch. | 774 | * that may make page_freeze_refs()/page_unfreeze_refs() mismatch. |
775 | */ | 775 | */ |
776 | if (!ref && !get_page_unless_zero(compound_head(p))) { | 776 | if (!(flags & MF_COUNT_INCREASED) && |
777 | !get_page_unless_zero(compound_head(p))) { | ||
777 | action_result(pfn, "free or high order kernel", IGNORED); | 778 | action_result(pfn, "free or high order kernel", IGNORED); |
778 | return PageBuddy(compound_head(p)) ? 0 : -EBUSY; | 779 | return PageBuddy(compound_head(p)) ? 0 : -EBUSY; |
779 | } | 780 | } |