Skip to content

Commit 7453bf6

Browse files
nhoriguchiakpm00
authored andcommitted
mm, hwpoison: make __page_handle_poison returns int
__page_handle_poison() returns bool that shows whether take_page_off_buddy() has passed or not now. But we will want to distinguish another case of "dissolve has passed but taking off failed" by its return value. So change the type of the return value. No functional change. Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: Naoya Horiguchi <[email protected]> Reviewed-by: Miaohe Lin <[email protected]> Cc: David Hildenbrand <[email protected]> Cc: kernel test robot <[email protected]> Cc: Liu Shixin <[email protected]> Cc: Mike Kravetz <[email protected]> Cc: Muchun Song <[email protected]> Cc: Oscar Salvador <[email protected]> Cc: Yang Shi <[email protected]> Signed-off-by: Andrew Morton <[email protected]>
1 parent 38f6d29 commit 7453bf6

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

mm/memory-failure.c

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,13 @@ atomic_long_t num_poisoned_pages __read_mostly = ATOMIC_LONG_INIT(0);
7474

7575
static bool hw_memory_failure __read_mostly = false;
7676

77-
static bool __page_handle_poison(struct page *page)
77+
/*
78+
* Return values:
79+
* 1: the page is dissolved (if needed) and taken off from buddy,
80+
* 0: the page is dissolved (if needed) and not taken off from buddy,
81+
* < 0: failed to dissolve.
82+
*/
83+
static int __page_handle_poison(struct page *page)
7884
{
7985
int ret;
8086

@@ -84,7 +90,7 @@ static bool __page_handle_poison(struct page *page)
8490
ret = take_page_off_buddy(page);
8591
zone_pcp_enable(page_zone(page));
8692

87-
return ret > 0;
93+
return ret;
8894
}
8995

9096
static bool page_handle_poison(struct page *page, bool hugepage_or_freepage, bool release)
@@ -94,7 +100,7 @@ static bool page_handle_poison(struct page *page, bool hugepage_or_freepage, boo
94100
* Doing this check for free pages is also fine since dissolve_free_huge_page
95101
* returns 0 for non-hugetlb pages as well.
96102
*/
97-
if (!__page_handle_poison(page))
103+
if (__page_handle_poison(page) <= 0)
98104
/*
99105
* We could fail to take off the target page from buddy
100106
* for example due to racy page allocation, but that's
@@ -1086,7 +1092,7 @@ static int me_huge_page(struct page_state *ps, struct page *p)
10861092
* subpages.
10871093
*/
10881094
put_page(hpage);
1089-
if (__page_handle_poison(p)) {
1095+
if (__page_handle_poison(p) > 0) {
10901096
page_ref_inc(p);
10911097
res = MF_RECOVERED;
10921098
}
@@ -1867,7 +1873,7 @@ static int try_memory_failure_hugetlb(unsigned long pfn, int flags, int *hugetlb
18671873
if (res == 0) {
18681874
unlock_page(head);
18691875
res = MF_FAILED;
1870-
if (__page_handle_poison(p)) {
1876+
if (__page_handle_poison(p) > 0) {
18711877
page_ref_inc(p);
18721878
res = MF_RECOVERED;
18731879
}

0 commit comments

Comments
 (0)