From: Vlastimil Babka <vbabka@suse.cz>
To: Suren Baghdasaryan <surenb@google.com>, akpm@linux-foundation.org
Cc: peterz@infradead.org, willy@infradead.org,
liam.howlett@oracle.com, lorenzo.stoakes@oracle.com,
david.laight.linux@gmail.com, mhocko@suse.com,
hannes@cmpxchg.org, mjguzik@gmail.com, oliver.sang@intel.com,
mgorman@techsingularity.net, david@redhat.com, peterx@redhat.com,
oleg@redhat.com, dave@stgolabs.net, paulmck@kernel.org,
brauner@kernel.org, dhowells@redhat.com, hdanton@sina.com,
hughd@google.com, lokeshgidra@google.com, minchan@google.com,
jannh@google.com, shakeel.butt@linux.dev, souravpanda@google.com,
pasha.tatashin@soleen.com, klarasmodin@gmail.com,
richard.weiyang@gmail.com, corbet@lwn.net,
linux-doc@vger.kernel.org, linux-mm@kvack.org,
linux-kernel@vger.kernel.org, kernel-team@android.com
Subject: Re: [PATCH v10 13/18] mm: move lesser used vma_area_struct members into the last cacheline
Date: Fri, 21 Feb 2025 16:20:23 +0100 [thread overview]
Message-ID: <14a04071-4650-4e81-b8b5-ab4dd330fe73@suse.cz> (raw)
In-Reply-To: <20250213224655.1680278-14-surenb@google.com>
On 2/13/25 23:46, Suren Baghdasaryan wrote:
> Move several vma_area_struct members which are rarely or never used
> during page fault handling into the last cacheline to better pack
> vm_area_struct. As a result vm_area_struct will fit into 3 as opposed
> to 4 cachelines. New typical vm_area_struct layout:
>
> struct vm_area_struct {
> union {
> struct {
> long unsigned int vm_start; /* 0 8 */
> long unsigned int vm_end; /* 8 8 */
> }; /* 0 16 */
> freeptr_t vm_freeptr; /* 0 8 */
> }; /* 0 16 */
> struct mm_struct * vm_mm; /* 16 8 */
> pgprot_t vm_page_prot; /* 24 8 */
> union {
> const vm_flags_t vm_flags; /* 32 8 */
> vm_flags_t __vm_flags; /* 32 8 */
> }; /* 32 8 */
> unsigned int vm_lock_seq; /* 40 4 */
>
> /* XXX 4 bytes hole, try to pack */
>
> struct list_head anon_vma_chain; /* 48 16 */
> /* --- cacheline 1 boundary (64 bytes) --- */
> struct anon_vma * anon_vma; /* 64 8 */
> const struct vm_operations_struct * vm_ops; /* 72 8 */
> long unsigned int vm_pgoff; /* 80 8 */
> struct file * vm_file; /* 88 8 */
> void * vm_private_data; /* 96 8 */
> atomic_long_t swap_readahead_info; /* 104 8 */
> struct mempolicy * vm_policy; /* 112 8 */
> struct vma_numab_state * numab_state; /* 120 8 */
> /* --- cacheline 2 boundary (128 bytes) --- */
> refcount_t vm_refcnt (__aligned__(64)); /* 128 4 */
>
> /* XXX 4 bytes hole, try to pack */
>
> struct {
> struct rb_node rb (__aligned__(8)); /* 136 24 */
> long unsigned int rb_subtree_last; /* 160 8 */
> } __attribute__((__aligned__(8))) shared; /* 136 32 */
> struct anon_vma_name * anon_name; /* 168 8 */
> struct vm_userfaultfd_ctx vm_userfaultfd_ctx; /* 176 8 */
>
> /* size: 192, cachelines: 3, members: 18 */
> /* sum members: 176, holes: 2, sum holes: 8 */
> /* padding: 8 */
> /* forced alignments: 2, forced holes: 1, sum forced holes: 4 */
> } __attribute__((__aligned__(64)));
>
> Memory consumption per 1000 VMAs becomes 48 pages:
>
> slabinfo after vm_area_struct changes:
> <name> ... <objsize> <objperslab> <pagesperslab> : ...
> vm_area_struct ... 192 42 2 : ...
>
> Signed-off-by: Suren Baghdasaryan <surenb@google.com>
> Reviewed-by: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
Reviewed-by: Vlastimil Babka <vbabka@suse.cz>
next prev parent reply other threads:[~2025-02-21 15:20 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-13 22:46 [PATCH v10 00/18] reimplement per-vma lock as a refcount Suren Baghdasaryan
2025-02-13 22:46 ` [PATCH v10 01/18] mm: introduce vma_start_read_locked{_nested} helpers Suren Baghdasaryan
2025-02-13 22:46 ` [PATCH v10 02/18] mm: move per-vma lock into vm_area_struct Suren Baghdasaryan
2025-02-13 22:46 ` [PATCH v10 03/18] mm: mark vma as detached until it's added into vma tree Suren Baghdasaryan
2025-02-13 22:46 ` [PATCH v10 04/18] mm: introduce vma_iter_store_attached() to use with attached vmas Suren Baghdasaryan
2025-02-21 11:07 ` Vlastimil Babka
2025-02-21 16:11 ` Liam R. Howlett
2025-02-13 22:46 ` [PATCH v10 05/18] mm: mark vmas detached upon exit Suren Baghdasaryan
2025-02-21 16:14 ` Liam R. Howlett
2025-02-13 22:46 ` [PATCH v10 06/18] types: move struct rcuwait into types.h Suren Baghdasaryan
2025-02-13 22:46 ` [PATCH v10 07/18] mm: allow vma_start_read_locked/vma_start_read_locked_nested to fail Suren Baghdasaryan
2025-02-21 11:27 ` Vlastimil Babka
2025-02-13 22:46 ` [PATCH v10 08/18] mm: move mmap_init_lock() out of the header file Suren Baghdasaryan
2025-02-13 22:46 ` [PATCH v10 09/18] mm: uninline the main body of vma_start_write() Suren Baghdasaryan
2025-02-13 22:46 ` [PATCH v10 10/18] refcount: provide ops for cases when object's memory can be reused Suren Baghdasaryan
2025-02-13 22:46 ` [PATCH v10 11/18] refcount: introduce __refcount_{add|inc}_not_zero_limited_acquire Suren Baghdasaryan
2025-02-13 22:46 ` [PATCH v10 12/18] mm: replace vm_lock and detached flag with a reference count Suren Baghdasaryan
2025-02-20 18:53 ` Heiko Carstens
2025-02-20 19:03 ` Suren Baghdasaryan
2025-02-20 20:05 ` Suren Baghdasaryan
2025-02-21 15:18 ` Vlastimil Babka
2025-02-13 22:46 ` [PATCH v10 13/18] mm: move lesser used vma_area_struct members into the last cacheline Suren Baghdasaryan
2025-02-21 15:20 ` Vlastimil Babka [this message]
2025-02-13 22:46 ` [PATCH v10 14/18] mm/debug: print vm_refcnt state when dumping the vma Suren Baghdasaryan
2025-02-13 22:46 ` [PATCH v10 15/18] mm: remove extra vma_numab_state_init() call Suren Baghdasaryan
2025-02-13 22:46 ` [PATCH v10 16/18] mm: prepare lock_vma_under_rcu() for vma reuse possibility Suren Baghdasaryan
2025-02-13 22:46 ` [PATCH v10 17/18] mm: make vma cache SLAB_TYPESAFE_BY_RCU Suren Baghdasaryan
2025-02-13 22:46 ` [PATCH v10 18/18] docs/mm: document latest changes to vm_lock Suren Baghdasaryan
2025-02-21 15:44 ` Vlastimil Babka
2025-02-14 19:34 ` [PATCH v10 00/18] reimplement per-vma lock as a refcount Shivank Garg
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=14a04071-4650-4e81-b8b5-ab4dd330fe73@suse.cz \
--to=vbabka@suse.cz \
--cc=akpm@linux-foundation.org \
--cc=brauner@kernel.org \
--cc=corbet@lwn.net \
--cc=dave@stgolabs.net \
--cc=david.laight.linux@gmail.com \
--cc=david@redhat.com \
--cc=dhowells@redhat.com \
--cc=hannes@cmpxchg.org \
--cc=hdanton@sina.com \
--cc=hughd@google.com \
--cc=jannh@google.com \
--cc=kernel-team@android.com \
--cc=klarasmodin@gmail.com \
--cc=liam.howlett@oracle.com \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=lokeshgidra@google.com \
--cc=lorenzo.stoakes@oracle.com \
--cc=mgorman@techsingularity.net \
--cc=mhocko@suse.com \
--cc=minchan@google.com \
--cc=mjguzik@gmail.com \
--cc=oleg@redhat.com \
--cc=oliver.sang@intel.com \
--cc=pasha.tatashin@soleen.com \
--cc=paulmck@kernel.org \
--cc=peterx@redhat.com \
--cc=peterz@infradead.org \
--cc=richard.weiyang@gmail.com \
--cc=shakeel.butt@linux.dev \
--cc=souravpanda@google.com \
--cc=surenb@google.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