From: Vlastimil Babka <vbabka@suse.cz>
To: Adrian Huang <adrianhuang0701@gmail.com>,
Andrew Morton <akpm@linux-foundation.org>
Cc: David Hildenbrand <david@redhat.com>,
Lorenzo Stoakes <lorenzo.stoakes@oracle.com>,
Liam.Howlett@oracle.com, Mike Rapoport <rppt@kernel.org>,
Suren Baghdasaryan <surenb@google.com>,
Michal Hocko <mhocko@suse.com>,
Feng Tang <feng.79.tang@gmail.com>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org,
Adrian Huang <ahuang12@lenovo.com>
Subject: Re: [PATCH 1/1] mm: Correct misleading comment on mmap_lock field in mm_struct
Date: Tue, 5 Aug 2025 11:20:48 +0200 [thread overview]
Message-ID: <3c6100a1-78a3-4211-a62d-eea07db91b62@suse.cz> (raw)
In-Reply-To: <20250805084726.2054-1-ahuang12@lenovo.com>
On 8/5/25 10:47 AM, Adrian Huang wrote:
> From: Adrian Huang <ahuang12@lenovo.com>
>
> The comment previously described the offset of mmap_lock as 0x120 (hex),
> which is misleading. The correct value is 120 (decimal), and using '0x120'
> could confuse readers trying to understand why the count and owner fields
> reside in separate cachelines.
>
> This change also removes an unnecessary space for improved formatting.
>
> Fixes: 2e3025434a6b ("mm: relocate 'write_protect_seq' in struct mm_struct")
> Signed-off-by: Adrian Huang <ahuang12@lenovo.com>
That seems all true so
Acked-by: Vlastimil Babka <vbabka@suse.cz>
But I wonder why we just hope this remains true "with some kernel
config" and don't employ some explicit alignment to make sure it's true
(except perhaps with some debug options like lockdep bloating the
structures, but we don't care about perfmance in such configs).
> ---
> include/linux/mm_types.h | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h
> index 1ec273b06691..ec90bbf22e2b 100644
> --- a/include/linux/mm_types.h
> +++ b/include/linux/mm_types.h
> @@ -1027,9 +1027,9 @@ struct mm_struct {
> */
> /*
> * With some kernel config, the current mmap_lock's offset
> - * inside 'mm_struct' is at 0x120, which is very optimal, as
> + * inside 'mm_struct' is at 120, which is very optimal, as
> * its two hot fields 'count' and 'owner' sit in 2 different
> - * cachelines, and when mmap_lock is highly contended, both
> + * cachelines, and when mmap_lock is highly contended, both
> * of the 2 fields will be accessed frequently, current layout
> * will help to reduce cache bouncing.
> *
next prev parent reply other threads:[~2025-08-05 9:20 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-05 8:47 Adrian Huang
2025-08-05 9:20 ` Vlastimil Babka [this message]
2025-08-05 9:30 ` Lorenzo Stoakes
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=3c6100a1-78a3-4211-a62d-eea07db91b62@suse.cz \
--to=vbabka@suse.cz \
--cc=Liam.Howlett@oracle.com \
--cc=adrianhuang0701@gmail.com \
--cc=ahuang12@lenovo.com \
--cc=akpm@linux-foundation.org \
--cc=david@redhat.com \
--cc=feng.79.tang@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=lorenzo.stoakes@oracle.com \
--cc=mhocko@suse.com \
--cc=rppt@kernel.org \
--cc=surenb@google.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