Linux-mm Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "David Hildenbrand (Arm)" <david@kernel.org>
To: Barry Song <baohua@kernel.org>
Cc: akpm@linux-foundation.org, linux-mm@kvack.org,
	baolin.wang@linux.alibaba.com, dev.jain@arm.com,
	lance.yang@linux.dev, liam@infradead.org,
	linux-kernel@vger.kernel.org, ljs@kernel.org, mhocko@suse.com,
	npache@redhat.com, rppt@kernel.org, ryan.roberts@arm.com,
	surenb@google.com, vbabka@kernel.org, ziy@nvidia.com,
	hughd@google.com, ackerleytng@google.com, usama.arif@linux.dev,
	joannelkoong@gmail.com, hannes@cmpxchg.org
Subject: Re: [RFC PATCH v3 0/4] mm: enable lru cache for smaller large folios
Date: Fri, 21 Aug 2026 16:18:31 +0200	[thread overview]
Message-ID: <cade8707-26e7-4f8b-a056-95094bf8756c@kernel.org> (raw)
In-Reply-To: <CAGsJ_4xT-Nga9yCa_QtbmFQ3tm0LJF0doCsV3pJpO0i+2z4yww@mail.gmail.com>

On 8/20/26 22:18, Barry Song wrote:
> On Fri, Aug 21, 2026 at 2:23 AM David Hildenbrand (Arm)
> <david@kernel.org> wrote:
>>
>> On 8/19/26 00:59, Barry Song (Xiaomi) wrote:
>>> This patchset enables the per-CPU LRU cache for large folios with fewer
>>> than `FOLIO_BATCH_SIZE` (31) pages. It also limits each per-CPU LRU cache
>>> to at most `FOLIO_BATCH_SIZE` pages to avoid negatively affecting
>>> accounting and memory reclamation pressure.
>>>
>>> This is particularly beneficial on systems that use relatively small
>>> large folios. For larger folios, the benefit is likely to be smaller
>>> because far fewer folios are expected to contend for the LRU cache.
>>
>> As raised, there is this problem with collect_longterm_unpinnable_folios()
>>
>> (see
>> https://lore.kernel.org/r/20260806-lru_cache_drain_for_folio-v1-1-c6287d295e99@kernel.org
>> )
>>
>> whereby we don't know how many refs we actually hold. Certainly not 1.
>>
>> We might have to wait for Hugh's cleanup to handle that cleanly (and avoid all
>> the other LRU cache draining).
> 
> Hi David,
> Thanks for raising this.
> Yes, I saw your comment and took a closer look at it. I think the
> best approach for now is to leave that part untouched until Hugh's
> patch lands? 

I think we should not consider your patch set until Hugh either resolved it or
we have a better way to handle draining. Building on top of this for large
folios now just gets painful.

> We might end up doing some extra draining in that case,
> but that's safe—any value greater than 1 might not be. 

We'll unconditionally drain all LRU caches, which is precisely *not* what we
want to do in the first place. :)

-- 
Cheers,

David



  parent reply	other threads:[~2026-08-21 14:18 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-18 22:59 [RFC PATCH v3 0/4] mm: enable lru cache for smaller large folios Barry Song (Xiaomi)
2026-08-18 22:59 ` [RFC PATCH v3 1/4] mm: allow smaller large folios to use lru_cache Barry Song (Xiaomi)
2026-08-19  4:34   ` Barry Song
2026-08-18 22:59 ` [RFC PATCH v3 2/4] mm: improve large folio reuse for LRU-cached folios Barry Song (Xiaomi)
2026-08-18 22:59 ` [RFC PATCH v3 3/4] mm: drain LRU cache if necessary for splitting large folios Barry Song (Xiaomi)
2026-08-20 10:14   ` Barry Song
2026-08-18 22:59 ` [RFC PATCH v3 4/4] mm: batch lru_cache draining in deferred_split_scan Barry Song (Xiaomi)
2026-08-19  3:02 ` [RFC PATCH v3 0/4] mm: enable lru cache for smaller large folios Lance Yang
2026-08-19  4:38   ` Barry Song
2026-08-20 18:23 ` David Hildenbrand (Arm)
2026-08-20 20:18   ` Barry Song
2026-08-20 20:22     ` Barry Song
2026-08-21 14:18     ` David Hildenbrand (Arm) [this message]
2026-08-21 18:53       ` Barry 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=cade8707-26e7-4f8b-a056-95094bf8756c@kernel.org \
    --to=david@kernel.org \
    --cc=ackerleytng@google.com \
    --cc=akpm@linux-foundation.org \
    --cc=baohua@kernel.org \
    --cc=baolin.wang@linux.alibaba.com \
    --cc=dev.jain@arm.com \
    --cc=hannes@cmpxchg.org \
    --cc=hughd@google.com \
    --cc=joannelkoong@gmail.com \
    --cc=lance.yang@linux.dev \
    --cc=liam@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=ljs@kernel.org \
    --cc=mhocko@suse.com \
    --cc=npache@redhat.com \
    --cc=rppt@kernel.org \
    --cc=ryan.roberts@arm.com \
    --cc=surenb@google.com \
    --cc=usama.arif@linux.dev \
    --cc=vbabka@kernel.org \
    --cc=ziy@nvidia.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