aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/linux/mm.h8
-rw-r--r--mm/memory-failure.c32
2 files changed, 0 insertions, 40 deletions
diff --git a/include/linux/mm.h b/include/linux/mm.h
index a77c82c56e05..78219887308e 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -1625,14 +1625,6 @@ extern int sysctl_memory_failure_recovery;
1625extern void shake_page(struct page *p, int access); 1625extern void shake_page(struct page *p, int access);
1626extern atomic_long_t mce_bad_pages; 1626extern atomic_long_t mce_bad_pages;
1627extern int soft_offline_page(struct page *page, int flags); 1627extern int soft_offline_page(struct page *page, int flags);
1628#ifdef CONFIG_MEMORY_FAILURE
1629int is_hwpoison_address(unsigned long addr);
1630#else
1631static inline int is_hwpoison_address(unsigned long addr)
1632{
1633 return 0;
1634}
1635#endif
1636 1628
1637extern void dump_page(struct page *page); 1629extern void dump_page(struct page *page);
1638 1630
diff --git a/mm/memory-failure.c b/mm/memory-failure.c
index 0207c2f6f8bd..99ccb4472623 100644
--- a/mm/memory-failure.c
+++ b/mm/memory-failure.c
@@ -1487,35 +1487,3 @@ done:
1487 /* keep elevated page count for bad page */ 1487 /* keep elevated page count for bad page */
1488 return ret; 1488 return ret;
1489} 1489}
1490
1491/*
1492 * The caller must hold current->mm->mmap_sem in read mode.
1493 */
1494int is_hwpoison_address(unsigned long addr)
1495{
1496 pgd_t *pgdp;
1497 pud_t pud, *pudp;
1498 pmd_t pmd, *pmdp;
1499 pte_t pte, *ptep;
1500 swp_entry_t entry;
1501
1502 pgdp = pgd_offset(current->mm, addr);
1503 if (!pgd_present(*pgdp))
1504 return 0;
1505 pudp = pud_offset(pgdp, addr);
1506 pud = *pudp;
1507 if (!pud_present(pud) || pud_large(pud))
1508 return 0;
1509 pmdp = pmd_offset(pudp, addr);
1510 pmd = *pmdp;
1511 if (!pmd_present(pmd) || pmd_large(pmd))
1512 return 0;
1513 ptep = pte_offset_map(pmdp, addr);
1514 pte = *ptep;
1515 pte_unmap(ptep);
1516 if (!is_swap_pte(pte))
1517 return 0;
1518 entry = pte_to_swp_entry(pte);
1519 return is_hwpoison_entry(entry);
1520}
1521EXPORT_SYMBOL_GPL(is_hwpoison_address);