aboutsummaryrefslogtreecommitdiffstats
path: root/mm
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2010-08-04 13:43:01 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2010-08-04 13:43:01 -0400
commit5e83f6fbdb020b70c0e413312801424d13c58d68 (patch)
treeca270178fa891813dbc47751c331fed975d3766c /mm
parentfe445c6e2cb62a566e1a89f8798de11459975710 (diff)
parent3444d7da1839b851eefedd372978d8a982316c36 (diff)
Merge branch 'kvm-updates/2.6.36' of git://git.kernel.org/pub/scm/virt/kvm/kvm
* 'kvm-updates/2.6.36' of git://git.kernel.org/pub/scm/virt/kvm/kvm: (198 commits) KVM: VMX: Fix host GDT.LIMIT corruption KVM: MMU: using __xchg_spte more smarter KVM: MMU: cleanup spte set and accssed/dirty tracking KVM: MMU: don't atomicly set spte if it's not present KVM: MMU: fix page dirty tracking lost while sync page KVM: MMU: fix broken page accessed tracking with ept enabled KVM: MMU: add missing reserved bits check in speculative path KVM: MMU: fix mmu notifier invalidate handler for huge spte KVM: x86 emulator: fix xchg instruction emulation KVM: x86: Call mask notifiers from pic KVM: x86: never re-execute instruction with enabled tdp KVM: Document KVM_GET_SUPPORTED_CPUID2 ioctl KVM: x86: emulator: inc/dec can have lock prefix KVM: MMU: Eliminate redundant temporaries in FNAME(fetch) KVM: MMU: Validate all gptes during fetch, not just those used for new pages KVM: MMU: Simplify spte fetch() function KVM: MMU: Add gpte_valid() helper KVM: MMU: Add validate_direct_spte() helper KVM: MMU: Add drop_large_spte() helper KVM: MMU: Use __set_spte to link shadow pages ...
Diffstat (limited to 'mm')
-rw-r--r--mm/memory-failure.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/mm/memory-failure.c b/mm/memory-failure.c
index 620b0b46159..6b44e52caca 100644
--- a/mm/memory-failure.c
+++ b/mm/memory-failure.c
@@ -45,6 +45,7 @@
45#include <linux/page-isolation.h> 45#include <linux/page-isolation.h>
46#include <linux/suspend.h> 46#include <linux/suspend.h>
47#include <linux/slab.h> 47#include <linux/slab.h>
48#include <linux/swapops.h>
48#include "internal.h" 49#include "internal.h"
49 50
50int sysctl_memory_failure_early_kill __read_mostly = 0; 51int sysctl_memory_failure_early_kill __read_mostly = 0;
@@ -1296,3 +1297,35 @@ done:
1296 /* keep elevated page count for bad page */ 1297 /* keep elevated page count for bad page */
1297 return ret; 1298 return ret;
1298} 1299}
1300
1301/*
1302 * The caller must hold current->mm->mmap_sem in read mode.
1303 */
1304int is_hwpoison_address(unsigned long addr)
1305{
1306 pgd_t *pgdp;
1307 pud_t pud, *pudp;
1308 pmd_t pmd, *pmdp;
1309 pte_t pte, *ptep;
1310 swp_entry_t entry;
1311
1312 pgdp = pgd_offset(current->mm, addr);
1313 if (!pgd_present(*pgdp))
1314 return 0;
1315 pudp = pud_offset(pgdp, addr);
1316 pud = *pudp;
1317 if (!pud_present(pud) || pud_large(pud))
1318 return 0;
1319 pmdp = pmd_offset(pudp, addr);
1320 pmd = *pmdp;
1321 if (!pmd_present(pmd) || pmd_large(pmd))
1322 return 0;
1323 ptep = pte_offset_map(pmdp, addr);
1324 pte = *ptep;
1325 pte_unmap(ptep);
1326 if (!is_swap_pte(pte))
1327 return 0;
1328 entry = pte_to_swp_entry(pte);
1329 return is_hwpoison_entry(entry);
1330}
1331EXPORT_SYMBOL_GPL(is_hwpoison_address);