mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Matthew Wilcox <willy@infradead.org>
To: Xavier Xia <xavier.qyxia@gmail.com>
Cc: akpm@linux-foundation.org, hannes@cmpxchg.org,
	shakeel.butt@linux.dev, mhocko@kernel.org,
	roman.gushchin@linux.dev, muchun.song@linux.dev, jack@suse.cz,
	david@kernel.org, brauner@kernel.org, linux-mm@kvack.org,
	cgroups@vger.kernel.org, linux-fsdevel@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] mm: batch per-task lruvec stat updates on the writeback path
Date: Fri, 20 Nov 2026 13:41:09 +0000	[thread overview]
Message-ID: <awBN9VvV6yM6Cjut@casper.infradead.org> (raw)
In-Reply-To: <20261120095559.429515-1-xavier.qyxia@gmail.com>

On Fri, Nov 20, 2026 at 05:55:58PM +0800, Xavier Xia wrote:
> The writeback path updates two lruvec stats per folio through the memcg
> rstat machinery: NR_FILE_DIRTY when a folio is dirtied and again when
> writeback clears it, and NR_WRITEBACK when writeback starts on it.
> Consecutive folios almost always share a lruvec, so the same counters
> are updated over and over.  On a 4k buffered write + fsync workload
> __mod_memcg_lruvec_state() is about 8% of the profile.

Is this a realistic benchmark?  Does it represent some real life workload,
or did you just choose it because it shows the best benefit of this patch?
This is a fairly significant chunk of extra code, and it'd be nice to
know that it benefits a real-world use-case before applying it.

If the real world usecase is more "there's some pretty high overhead
when flushing accumulated megabytes of dirtied page cache", then there
are simpler solutions that don't involve messing with task_struct.

      reply	other threads:[~2026-11-20 13:41 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-20  9:55 Xavier Xia
2026-11-20 13:41 ` Matthew Wilcox [this message]

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=awBN9VvV6yM6Cjut@casper.infradead.org \
    --to=willy@infradead.org \
    --cc=akpm@linux-foundation.org \
    --cc=brauner@kernel.org \
    --cc=cgroups@vger.kernel.org \
    --cc=david@kernel.org \
    --cc=hannes@cmpxchg.org \
    --cc=jack@suse.cz \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@kernel.org \
    --cc=muchun.song@linux.dev \
    --cc=roman.gushchin@linux.dev \
    --cc=shakeel.butt@linux.dev \
    --cc=xavier.qyxia@gmail.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®