mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Baolin Wang <baolin.wang@linux.alibaba.com>
To: "Barry Song (Xiaomi)" <baohua@kernel.org>, akpm@linux-foundation.org
Cc: hannes@cmpxchg.org, mhocko@kernel.org, qi.zheng@linux.dev,
	shakeel.butt@linux.dev, kasong@tencent.com,
	axelrasmussen@google.com, yuanchu@google.com, weixugc@google.com,
	baoquan.he@linux.dev, mason@kernel.org, david@kernel.org,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	ridong.chen@linux.dev, yuzhao@google.com
Subject: Re: [PATCH 1/3] mm/mglru: count all generations as evictable
Date: Tue, 1 Dec 2026 15:01:46 +0800	[thread overview]
Message-ID: <93d1945e-96df-459d-a1a7-b5a82dab9079@linux.alibaba.com> (raw)
In-Reply-To: <20261129143759.96221-2-baohua@kernel.org>



On 11/29/26 10:37 PM, Barry Song (Xiaomi) wrote:
> From: Chris Mason <mason@kernel.org>
> 
> With MGLRU enabled, clean page cache that was reparented from a removed
> memory cgroup can stay unreclaimable for as long as the parent has no
> other evictable folios on the same node.
> 
> try_to_shrink_lruvec() derives its scan count from
> lruvec_evictable_size(), and with a count of 0 it runs neither eviction
> nor aging. lruvec_evictable_size() adds up nr_pages[] only for the
> generations from min_seq to max_seq. That sum is complete only if the
> count of a generation is 0 by the time min_seq advances past it.
> 
> But try_to_inc_min_seq() ignores the counts: it advances min_seq past a
> generation as soon as the lists of that generation are empty. A folio
> that folio_update_gen() promoted is counted in its new generation, but
> stays on the list of the generation that it came from. Normally min_seq
> stops at that list, before it reaches the new generation.
> 
> Reparenting moves each list and each count to the same index in the
> parent, where that index can stand for a different age:
> 
>      index (seq % MAX_NR_GENS)    0  1  2  3
>      seq in the child             0  1  2  3
>      seq in the parent            4  5  6  3
> 
>      folio F:  on folios[0], counted in nr_pages[3]
>      child:    folios[0] holds min_seq at 0
>      parent:   folios[3] is empty, so min_seq goes from 3 to 4
>      sum:      nr_pages[0] + nr_pages[1] + nr_pages[2] = 0, without F
> 
> The fix used here is to add up nr_pages[] of all MAX_NR_GENS generations
> in lruvec_evictable_size().
> 
> Fixes: 163bc3d68c9f ("mm/mglru: restructure the reclaim loop")
> Signed-off-by: Chris Mason <mason@kernel.org>
> Signed-off-by: David Hildenbrand (Arm) <david@kernel.org>
> [Barry: Rebased onto mm-new and added comments]
> Signed-off-by: Barry Song (Xiaomi) <baohua@kernel.org>
> ---

LGTM.
Reviewed-by: Baolin Wang <baolin.wang@linux.alibaba.com>

  reply	other threads:[~2026-12-01  7:01 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-29 14:37 [PATCH 0/3] mm/mglru: fix a few reclaim issues Barry Song (Xiaomi)
2026-11-29 14:37 ` [PATCH 1/3] mm/mglru: count all generations as evictable Barry Song (Xiaomi)
2026-12-01  7:01   ` Baolin Wang [this message]
2026-11-29 14:37 ` [PATCH 2/3] mm/mglru: test PG_lru before taking a folio reference Barry Song (Xiaomi)
2026-12-01  7:18   ` Baolin Wang
2026-11-29 14:37 ` [PATCH 3/3] mm/mglru: report root reclaim to memory.pressure_level Barry Song (Xiaomi)
2026-11-30  3:53 ` [PATCH 0/3] mm/mglru: fix a few reclaim issues Kairui Song

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=93d1945e-96df-459d-a1a7-b5a82dab9079@linux.alibaba.com \
    --to=baolin.wang@linux.alibaba.com \
    --cc=akpm@linux-foundation.org \
    --cc=axelrasmussen@google.com \
    --cc=baohua@kernel.org \
    --cc=baoquan.he@linux.dev \
    --cc=david@kernel.org \
    --cc=hannes@cmpxchg.org \
    --cc=kasong@tencent.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mason@kernel.org \
    --cc=mhocko@kernel.org \
    --cc=qi.zheng@linux.dev \
    --cc=ridong.chen@linux.dev \
    --cc=shakeel.butt@linux.dev \
    --cc=weixugc@google.com \
    --cc=yuanchu@google.com \
    --cc=yuzhao@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®