[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210804142257.tsgzpfc3zq7um7iu@box.shutemov.name>
Date: Wed, 4 Aug 2021 17:22:57 +0300
From: "Kirill A. Shutemov" <kirill@...temov.name>
To: Yu Zhao <yuzhao@...gle.com>
Cc: linux-mm@...ck.org, Andrew Morton <akpm@...ux-foundation.org>,
Hugh Dickins <hughd@...gle.com>,
"Kirill A . Shutemov" <kirill.shutemov@...ux.intel.com>,
Matthew Wilcox <willy@...radead.org>,
Vlastimil Babka <vbabka@...e.cz>,
Yang Shi <shy828301@...il.com>, Zi Yan <ziy@...dia.com>,
linux-kernel@...r.kernel.org, Shuang Zhai <zhais@...gle.com>
Subject: Re: [PATCH 2/3] mm: free zapped tail pages when splitting isolated
thp
On Sat, Jul 31, 2021 at 12:39:37AM -0600, Yu Zhao wrote:
> @@ -2506,6 +2508,25 @@ static void __split_huge_page(struct page *page, struct list_head *list,
> continue;
> unlock_page(subpage);
>
> + /*
> + * If a tail page has only two references left, one inherited
> + * from the isolation of its head and the other from
> + * lru_add_page_tail() which we are about to drop, it means this
> + * tail page was concurrently zapped. Then we can safely free it
> + * and save page reclaim or migration the trouble of trying it.
> + */
> + if (list && page_ref_freeze(subpage, 2)) {
> + VM_BUG_ON_PAGE(PageLRU(subpage), subpage);
> + VM_BUG_ON_PAGE(PageCompound(subpage), subpage);
> + VM_BUG_ON_PAGE(page_mapped(subpage), subpage);
> +
> + ClearPageActive(subpage);
> + ClearPageUnevictable(subpage);
Why touch PG_Active/PG_Unevictable?
> + list_move(&subpage->lru, &pages_to_free);
> + nr_pages_to_free++;
> + continue;
> + }
> +
--
Kirill A. Shutemov
Powered by blists - more mailing lists