diff options
author | Wanpeng Li <wanpeng.li@hotmail.com> | 2015-09-08 15:03:15 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2015-09-08 15:35:28 -0700 |
commit | 94bf4ec84a84d3ab2513b4e681fd3d083328d76d (patch) | |
tree | ac1df0b30e8aee2c6a67d857ab06d55d00bc6885 /mm/memory-failure.c | |
parent | 1e0e635be82132167a134b5a9c884e70e61f8373 (diff) | |
download | lwn-94bf4ec84a84d3ab2513b4e681fd3d083328d76d.tar.gz lwn-94bf4ec84a84d3ab2513b4e681fd3d083328d76d.zip |
mm/hwpoison: introduce put_hwpoison_page to put refcount for memory error handling
Introduce put_hwpoison_page to put refcount for memory error handling.
Signed-off-by: Wanpeng Li <wanpeng.li@hotmail.com>
Suggested-by: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
Acked-by: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm/memory-failure.c')
-rw-r--r-- | mm/memory-failure.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/mm/memory-failure.c b/mm/memory-failure.c index 863544d84a09..5ceb8253e33b 100644 --- a/mm/memory-failure.c +++ b/mm/memory-failure.c @@ -934,6 +934,27 @@ int get_hwpoison_page(struct page *page) } EXPORT_SYMBOL_GPL(get_hwpoison_page); +/** + * put_hwpoison_page() - Put refcount for memory error handling: + * @page: raw error page (hit by memory error) + */ +void put_hwpoison_page(struct page *page) +{ + struct page *head = compound_head(page); + + if (PageHuge(head)) { + put_page(head); + return; + } + + if (PageTransHuge(head)) + if (page != head) + put_page(head); + + put_page(page); +} +EXPORT_SYMBOL_GPL(put_hwpoison_page); + /* * Do all that is necessary to remove user space mappings. Unmap * the pages and send SIGBUS to the processes if the data was dirty. |