* [PATCH v2 1/1] mm: Correct misleading comment on mmap_lock field in mm_struct
@ 2025-08-06 14:59 Adrian Huang (Lenovo)
2025-08-06 19:07 ` Lorenzo Stoakes
0 siblings, 1 reply; 3+ messages in thread
From: Adrian Huang (Lenovo) @ 2025-08-06 14:59 UTC (permalink / raw)
To: Andrew Morton
Cc: David Hildenbrand, Lorenzo Stoakes, Liam.Howlett, Vlastimil Babka,
Mike Rapoport, Suren Baghdasaryan, Michal Hocko, Feng Tang,
ahuang12, linux-mm, linux-kernel, Adrian Huang
The comment previously described the offset of mmap_lock as 0x120 (hex),
which is misleading. The correct offset is 56 bytes (decimal) from the
last cache line boundary. 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.
Signed-off-by: Adrian Huang (Lenovo) <adrianhuang0701@gmail.com>
---
Changes in v2: Per Lorenzo's suggestion, use "56 bytes" instead of 120.
include/linux/mm_types.h | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h
index 1ec273b06691..c9c3d0307f8c 100644
--- a/include/linux/mm_types.h
+++ b/include/linux/mm_types.h
@@ -1026,10 +1026,10 @@ struct mm_struct {
* counters
*/
/*
- * With some kernel config, the current mmap_lock's offset
- * inside 'mm_struct' is at 0x120, which is very optimal, as
+ * Typically the current mmap_lock's offset is 56 bytes from
+ * the last cacheline boundary, 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.
*
--
2.34.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v2 1/1] mm: Correct misleading comment on mmap_lock field in mm_struct
2025-08-06 14:59 [PATCH v2 1/1] mm: Correct misleading comment on mmap_lock field in mm_struct Adrian Huang (Lenovo)
@ 2025-08-06 19:07 ` Lorenzo Stoakes
2025-08-06 20:06 ` David Hildenbrand
0 siblings, 1 reply; 3+ messages in thread
From: Lorenzo Stoakes @ 2025-08-06 19:07 UTC (permalink / raw)
To: Adrian Huang (Lenovo)
Cc: Andrew Morton, David Hildenbrand, Liam.Howlett, Vlastimil Babka,
Mike Rapoport, Suren Baghdasaryan, Michal Hocko, Feng Tang,
ahuang12, linux-mm, linux-kernel
On Wed, Aug 06, 2025 at 10:59:06PM +0800, Adrian Huang (Lenovo) wrote:
> The comment previously described the offset of mmap_lock as 0x120 (hex),
> which is misleading. The correct offset is 56 bytes (decimal) from the
> last cache line boundary. 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.
>
> Signed-off-by: Adrian Huang (Lenovo) <adrianhuang0701@gmail.com>
LGTM, so:
Reviewed-by: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
> ---
> Changes in v2: Per Lorenzo's suggestion, use "56 bytes" instead of 120.
>
> include/linux/mm_types.h | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h
> index 1ec273b06691..c9c3d0307f8c 100644
> --- a/include/linux/mm_types.h
> +++ b/include/linux/mm_types.h
> @@ -1026,10 +1026,10 @@ struct mm_struct {
> * counters
> */
> /*
> - * With some kernel config, the current mmap_lock's offset
> - * inside 'mm_struct' is at 0x120, which is very optimal, as
> + * Typically the current mmap_lock's offset is 56 bytes from
> + * the last cacheline boundary, 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.
> *
> --
> 2.34.1
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v2 1/1] mm: Correct misleading comment on mmap_lock field in mm_struct
2025-08-06 19:07 ` Lorenzo Stoakes
@ 2025-08-06 20:06 ` David Hildenbrand
0 siblings, 0 replies; 3+ messages in thread
From: David Hildenbrand @ 2025-08-06 20:06 UTC (permalink / raw)
To: Lorenzo Stoakes, Adrian Huang (Lenovo)
Cc: Andrew Morton, Liam.Howlett, Vlastimil Babka, Mike Rapoport,
Suren Baghdasaryan, Michal Hocko, Feng Tang, ahuang12, linux-mm,
linux-kernel
On 06.08.25 21:07, Lorenzo Stoakes wrote:
> On Wed, Aug 06, 2025 at 10:59:06PM +0800, Adrian Huang (Lenovo) wrote:
>> The comment previously described the offset of mmap_lock as 0x120 (hex),
>> which is misleading. The correct offset is 56 bytes (decimal) from the
>> last cache line boundary. 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.
>>
>> Signed-off-by: Adrian Huang (Lenovo) <adrianhuang0701@gmail.com>
>
> LGTM, so:
>
> Reviewed-by: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
Acked-by: David Hildenbrand <david@redhat.com>
--
Cheers,
David / dhildenb
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-08-06 20:06 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-06 14:59 [PATCH v2 1/1] mm: Correct misleading comment on mmap_lock field in mm_struct Adrian Huang (Lenovo)
2025-08-06 19:07 ` Lorenzo Stoakes
2025-08-06 20:06 ` David Hildenbrand
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).