Linux kernel -stable discussions
 help / color / mirror / Atom feed
From: "Zi Yan" <ziy@nvidia.com>
To: "Usama Arif" <usama.arif@linux.dev>,
	"Andrew Morton" <akpm@linux-foundation.org>,
	<willy@infradead.org>, <jack@suse.cz>, <david@kernel.org>,
	<axboe@kernel.dk>, "Christoph Hellwig" <hch@lst.de>,
	<hannes@cmpxchg.org>, <jlayton@kernel.org>, <brauner@kernel.org>,
	<tz2294@columbia.edu>, <ritesh.list@gmail.com>,
	<chentaotao@didiglobal.com>, <bigeasy@linutronix.de>,
	<liam@infradead.org>, <vbabka@kernel.org>, <rppt@kernel.org>,
	<mhocko@suse.com>, <apopple@nvidia.com>, <byungchul@sk.com>,
	<gourry@gourry.net>, <joshua.hahnjy@gmail.com>,
	<matthew.brost@intel.com>, <ying.huang@linux.alibaba.com>,
	<clrkwllms@kernel.org>, <rostedt@goodmis.org>,
	<linux-mm@kvack.org>, <linux-fsdevel@vger.kernel.org>,
	<linux-rt-devel@lists.linux.dev>, <kas@kernel.org>,
	<riel@surriel.com>, <shakeel.butt@linux.dev>,
	<kernel-team@meta.com>
Cc: <stable@vger.kernel.org>
Subject: Re: [PATCH 1/4] mm/migrate: preserve PG_dropbehind across folio migration
Date: Wed, 02 Dec 2026 10:03:59 -0500	[thread overview]
Message-ID: <DNAC7KC3R1HQ.3SAT54TD49G0W@nvidia.com> (raw)
In-Reply-To: <20261202142513.2951661-2-usama.arif@linux.dev>

On Wed Dec 2, 2026 at 9:24 AM EST, Usama Arif wrote:
> Migration moves PG_dirty to the new folio but not PG_dropbehind, so a
> migrated dirty dropbehind folio is cleaned without decrementing
> WB_DONTCACHE_DIRTY. The counter leaks, and every later RWF_DONTCACHE
> kick asks the flusher for that many more pages. Copy the flag along with
> PG_dirty, before the new folio becomes visible.
>
> With RWF_DONTCACHE writes and compaction running for five minutes, 1313
> to 1709 pages leaked, all of them migrated.
>
> Fixes: 88d6f128d06d ("mm: track DONTCACHE dirty pages per bdi_writeback")
> Cc: stable@vger.kernel.org
> Signed-off-by: Usama Arif <usama.arif@linux.dev>
> ---
>  mm/migrate.c | 3 +++
>  1 file changed, 3 insertions(+)

Makes sense to me. Thanks.

Reviewed-by: Zi Yan <ziy@nvidia.com>

>
> diff --git a/mm/migrate.c b/mm/migrate.c
> index 96b66a272379f9..81a8e46778610f 100644
> --- a/mm/migrate.c
> +++ b/mm/migrate.c
> @@ -663,6 +663,9 @@ static int __folio_migrate_mapping(struct address_space *mapping,
>  		folio_clear_dirty(folio);
>  		folio_set_dirty(newfolio);
>  	}
> +	/* WB_DONTCACHE_DIRTY counts pages that are both dirty and dropbehind */
> +	if (folio_test_dropbehind(folio))
> +		folio_set_dropbehind(newfolio);
>  
>  	if (folio_test_swapcache(folio))
>  		__swap_cache_replace_folio(ci, folio, newfolio);

This "test then set" pattern fills the most of
__folio_migrate_mapping(), I wonder if we can do that in bulk in a
follow-up cleanup.


-- 
Best Regards,
Yan, Zi


  parent reply	other threads:[~2026-12-02 15:04 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20261202142513.2951661-1-usama.arif@linux.dev>
2026-12-02 14:24 ` [PATCH 1/4] mm/migrate: preserve PG_dropbehind across folio migration Usama Arif
2026-12-02 14:41   ` Jan Kara
2026-12-02 14:56   ` Jeff Layton
2026-12-02 15:03   ` Zi Yan [this message]
2026-12-02 15:08   ` David Hildenbrand (Arm)
2026-12-02 14:24 ` [PATCH 2/4] mm/filemap: clear PG_dropbehind on lookup under the folio lock Usama Arif
2026-12-02 14:42   ` Jan Kara
2026-12-02 15:04   ` Jeff Layton
2026-12-02 14:24 ` [PATCH 3/4] mm/filemap: don't drop dropbehind folios with interrupts disabled Usama Arif
2026-12-02 14:51   ` Jan Kara
2026-12-02 15:04   ` Jeff Layton

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=DNAC7KC3R1HQ.3SAT54TD49G0W@nvidia.com \
    --to=ziy@nvidia.com \
    --cc=akpm@linux-foundation.org \
    --cc=apopple@nvidia.com \
    --cc=axboe@kernel.dk \
    --cc=bigeasy@linutronix.de \
    --cc=brauner@kernel.org \
    --cc=byungchul@sk.com \
    --cc=chentaotao@didiglobal.com \
    --cc=clrkwllms@kernel.org \
    --cc=david@kernel.org \
    --cc=gourry@gourry.net \
    --cc=hannes@cmpxchg.org \
    --cc=hch@lst.de \
    --cc=jack@suse.cz \
    --cc=jlayton@kernel.org \
    --cc=joshua.hahnjy@gmail.com \
    --cc=kas@kernel.org \
    --cc=kernel-team@meta.com \
    --cc=liam@infradead.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=linux-rt-devel@lists.linux.dev \
    --cc=matthew.brost@intel.com \
    --cc=mhocko@suse.com \
    --cc=riel@surriel.com \
    --cc=ritesh.list@gmail.com \
    --cc=rostedt@goodmis.org \
    --cc=rppt@kernel.org \
    --cc=shakeel.butt@linux.dev \
    --cc=stable@vger.kernel.org \
    --cc=tz2294@columbia.edu \
    --cc=usama.arif@linux.dev \
    --cc=vbabka@kernel.org \
    --cc=willy@infradead.org \
    --cc=ying.huang@linux.alibaba.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