linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: David Hildenbrand <david@redhat.com>
To: Jinjiang Tu <tujinjiang@huawei.com>,
	willy@infradead.org, akpm@linux-foundation.org,
	linux-mm@kvack.org
Cc: wangkefeng.wang@huawei.com
Subject: Re: [PATCH v3] filemap: optimize folio refount update in filemap_map_pages
Date: Thu, 4 Sep 2025 20:46:10 +0200	[thread overview]
Message-ID: <8f56ce48-6743-47f5-88e4-4c65f6865216@redhat.com> (raw)
In-Reply-To: <20250904132737.1250368-1-tujinjiang@huawei.com>

On 04.09.25 15:27, Jinjiang Tu wrote:
> There are two meaningless folio refcount update for order0 folio in
> filemap_map_pages(). First, filemap_map_order0_folio() adds folio refcount
> after the folio is mapped to pte. And then, filemap_map_pages() drops a
> refcount grabbed by next_uptodate_folio(). We could remain the refcount
> unchanged in this case.
> 
> As Matthew metenioned in [1], it is safe to call folio_unlock() before
> calling folio_put() here, because the folio is in page cache with refcount
> held, and truncation will wait for the unlock.
> 
> Optimize filemap_map_folio_range() with the same method too.
> 
> With this patch, we can get 8% performance gain for lmbench testcase
> 'lat_pagefault -P 1 file' in order0 folio case, the size of file is 512M.
> 
> [1]: https://lore.kernel.org/all/aKcU-fzxeW3xT5Wv@casper.infradead.org/
> 
> Signed-off-by: Jinjiang Tu <tujinjiang@huawei.com>
> ---

Reviewed-by: David Hildenbrand <david@redhat.com>

-- 
Cheers

David / dhildenb



      reply	other threads:[~2025-09-04 18:46 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-04 13:27 Jinjiang Tu
2025-09-04 18:46 ` David Hildenbrand [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=8f56ce48-6743-47f5-88e4-4c65f6865216@redhat.com \
    --to=david@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-mm@kvack.org \
    --cc=tujinjiang@huawei.com \
    --cc=wangkefeng.wang@huawei.com \
    --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