Re: [PATCH 1/2] mm: fix logic error of page_expected_state

From: Zhaoyang Huang
Date: Wed Sep 14 2022 - 04:15:18 EST


On Wed, Sep 14, 2022 at 3:35 PM Matthew Wilcox <willy@xxxxxxxxxxxxx> wrote:
>
> On Wed, Sep 14, 2022 at 11:37:00AM +0800, zhaoyang.huang wrote:
> > From: Zhaoyang Huang <zhaoyang.huang@xxxxxxxxxx>
> >
> > The page with special page type will be deemed as bad page wrongly since
> > type share the same address with mapcount.
>
> That's not wrongly. You didn't clear the bit. I told you you would
> need to do that in the first version of the patch you sent.
Yes, I have cleared the PG_trackleak since v2 as you suggested.
However, IMHO, the page which has page type should be skipped for
mapcount check. The present problem is there is no invoking of
free_pages_prepare within the chain of
drain_pages_zone->free_pcppages_bulk, special pages with
page->type(PG_guard and PG_trackleak etc) will be leaked as
bulkfree_pcp_prepare will deem it as bad by checking the mapcount.