[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <d48bcbcc-0935-4d04-b6a8-f1ceec8190bf@linux.alibaba.com>
Date: Thu, 13 Jun 2024 16:20:36 +0800
From: Baolin Wang <baolin.wang@...ux.alibaba.com>
To: Lance Yang <ioworker0@...il.com>, akpm@...ux-foundation.org
Cc: 21cnbao@...il.com, david@...hat.com, fengwei.yin@...el.com,
libang.li@...group.com, linux-kernel@...r.kernel.org, linux-mm@...ck.org,
maskray@...gle.com, mhocko@...e.com, minchan@...nel.org, peterx@...hat.com,
ryan.roberts@....com, shy828301@...il.com, sj@...nel.org,
songmuchun@...edance.com, wangkefeng.wang@...wei.com, willy@...radead.org,
xiehuan09@...il.com, ziy@...dia.com, zokeefe@...gle.com
Subject: Re: [PATCH v7 4/4] mm/vmscan: avoid split lazyfree THP during
shrink_folio_list()
On 2024/6/13 15:28, Lance Yang wrote:
> Hi Andrew,
>
> I'd like to fix the bug[1] I mentioned previously. Could you please fold the
> following changes into this patch?
>
> [1] https://lore.kernel.org/linux-mm/20240613065521.15960-1-ioworker0@gmail.com/
>
> diff --git a/mm/huge_memory.c b/mm/huge_memory.c
> index f409ea9fcc18..425374ae06ed 100644
> --- a/mm/huge_memory.c
> +++ b/mm/huge_memory.c
> @@ -2707,10 +2707,8 @@ static bool __discard_anon_folio_pmd_locked(struct vm_area_struct *vma,
> if (unlikely(page_folio(page) != folio))
> return false;
>
> - if (folio_test_dirty(folio) || pmd_dirty(orig_pmd)) {
> - folio_set_swapbacked(folio);
> + if (folio_test_dirty(folio) || pmd_dirty(orig_pmd))
> return false;
> - }
>
> orig_pmd = pmdp_huge_clear_flush(vma, addr, pmdp);
>
> @@ -2737,10 +2735,8 @@ static bool __discard_anon_folio_pmd_locked(struct vm_area_struct *vma,
> *
> * The only folio refs must be one from isolation plus the rmap(s).
> */
> - if (folio_test_dirty(folio) || pmd_dirty(orig_pmd))
> - folio_set_swapbacked(folio);
> -
> - if (folio_test_swapbacked(folio) || ref_count != map_count + 1) {
> + if (folio_test_dirty(folio) || pmd_dirty(orig_pmd) ||
> + ref_count != map_count + 1) {
> set_pmd_at(mm, addr, pmdp, orig_pmd);
> return false;
> }
> diff --git a/mm/rmap.c b/mm/rmap.c
> index b9e5943c8349..393e2c11c44c 100644
> --- a/mm/rmap.c
> +++ b/mm/rmap.c
> @@ -1824,12 +1824,7 @@ static bool try_to_unmap_one(struct folio *folio, struct vm_area_struct *vma,
> */
> if (unlikely(folio_test_swapbacked(folio) !=
> folio_test_swapcache(folio))) {
> - /*
> - * unmap_huge_pmd_locked() will unmark a
> - * PMD-mapped folio as lazyfree if the folio or
> - * its PMD was redirtied.
> - */
> - WARN_ON_ONCE(!pmd_mapped);
> + WARN_ON_ONCE(1);
> goto walk_done_err;
> }
>
You can also drop the unused 'pmd_mapped' variable now.
Powered by blists - more mailing lists