On 11/09/2018 12:17 PM, Naoya Horiguchi wrote: > The new function is a reverse operation of set_hwpoison_free_buddy_page() > to adjust unpoison_memory() to the new semantics. > > Signed-off-by: Naoya Horiguchi <[email protected]> snip > + > +/* > + * Reverse operation of set_hwpoison_free_buddy_page(), which is expected > + * to work only on error pages isolated from buddy allocator. > + */ > +bool clear_hwpoison_free_buddy_page(struct page *page) > +{ > + struct zone *zone = page_zone(page); > + bool unpoisoned = false; > + > + spin_lock(&zone->lock); > + if (TestClearPageHWPoison(page)) { > + unsigned long pfn = page_to_pfn(page); > + int migratetype = get_pfnblock_migratetype(page, pfn); > + > + __free_one_page(page, pfn, zone, 0, migratetype); > + unpoisoned = true; > + } > + spin_unlock(&zone->lock); > + return unpoisoned; > +} > #endif > Though there are multiple page state checks in unpoison_memory() leading upto clearing HWPoison flag, the page must not be in buddy already if __free_one_page() would be called on it.
- [PATCH RFC v1 00/11] hwpoison improvement part 1 Naoya Horiguchi
- [RFC][PATCH v1 08/11] mm: soft-offline: isolate err... Naoya Horiguchi
- [RFC][PATCH v1 07/11] mm: remove flag argument from... Naoya Horiguchi
- [RFC][PATCH v1 10/11] mm: clear PageHWPoison in mem... Naoya Horiguchi
- [RFC][PATCH v1 06/11] mm: hwpoison: remove MF_COUNT... Naoya Horiguchi
- [RFC][PATCH v1 02/11] mm: soft-offline: add missing... Naoya Horiguchi
- Re: [RFC][PATCH v1 02/11] mm: soft-offline: add... Anshuman Khandual
- [RFC][PATCH v1 04/11] mm: madvise: call soft_offlin... Naoya Horiguchi
- Re: [RFC][PATCH v1 04/11] mm: madvise: call sof... Anshuman Khandual
- [RFC][PATCH v1 11/11] mm: hwpoison: introduce clear... Naoya Horiguchi
- Re: [RFC][PATCH v1 11/11] mm: hwpoison: introdu... Anshuman Khandual
- [RFC][PATCH v1 05/11] mm: hwpoison-inject: don't pi... Naoya Horiguchi
- [RFC][PATCH v1 01/11] mm: hwpoison: cleanup unused ... Naoya Horiguchi
- Re: [RFC][PATCH v1 01/11] mm: hwpoison: cleanup... Anshuman Khandual
- [RFC][PATCH v1 09/11] mm: hwpoison: apply buddy pag... Naoya Horiguchi
- [RFC][PATCH v1 03/11] mm: move definition of num_po... Naoya Horiguchi
- Re: [RFC][PATCH v1 03/11] mm: move definition o... Anshuman Khandual

