diff options
author | Miaohe Lin <linmiaohe@huawei.com> | 2022-04-29 09:40:43 +0300 |
---|---|---|
committer | akpm <akpm@linux-foundation.org> | 2022-05-27 19:33:44 +0300 |
commit | 6cf9a34967ed544ca4c0949e9928dc78fca57ef3 (patch) | |
tree | 32c31963ddbc44e0d73582ee903611ed0313fb3c /mm | |
parent | f4bad643c1d602f7154cf0d8eeb509136a55dccb (diff) | |
download | linux-6cf9a34967ed544ca4c0949e9928dc78fca57ef3.tar.xz |
mm/z3fold: put z3fold page back into unbuddied list when reclaim or migration fails
When doing z3fold page reclaim or migration, the page is removed from
unbuddied list. If reclaim or migration succeeds, it's fine as page is
released. But in case it fails, the page is not put back into unbuddied
list now. The page will be leaked until next compaction work, reclaim or
migration is done.
Link: https://lkml.kernel.org/r/20220429064051.61552-7-linmiaohe@huawei.com
Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>
Reviewed-by: Vitaly Wool <vitaly.wool@konsulko.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Diffstat (limited to 'mm')
-rw-r--r-- | mm/z3fold.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/mm/z3fold.c b/mm/z3fold.c index 5f5d5f1556be..a1c150fc8def 100644 --- a/mm/z3fold.c +++ b/mm/z3fold.c @@ -1422,6 +1422,8 @@ next: spin_lock(&pool->lock); list_add(&page->lru, &pool->lru); spin_unlock(&pool->lock); + if (list_empty(&zhdr->buddy)) + add_to_unbuddied(pool, zhdr); z3fold_page_unlock(zhdr); clear_bit(PAGE_CLAIMED, &page->private); } @@ -1638,6 +1640,8 @@ static void z3fold_page_putback(struct page *page) spin_lock(&pool->lock); list_add(&page->lru, &pool->lru); spin_unlock(&pool->lock); + if (list_empty(&zhdr->buddy)) + add_to_unbuddied(pool, zhdr); clear_bit(PAGE_CLAIMED, &page->private); z3fold_page_unlock(zhdr); } |