linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: David Hildenbrand <david@redhat.com>
To: Jinjiang Tu <tujinjiang@huawei.com>,
	yangge1116@126.com, akpm@linux-foundation.org
Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	stable@vger.kernel.org, 21cnbao@gmail.com,
	baolin.wang@linux.alibaba.com, aneesh.kumar@linux.ibm.com,
	liuzixing@hygon.cn, Kefeng Wang <wangkefeng.wang@huawei.com>
Subject: Re: [PATCH V4] mm/gup: Clear the LRU flag of a page before adding to LRU batch
Date: Wed, 26 Mar 2025 13:46:31 +0100	[thread overview]
Message-ID: <91ac638d-b2d6-4683-ab29-fb647f58af63@redhat.com> (raw)
In-Reply-To: <4119c1d0-5010-b2e7-3f1c-edd37f16f1f2@huawei.com>

On 26.03.25 13:42, Jinjiang Tu wrote:
> Hi,
> 

Hi!

> We notiched a 12.3% performance regression for LibMicro pwrite testcase due to
> commit 33dfe9204f29 ("mm/gup: clear the LRU flag of a page before adding to LRU batch").
> 
> The testcase is executed as follows, and the file is tmpfs file.
>      pwrite -E -C 200 -L -S -W -N "pwrite_t1k" -s 1k -I 500 -f $TFILE

Do we know how much that reflects real workloads? (IOW, how much should 
we care)

> 
> this testcase writes 1KB (only one page) to the tmpfs and repeats this step for many times. The Flame
> graph shows the performance regression comes from folio_mark_accessed() and workingset_activation().
> 
> folio_mark_accessed() is called for the same page for many times. Before this patch, each call will
> add the page to cpu_fbatches.activate. When the fbatch is full, the fbatch is drained and the page
> is promoted to active list. And then, folio_mark_accessed() does nothing in later calls.
> 
> But after this patch, the folio clear lru flags after it is added to cpu_fbatches.activate. After then,
> folio_mark_accessed will never call folio_activate() again due to the page is without lru flag, and
> the fbatch will not be full and the folio will not be marked active, later folio_mark_accessed()
> calls will always call workingset_activation(), leading to performance regression.

Would there be a good place to drain the LRU to effectively get that 
processed? (we can always try draining if the LRU flag is not set)


-- 
Cheers,

David / dhildenb



  reply	other threads:[~2025-03-26 12:46 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-04  6:52 yangge1116
2024-07-12  8:56 ` Hugh Dickins
2024-07-12 20:56   ` Andrew Morton
2025-03-26 12:42 ` Jinjiang Tu
2025-03-26 12:46   ` David Hildenbrand [this message]
2025-03-27 11:16     ` Jinjiang Tu
2025-04-01 14:33       ` David Hildenbrand
2025-04-07  7:41         ` Jinjiang Tu
2025-04-08  8:47         ` Jinjiang Tu
2025-04-08 10:04           ` David Hildenbrand
2025-04-08 12:01             ` Jinjiang Tu
2025-04-10  8:06             ` Jinjiang Tu

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=91ac638d-b2d6-4683-ab29-fb647f58af63@redhat.com \
    --to=david@redhat.com \
    --cc=21cnbao@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=aneesh.kumar@linux.ibm.com \
    --cc=baolin.wang@linux.alibaba.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=liuzixing@hygon.cn \
    --cc=stable@vger.kernel.org \
    --cc=tujinjiang@huawei.com \
    --cc=wangkefeng.wang@huawei.com \
    --cc=yangge1116@126.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