The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: "David Hildenbrand (Arm)" <david@kernel.org>
To: fujunjie <fujunjie1@qq.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	"Matthew Wilcox (Oracle)" <willy@infradead.org>
Cc: Jan Kara <jack@suse.cz>, Vlastimil Babka <vbabka@kernel.org>,
	Michal Hocko <mhocko@suse.com>, Lorenzo Stoakes <ljs@kernel.org>,
	"Liam R. Howlett" <Liam.Howlett@oracle.com>,
	Mike Rapoport <rppt@kernel.org>,
	Suren Baghdasaryan <surenb@google.com>,
	linux-mm@kvack.org, linux-fsdevel@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] mm/fadvise: avoid remote LRU drain for mapped folio failures
Date: Mon, 11 May 2026 07:47:43 +0200	[thread overview]
Message-ID: <f7669744-f71c-49ee-9241-c015ed90f165@kernel.org> (raw)
In-Reply-To: <tencent_DEDC345B4071ED3C9B293ACD437B9C8DBC0A@qq.com>

> -long mapping_evict_folio(struct address_space *mapping, struct folio *folio)
> +static long __mapping_evict_folio(struct address_space *mapping,
> +				  struct folio *folio, bool *lru_refs)
>  {
> +	if (lru_refs)
> +		*lru_refs = false;
>  	/* The page may have been truncated before it was locked */
>  	if (!mapping)
>  		return 0;
> @@ -331,14 +323,38 @@ long mapping_evict_folio(struct address_space *mapping, struct folio *folio)
>  		return 0;
>  	/* The refcount will be elevated if any page in the folio is mapped */
>  	if (folio_ref_count(folio) >
> -			folio_nr_pages(folio) + folio_has_private(folio) + 1)
> +			folio_nr_pages(folio) + folio_has_private(folio) + 1) {
> +		/*
> +		 * A remote LRU drain can only help with extra references on
> +		 * otherwise evictable folios.  Mapped folios also have an
> +		 * elevated refcount, but draining LRU caches cannot unmap them.
> +		 */
> +		if (lru_refs && !folio_mapped(folio))
> +			*lru_refs = true;

How can you conclude that it's a LRU refs? Could also just be something trivial
like a remaining GUP reference, or am I wrong?

-- 
Cheers,

David

  parent reply	other threads:[~2026-05-11  5:47 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-06 11:23 [PATCH] mm/fadvise: avoid remote LRU drain for mapped folio failures fujunjie
2026-05-08 23:35 ` Andrew Morton
2026-05-10 18:14   ` Matthew Wilcox
2026-05-11  6:52     ` Fujunjie
2026-05-11  5:47 ` David Hildenbrand (Arm) [this message]
2026-05-11  6:46   ` Fujunjie

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=f7669744-f71c-49ee-9241-c015ed90f165@kernel.org \
    --to=david@kernel.org \
    --cc=Liam.Howlett@oracle.com \
    --cc=akpm@linux-foundation.org \
    --cc=fujunjie1@qq.com \
    --cc=jack@suse.cz \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=ljs@kernel.org \
    --cc=mhocko@suse.com \
    --cc=rppt@kernel.org \
    --cc=surenb@google.com \
    --cc=vbabka@kernel.org \
    --cc=willy@infradead.org \
    /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