From: Yin Fengwei <fengwei.yin@intel.com>
To: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>,
kernel test robot <oliver.sang@intel.com>
Cc: <oe-lkp@lists.linux.dev>, <lkp@intel.com>,
<linux-kernel@vger.kernel.org>,
Andrew Morton <akpm@linux-foundation.org>,
kernel test robot <yujie.liu@intel.com>,
Aaron Lu <aaron.lu@intel.com>, John Hubbard <jhubbard@nvidia.com>,
Peter Zijlstra <peterz@infradead.org>,
Olivier Dion <odion@efficios.com>,
Feng Tang <feng.tang@intel.com>, Jason Gunthorpe <jgg@nvidia.com>,
Peter Xu <peterx@redhat.com>, <ying.huang@intel.com>
Subject: Re: [linus:master] [mm] c1753fd02a: stress-ng.madvise.ops_per_sec -6.5% regression
Date: Tue, 5 Sep 2023 13:41:36 +0800 [thread overview]
Message-ID: <8351fcd6-d4a2-9656-eae8-96e92e3e5257@intel.com> (raw)
In-Reply-To: <c5983185-5bdc-b703-1600-6e44c49d6442@efficios.com>
On 9/4/23 18:04, Mathieu Desnoyers wrote:
> On 9/4/23 01:32, Yin Fengwei wrote:
>>
>>
>> On 7/19/23 14:34, kernel test robot wrote:
>>>
>>> hi, Mathieu Desnoyers,
>>>
>>> we noticed that this commit addressed issue:
>>> "[linus:master] [sched] af7f588d8f: will-it-scale.per_thread_ops -13.9% regression"
>>> we reported before on:
>>> https://lore.kernel.org/oe-lkp/202305151017.27581d75-yujie.liu@intel.com/
>>>
>>> we really saw a will-it-scale.per_thread_ops 92.2% improvement by this commit
>>> (details are as below).
>>> however, we also noticed a stress-ng regression.
>>>
>>> below detail report FYI.
>>>
>>>
>>> Hello,
>>>
>>> kernel test robot noticed a -6.5% regression of stress-ng.madvise.ops_per_sec on:
>>>
>>>
>>> commit: c1753fd02a0058ea43cbb31ab26d25be2f6cfe08 ("mm: move mm_count into its own cache line")
>>> https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git master
>> I noticed that the struct mm_struct has following layout change after this patch.
>> Without the patch:
>> spinlock_t page_table_lock; /* 124 4 */
>> /* --- cacheline 2 boundary (128 bytes) --- */
>> struct rw_semaphore mmap_lock; /* 128 40 */ ----> in one cache line
>> struct list_head mmlist; /* 168 16 */
>> int mm_lock_seq; /* 184 4 */
>>
>> With the patch:
>> spinlock_t page_table_lock; /* 180 4 */
>> struct rw_semaphore mmap_lock; /* 184 40 */ ----> cross to two cache lines
>> /* --- cacheline 3 boundary (192 bytes) was 32 bytes ago --- */
>> struct list_head mmlist; /* 224 16 */
>
> If your intent is just to make sure that mmap_lock is entirely contained
> within a cache line by forcing it to begin on a cache line boundary, you
> can do:
>
> struct mm_struct {
> [...]
> struct rw_semaphore mmap_lock ____cacheline_aligned_in_smp;
> struct list_head mmlist;
> [...]
> };
>
> The code above keeps mmlist on the same cache line as mmap_lock if
> there happens to be enough room in the cache line after mmap_lock.
>
> Otherwise, if your intent is to also eliminate false sharing by making
> sure that mmap_lock sits alone in its cache line, you can do the following:
>
> struct mm_struct {
> [...]
> struct {
> struct rw_semaphore mmap_lock;
> } ____cacheline_aligned_in_smp;
> struct list_head mmlist;
> [...]
> };
>
> The code above keeps mmlist in a separate cache line from mmap_lock;
>
> Depending on the usage, one or the other may be better. Comparative
> benchmarks of both approaches would help choosing the best way forward
> here.
Tested the will_it_scale.mmap1 on Intel Ice Lake 48C/96T + 192G ram. And
confirmed that my patch bring around 12% regression. Which confirmed the
information in
commit 2e3025434a6b ("mm: relocate 'write_protect_seq' in struct mm_struct")
Putting state and owner of rwsem to different cache line can benefit the
will_it_scale.mmap1.
So we may just keep the mm_struct as it now.
Regards
Yin, Fengwei
>
> Thanks,
>
> Mathieu
>
prev parent reply other threads:[~2023-09-05 16:03 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-19 6:34 [linus:master] [mm] c1753fd02a: stress-ng.madvise.ops_per_sec -6.5% regression kernel test robot
2023-09-04 5:32 ` Yin Fengwei
2023-09-04 10:04 ` Mathieu Desnoyers
2023-09-05 2:56 ` Yin Fengwei
2023-09-05 5:41 ` Yin Fengwei [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=8351fcd6-d4a2-9656-eae8-96e92e3e5257@intel.com \
--to=fengwei.yin@intel.com \
--cc=aaron.lu@intel.com \
--cc=akpm@linux-foundation.org \
--cc=feng.tang@intel.com \
--cc=jgg@nvidia.com \
--cc=jhubbard@nvidia.com \
--cc=linux-kernel@vger.kernel.org \
--cc=lkp@intel.com \
--cc=mathieu.desnoyers@efficios.com \
--cc=odion@efficios.com \
--cc=oe-lkp@lists.linux.dev \
--cc=oliver.sang@intel.com \
--cc=peterx@redhat.com \
--cc=peterz@infradead.org \
--cc=ying.huang@intel.com \
--cc=yujie.liu@intel.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