[PATCH 3/4] HWPOISON: replace locking functions into hugepagevariants

From: Naoya Horiguchi
Date: Thu Aug 12 2010 - 04:02:26 EST


Signed-off-by: Naoya Horiguchi <n-horiguchi@xxxxxxxxxxxxx>
---
mm/memory-failure.c | 20 ++++++++++----------
1 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/mm/memory-failure.c b/mm/memory-failure.c
index e387098..2eb740e 100644
--- a/mm/memory-failure.c
+++ b/mm/memory-failure.c
@@ -1052,7 +1052,7 @@ int __memory_failure(unsigned long pfn, int trapno, int flags)
* It's very difficult to mess with pages currently under IO
* and in many cases impossible, so we just avoid it here.
*/
- lock_page_nosync(hpage);
+ lock_page_against_memory_failure(hpage);

/*
* unpoison always clear PG_hwpoison inside page lock
@@ -1065,7 +1065,7 @@ int __memory_failure(unsigned long pfn, int trapno, int flags)
if (hwpoison_filter(p)) {
if (TestClearPageHWPoison(p))
atomic_long_sub(nr_pages, &mce_bad_pages);
- unlock_page(hpage);
+ unlock_page_against_memory_failure(hpage);
put_page(hpage);
return 0;
}
@@ -1077,7 +1077,7 @@ int __memory_failure(unsigned long pfn, int trapno, int flags)
if (PageTail(p) && TestSetPageHWPoison(hpage)) {
action_result(pfn, "hugepage already hardware poisoned",
IGNORED);
- unlock_page(hpage);
+ unlock_page_against_memory_failure(hpage);
put_page(hpage);
return 0;
}
@@ -1090,7 +1090,7 @@ int __memory_failure(unsigned long pfn, int trapno, int flags)
if (PageHuge(p))
set_page_hwpoison_huge_page(hpage);

- wait_on_page_writeback(p);
+ wait_on_pages_writeback_against_memory_failure(hpage);

/*
* Now take care of user space mappings.
@@ -1119,7 +1119,7 @@ int __memory_failure(unsigned long pfn, int trapno, int flags)
}
}
out:
- unlock_page(hpage);
+ unlock_page_against_memory_failure(hpage);
return res;
}
EXPORT_SYMBOL_GPL(__memory_failure);
@@ -1195,7 +1195,7 @@ int unpoison_memory(unsigned long pfn)
return 0;
}

- lock_page_nosync(page);
+ lock_page_against_memory_failure(page);
/*
* This test is racy because PG_hwpoison is set outside of page lock.
* That's acceptable because that won't trigger kernel panic. Instead,
@@ -1209,7 +1209,7 @@ int unpoison_memory(unsigned long pfn)
if (PageHuge(page))
clear_page_hwpoison_huge_page(page);
}
- unlock_page(page);
+ unlock_page_against_memory_failure(page);

put_page(page);
if (freeit)
@@ -1341,14 +1341,14 @@ int soft_offline_page(struct page *page, int flags)
return -EIO;
}

- lock_page(hpage);
- wait_on_page_writeback(hpage);
+ lock_page_against_memory_failure(hpage);
+ wait_on_pages_writeback_against_memory_failure(hpage);

/*
* Synchronized using the page lock with memory_failure()
*/
if (PageHWPoison(hpage)) {
- unlock_page(hpage);
+ unlock_page_against_memory_failure(hpage);
put_page(hpage);
pr_debug("soft offline: %#lx page already poisoned\n", pfn);
return -EBUSY;
--
1.7.2.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/