From: Yibin Liu <liuyibin@hygon.cn>
To: Lorenzo Stoakes <ljs@kernel.org>
Cc: "linux-mm@kvack.org" <linux-mm@kvack.org>,
"akpm@linux-foundation.org" <akpm@linux-foundation.org>,
"Liam.Howlett@oracle.com" <Liam.Howlett@oracle.com>,
"viro@zeniv.linux.org.uk" <viro@zeniv.linux.org.uk>,
"brauner@kernel.org" <brauner@kernel.org>,
"mjguzik@gmail.com" <mjguzik@gmail.com>,
Jianyong Wu <wujianyong@hygon.cn>, Huangsj <huangsj@hygon.cn>,
Yuan Zhong <zhongyuan@hygon.cn>, "jack@suse.cz" <jack@suse.cz>,
"jlayton@kernel.org" <jlayton@kernel.org>,
"chuck.lever@oracle.com" <chuck.lever@oracle.com>,
"alex.aring@gmail.com" <alex.aring@gmail.com>,
"vbabka@kernel.org" <vbabka@kernel.org>,
"jannh@google.com" <jannh@google.com>,
"pfalcato@suse.de" <pfalcato@suse.de>,
"linux-fsdevel@vger.kernel.org" <linux-fsdevel@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: 答复: 答复: [PATCH] mm: Add RWH_RMAP_EXCLUDE flag to exclude files from rmap sharing
Date: Fri, 24 Apr 2026 01:08:35 +0000 [thread overview]
Message-ID: <a96c20b74b874248bc0cdc2b926a43fe@hygon.cn> (raw)
In-Reply-To: <aejzSsiXZBK1emv7@lucifer>
> On Wed, Apr 22, 2026 at 12:51:06PM +0000, Yibin Liu wrote:
> > First of all, I am truly sorry for not using RFC.
> > Secondly, I omitted many maintainers because I wanted to “not disturb too
> many people”,
> > and I apologize deeply for that. I will fully follow these two rules from now on.
> >
> > As for this patch, indeed, as Matthew said, the truncate part is not feasible.
> > My original intention was to apply this to frequently used library files like libc
> and ld.
> > Contention on the i_mmap_rwsem lock (which eventually turns into osq_lock)
> caused by
> > these two files alone reaches up to 70% in the “256-core execl” case, as
> observed from
> > flame graphs. Besides, no one performs truncate operations on libc and ld
> anyway.
>
> Interesting, would be good to see these? And more details on the scenario?
>
> What workloads are contending that exactly?
>
It is good to see.
On an Intel Emerald Rapids server (112 cores), run the execl benchmark from
UnixBench with the command: ./Run -c 220 execl
Then perf top shows:
91.53% [kernel] [k] osq_lock
0.50% [kernel] [k] rwsem_spin_on_owner
0.45% perf [.] queue_event
0.42% [kernel] [k] vma_interval_tree_insert
0.36% [kernel] [k] next_uptodate_folio
0.25% [kernel] [k] __zap_vma_range
All the osq_lock overhead here comes from rwsem_optimistic_spin, and
rwsem_optimistic_spin has many call sources.
The breakdown is roughly as follows:
6.13% _dl_main-->mprotect-->...-->__split_vma-->vma_prepare-->down_write(&mapping->i_mmap_rwsem)
6.15% bprm_execve-->...-->exit_mmap-->...-->unlink_file_vma_batch_process-->down_write(&mapping->i_mmap_rwsem)
24.71% vma_link_file-->...-->down_write(&mapping->i_mmap_rwsem)
24.82% mmap_region-->...-->free_pgtalbes-->unlink_file_vma_batch_process-->down_write(&mapping->i_mmap_rwsem)
18.5% mmap_region-->...-->__split_vma->vma_preapre-->down_write(&mapping->i_mmap_rwsem)
12.44% _dl_map_project-->mprotect-->...-->__split_vma-->vma_prepare-->down_write(&mapping->i_mmap_rwsem)
And AMD Zen5(9755) performs pretty much the same way (tested with ./Run -c 250 execl).
> >
> > So I wanted to try skipping rmap for them. Since they are small, even if they
> cannot
> > be reclaimed or migrated, I assumed it would not cause much trouble. Of
> course,
> > this idea was totally wrong, and I will definitely mark such insane proposals
> with RFC in the future.
> >
> > These ideas are inspired by Mateusz’s work and thoughts
> >
> (https://lore.kernel.org/linux-mm/CAGudoHEfiOPJ2VGEV3fDT9cDsuoHB-wk8jg-k
> -EK6JhWgiHkWw@mail.gmail.com/),
> > so I specifically CC’d him to seek more opinions and insights.
>
> I think the best thing in general going forwards is to bring up this issues in
> advance, we're more than happy to look into things and very interested in issues
> with lock contention, latency, etc.
>
> And that way you can discuss ideas you might have to tackle up front and we can
> give you early feedback, which should save time all round and help get us to a
> good solution :)
>
> Just send with a [DISCUSSION] preface and cc- people you feel are relevant (use
> MAINTAINERS to figure out e.g. maintainers of relevant things, like rmap,
> mmap,
> etc.)
>
> >
> > Lastly, I sincerely apologize for the trouble I have caused the community.
> > I will strictly follow community conventions when sending patches in the
> future.
>
> It's no problem, better to be direct about this - it's more useful to discuss
> rather than to jump to a solution without community involvement, which might
> not
> work out/conflict with other stuff etc.
>
> Thanks, Lorenzo
Thanks for the kind advice.
I will start a discussion first with a [DISCUSSION] tag and involve relevant
maintainers for similar ideas in the future.
Thanks, Yibin
next prev parent reply other threads:[~2026-04-24 1:08 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20260421020932.3212532-1-liuyibin@hygon.cn>
[not found] ` <aeikm2e5Gh5reJ30@lucifer>
2026-04-22 12:51 ` 答复: [PATCH] mm: Add RWH_RMAP_EXCLUDE flag to exclude files from rmap sharing Yibin Liu
2026-04-22 16:16 ` Lorenzo Stoakes
2026-04-24 1:08 ` Yibin Liu [this message]
2026-04-24 3:20 ` 答复: " Matthew Wilcox
2026-04-24 6:20 ` Mateusz Guzik
2026-04-24 6:54 ` Mateusz Guzik
[not found] ` <CAGudoHHki3gv-HXXMALePDoC+tmao4oWcYgCo9kXNDkEhW4E4g@mail.gmail.com>
2026-04-22 13:03 ` Yibin Liu
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=a96c20b74b874248bc0cdc2b926a43fe@hygon.cn \
--to=liuyibin@hygon.cn \
--cc=Liam.Howlett@oracle.com \
--cc=akpm@linux-foundation.org \
--cc=alex.aring@gmail.com \
--cc=brauner@kernel.org \
--cc=chuck.lever@oracle.com \
--cc=huangsj@hygon.cn \
--cc=jack@suse.cz \
--cc=jannh@google.com \
--cc=jlayton@kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=ljs@kernel.org \
--cc=mjguzik@gmail.com \
--cc=pfalcato@suse.de \
--cc=vbabka@kernel.org \
--cc=viro@zeniv.linux.org.uk \
--cc=wujianyong@hygon.cn \
--cc=zhongyuan@hygon.cn \
/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