On 15 Feb 2024, at 11:57, Vlastimil Babka wrote: > On 2/14/24 23:04, Zi Yan wrote: >> @@ -1849,10 +1857,22 @@ static struct folio *compaction_alloc(struct folio *src, unsigned long data) >> static void compaction_free(struct folio *dst, unsigned long data) >> { >> struct compact_control *cc = (struct compact_control *)data; >> + int order = folio_order(dst); >> + struct page *page = &dst->page; >> + >> + if (folio_put_testzero(dst)) { >> + free_pages_prepare_fpi_none(page, order); >> + >> + INIT_LIST_HEAD(&dst->lru); > > (is this even needed? I think the state of first parameter of list_add() is > never expected to be in particular state?) There is a __list_add_valid() performing list corruption checks. > >> >> - list_add(&dst->lru, &cc->freepages); >> - cc->nr_freepages++; >> - cc->nr_migratepages += 1 << folio_order(dst); >> + list_add(&dst->lru, &cc->freepages[order]); >> + cc->nr_freepages += 1 << order; >> + cc->nr_migratepages += 1 << order; > > Hm actually this increment of nr_migratepages should happen even if we lost > the free page. Because compaction_free() indicates the page is not migrated and nr_migratepages should be increased regardless. Will fix it. Thanks. >> + } >> + /* >> + * someone else has referenced the page, we cannot take it back to our >> + * free list. >> + */ >> } -- Best Regards, Yan, Zi
Attachment:
signature.asc
Description: OpenPGP digital signature