[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <df416acb-d913-4e67-b810-cd991003242e@intel.com>
Date: Mon, 26 Feb 2024 10:38:31 +0800
From: Yin Fengwei <fengwei.yin@...el.com>
To: Lance Yang <ioworker0@...il.com>, <akpm@...ux-foundation.org>
CC: <zokeefe@...gle.com>, <shy828301@...il.com>, <david@...hat.com>,
<mhocko@...e.com>, <ryan.roberts@....com>, <wangkefeng.wang@...wei.com>,
<songmuchun@...edance.com>, <peterx@...hat.com>, <minchan@...nel.org>,
<linux-mm@...ck.org>, <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 1/1] mm/madvise: enhance lazyfreeing with mTHP in
madvise_free
On 1/1/70 08:00, wrote:
> diff --git a/mm/madvise.c b/mm/madvise.c
> index cfa5e7288261..bcbf56595a2e 100644
> --- a/mm/madvise.c
> +++ b/mm/madvise.c
> @@ -676,11 +676,43 @@ static int madvise_free_pte_range(pmd_t *pmd, unsigned long addr,
> */
> if (folio_test_large(folio)) {
> int err;
> + unsigned long next_addr, align;
>
> - if (folio_estimated_sharers(folio) != 1)
> - break;
> - if (!folio_trylock(folio))
> - break;
> + if (folio_estimated_sharers(folio) != 1 ||
> + !folio_trylock(folio))
> + goto skip_large_folio;
> +
> + align = folio_nr_pages(folio) * PAGE_SIZE;
> + next_addr = ALIGN_DOWN(addr + align, align);
There is a possible corner case:
If there is a cow folio associated with this folio and the cow folio
has smaller size than this folio for whatever reason, this change can't
handle it correctly.
Regards
Yin, Fengwei
Powered by blists - more mailing lists