From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3BF8DD462C4 for ; Wed, 13 Nov 2024 15:43:05 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B2AB66B00A9; Wed, 13 Nov 2024 10:43:04 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id AB1F46B00B2; Wed, 13 Nov 2024 10:43:04 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 92B7D6B00D1; Wed, 13 Nov 2024 10:43:04 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 6ADE96B00A9 for ; Wed, 13 Nov 2024 10:43:04 -0500 (EST) Received: from smtpin21.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 116F0120BCA for ; Wed, 13 Nov 2024 15:43:04 +0000 (UTC) X-FDA: 82781488902.21.0C8069A Received: from mail-qt1-f175.google.com (mail-qt1-f175.google.com [209.85.160.175]) by imf07.hostedemail.com (Postfix) with ESMTP id 81EDF40007 for ; Wed, 13 Nov 2024 15:42:01 +0000 (UTC) Authentication-Results: imf07.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=DMcwlsAA; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf07.hostedemail.com: domain of surenb@google.com designates 209.85.160.175 as permitted sender) smtp.mailfrom=surenb@google.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1731512519; a=rsa-sha256; cv=none; b=Obt4ahEG5rCipXSl0QtCv2d9hb37HOxiNWwCPjJ6IoKz6mJZ4/AA4+Xvs/L5UCYU0OiO8H aCj+LtuQh1SW78eGJQY/zFGKMJOoGD733MT9GtjXfvflk+KmiGMdfj1nxkGRlyrgWBggAC rYp4UEycfv87/OhFHDYGz6UNhMyGWG8= ARC-Authentication-Results: i=1; imf07.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=DMcwlsAA; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf07.hostedemail.com: domain of surenb@google.com designates 209.85.160.175 as permitted sender) smtp.mailfrom=surenb@google.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1731512519; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=gvam9WV1Qmn4wOJy3DU8hiIppiH9WSEamCw5jH8Jzro=; b=FUy1u2qEt8kQLWI5kfdWbqmNPuyrC+0ppEn8AeA01pmAzVbsoaK++Yhn0U3YjoFUnMhhFP wtVkifC5Jfaoq/SSUGCGUA0cT3k/pA5Fnm0yW8YuGiHdiA3qWxCYaXyKsLAkmcBBLsD7Cz WT9kr2WgtCc688sWQoXEAL3e7kItsvo= Received: by mail-qt1-f175.google.com with SMTP id d75a77b69052e-460a8d1a9b7so258421cf.1 for ; Wed, 13 Nov 2024 07:43:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1731512581; x=1732117381; darn=kvack.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=gvam9WV1Qmn4wOJy3DU8hiIppiH9WSEamCw5jH8Jzro=; b=DMcwlsAA12qUu66mh43ENWdgSGFqdyZmjcfeNoD6IivuVr84qoigwbxQlK74glumqw lyC6Znj11qkR39Ews9Eav8d7Zd33Z8hjqhWzAesNqePgAv/VPpL50HRzskp2+kNkY0bP CRkcO/ieBJiOHBOwNUr+aaV16jewO9LUzVlG0OXEwaK1h//Ov95XdSsehKdnRr4/0dJt t01RFm1ey1Ig5YQabESzsU++8yy4DAH10QdmGw/nE0TBEwItYwuBy08KHwNMrfWm/hcX 3Hej+zcDsBE9zKn6zupj4YnyffKkVkPVWqYvQnAsxsjiR272m4Kw8q6wIcgBylxOB+JE +YiQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731512581; x=1732117381; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=gvam9WV1Qmn4wOJy3DU8hiIppiH9WSEamCw5jH8Jzro=; b=W6sLo8VD2Z8EmWigI85VtjDsIUZknMq3y5GteIVAGvgRnKGdUGSuoeRSiaNwHpuS9w AvId2UBjSSmNX2zQ/QOcYbnvuBxmhq5Ze3zTsx/lTY82Rr8M9oW/6J8TYVYgXIY1dNfj JA0PJPTA9TEKFBz4bV1iPfsqZsFEuBb58i5TILfN90lEb0+WcIIH/KxBBX7Rf5VmcV5Z zpmFrznrfhRTIwQjwyHnCO647wXsj+08QygqKYE3IpeFU4ys05A4D+8BR19e9x0bZwhV VKX+qTlmB1HYPGpfGvwOn8JBlF3syAYWATehbzq+fo9lSvEmsdfMWC1ZZ+k7NAP/KpWw cRvg== X-Forwarded-Encrypted: i=1; AJvYcCWWdQX+HGFxtJVMOT6YYzcIXwVMaN2rw3SRaxqaUF+BBI+wHkzm/oYOXs7wPVcDhtzSK5/kWCaXOA==@kvack.org X-Gm-Message-State: AOJu0Yw21fUyTIZxVOa/GMJnZa9SZfT4dD7g0V79c7Fv8uMxK4PwGnNq gO7kjTrmGOmiAWVqGYl2ZIG1P8nkeYDjYEaS2lvVhLyn4dpF6rmeX9C7mBXVsyW7+Ct+HQsUpth ajDQupvTzZmuM+xb/tcHFOLSjIxFZ97OcGqur X-Gm-Gg: ASbGncvPLe1hH+jYCKAkjT2r83Mw/86R3R5suUGUGX4+YU5R59aQBK1nUQIzndKUSZf eJ6MwEU3nuVahOQZ+6mhB9gW57KDOdGs= X-Google-Smtp-Source: AGHT+IGoSJC7NEVZDp5NW6fuqArmuQfmnz8hDVQ+6Ciw+IGZ+zOWqIauKKI4LWWqo2ZgFZSMtZZdIqMYrtQukXe69Zs= X-Received: by 2002:a05:622a:13cc:b0:462:c158:9f5b with SMTP id d75a77b69052e-4634cad5b89mr3497791cf.19.1731512580871; Wed, 13 Nov 2024 07:43:00 -0800 (PST) MIME-Version: 1.0 References: <20241112194635.444146-1-surenb@google.com> <20241112194635.444146-3-surenb@google.com> <637370b8-3e3e-4457-81d6-5913a3ff1d4e@lucifer.local> In-Reply-To: <637370b8-3e3e-4457-81d6-5913a3ff1d4e@lucifer.local> From: Suren Baghdasaryan Date: Wed, 13 Nov 2024 07:42:49 -0800 Message-ID: Subject: Re: [PATCH v2 2/5] mm: move per-vma lock into vm_area_struct To: Lorenzo Stoakes Cc: akpm@linux-foundation.org, willy@infradead.org, liam.howlett@oracle.com, mhocko@suse.com, vbabka@suse.cz, 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, minchan@google.com, jannh@google.com, shakeel.butt@linux.dev, souravpanda@google.com, pasha.tatashin@soleen.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org, kernel-team@android.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Rspam-User: X-Rspamd-Queue-Id: 81EDF40007 X-Rspamd-Server: rspam11 X-Stat-Signature: modrxsambfonnry6bk1ypq6r4g7s9ye4 X-HE-Tag: 1731512521-845434 X-HE-Meta: U2FsdGVkX1+Oxz07drFextyjJtBh0S6cZ/eGYF59vY9N63hSPkeTKm7X/qNXPtxmIhOsAFOHNEYssLVbCPW4CAJRg8XNhaeGiU3HlqYFc3QhPsZkfQ/inl1N9n5lRuYovoqJGXhdqM7blDk+XzwQlOXZhGzV/yUQWURR+UZdmRHqCmvHGb80uRQSRY7r6wTyPj2wEvFHq/yQ1WN6BEtMK5X/ISz68sYh3ZXZNxtI9wZAVabooQj9uu2TFsstDqjHRqix+7e5zRmD+XoxycOMiod+j9gC68+mc6AZbyT/d8qInUlX9fd4/tn+06BX8HfWaA6rEF8BpipVWVN2WB1T1iplldnaYZBtwrd6GRWqU1j+nGDMyYT0Od5erGP36ITpY5JqhXghgQ0PWa9TmMWtKHoJnKcx3O0n0ihGjSHnq30nxjT4eNaYqWQ/KfIwHOWLxlhX18tnbalWSMZwF+oWbWeqU8HGpVAMy4hnAcMGq7paQ09Vki6WYHWuQzkmwIwL6oVRsBKntoS+XKM00FVADVdsH1a0uV2D/tUXIdyNqXKCQ2vlwhxgY8I/qSdg7LTwKE9LEgNuZ/aUFjceMwK/6SuwAQLFhu1aU6jAYRj1Ol4sdWP3HfFK1rZfxfOAhf/D2rjs1jIQX9zvDL3753K0TCrKUw7sujbI3i0fRjWpKUTf+ObtxzjYgH+hl7xseTkPlRXxto+rYJe9jqwtw9Zx35M10t/PZ5gQBgrAnD8tmtYEGwBpuYv5PJc9zL2ypDZf8xsjocf4VygMTKZD1uqJEXMRJ/+GG+5qhHB1Lp/7/jGdRvfGREf/7dTVOK98WoJEKMWj2AA9pG+x/wKwKYu8vyC5R6w0VFy4JHa6PQB5dd/2ShdvUoDL3KLS9CQnDz3/NwK8J3u6RP8XXXRVJ7trOGx627vgSnk329s2p718wsJ4oxG5kcvolmEEy7E79eQ36I+XRoSx4a3DYXRQ4P2 eP0stjxv 2Rled6vo6dEHQEYLS2q0TW3l9chzGfqW0tIu2G0/Ua5PTFu16++oXVyqouUsTrNKY0yxcS9x1ia/7Ao9kmzSesaQvPk8X7kb9lGU6P3JpgO+dZp7ZH+6TJGT7N4QMVCGnwFH785FW3dNjxZV4H8GtFAbs4TfA4GODdsrCIrF8/kPKl1k5hHLl1KAOoAWSP4dCoeboydh5tdRsu3+uueFCFoOUQjyhDLgvTmnCgdm1P1QNgCWNRcFeepR+Eh5Bl6ZaQ4IbBhSg4j7xtW2G/UKsldQj5Zs6LyuBndgzn6F/mIv2QjOnxei+wQknaM/ijZ7g+nTbhQJ0O9mNvScnHZJrYsge0Q== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: On Wed, Nov 13, 2024 at 6:28=E2=80=AFAM Lorenzo Stoakes wrote: > > On Tue, Nov 12, 2024 at 11:46:32AM -0800, Suren Baghdasaryan wrote: > > Back when per-vma locks were introduces, vm_lock was moved out of > > vm_area_struct in [1] because of the performance regression caused by > > false cacheline sharing. Recent investigation [2] revealed that the > > regressions is limited to a rather old Broadwell microarchitecture and > > even there it can be mitigated by disabling adjacent cacheline > > prefetching, see [3]. > > I don't see a motivating reason as to why we want to do this? We increase > memory usage here which is not good, but later lock optimisation mitigate= s > it, but why wouldn't we just do the lock optimisations and use less memor= y > overall? > > > This patchset moves vm_lock back into vm_area_struct, aligning it at th= e > > cacheline boundary and changing the cache to be cache-aligned as well. > > This causes VMA memory consumption to grow from 160 (vm_area_struct) + = 40 > > (vm_lock) bytes to 256 bytes: > > > > slabinfo before: > > ... : ... > > vma_lock ... 40 102 1 : ... > > vm_area_struct ... 160 51 2 : ... > > Pedantry, but it might be worth mentioning how much this can vary by conf= ig. > > For instance, on my machine: > > vm_area_struct 125238 138820 184 44 Ack. > > > > > slabinfo after moving vm_lock: > > ... : ... > > vm_area_struct ... 256 32 2 : ... > > > > Aggregate VMA memory consumption per 1000 VMAs grows from 50 to 64 page= s, > > which is 5.5MB per 100000 VMAs. This memory consumption growth can be > > addressed later by optimizing the vm_lock. > > Yes grabbing this back is of critical importance I'd say! :) > > Functionally it looks ok to me but would like to see a stronger > justification in the commit msg! :) > > > > > [1] https://lore.kernel.org/all/20230227173632.3292573-34-surenb@google= .com/ > > [2] https://lore.kernel.org/all/ZsQyI%2F087V34JoIt@xsang-OptiPlex-9020/ > > [3] https://lore.kernel.org/all/CAJuCfpEisU8Lfe96AYJDZ+OM4NoPmnw9bP53cT= _kbfP_pR+-2g@mail.gmail.com/ > > > > Signed-off-by: Suren Baghdasaryan > > --- > > include/linux/mm.h | 28 +++++++++++++---------- > > include/linux/mm_types.h | 6 +++-- > > kernel/fork.c | 49 ++++------------------------------------ > > 3 files changed, 25 insertions(+), 58 deletions(-) > > > > diff --git a/include/linux/mm.h b/include/linux/mm.h > > index 01ce619f3d17..a5eb0be3e351 100644 > > --- a/include/linux/mm.h > > +++ b/include/linux/mm.h > > @@ -684,6 +684,12 @@ static inline void vma_numab_state_free(struct vm_= area_struct *vma) {} > > #endif /* CONFIG_NUMA_BALANCING */ > > > > #ifdef CONFIG_PER_VMA_LOCK > > +static inline void vma_lock_init(struct vm_area_struct *vma) > > +{ > > + init_rwsem(&vma->vm_lock.lock); > > + vma->vm_lock_seq =3D UINT_MAX; > > +} > > + > > /* > > * Try to read-lock a vma. The function is allowed to occasionally yie= ld false > > * locked result to avoid performance overhead, in which case we fall = back to > > @@ -701,7 +707,7 @@ static inline bool vma_start_read(struct vm_area_st= ruct *vma) > > if (READ_ONCE(vma->vm_lock_seq) =3D=3D READ_ONCE(vma->vm_mm->mm_l= ock_seq.sequence)) > > return false; > > > > - if (unlikely(down_read_trylock(&vma->vm_lock->lock) =3D=3D 0)) > > + if (unlikely(down_read_trylock(&vma->vm_lock.lock) =3D=3D 0)) > > return false; > > > > /* > > @@ -716,7 +722,7 @@ static inline bool vma_start_read(struct vm_area_st= ruct *vma) > > * This pairs with RELEASE semantics in vma_end_write_all(). > > */ > > if (unlikely(vma->vm_lock_seq =3D=3D raw_read_seqcount(&vma->vm_m= m->mm_lock_seq))) { > > - up_read(&vma->vm_lock->lock); > > + up_read(&vma->vm_lock.lock); > > return false; > > } > > return true; > > @@ -729,7 +735,7 @@ static inline bool vma_start_read(struct vm_area_st= ruct *vma) > > static inline void vma_start_read_locked_nested(struct vm_area_struct = *vma, int subclass) > > { > > mmap_assert_locked(vma->vm_mm); > > - down_read_nested(&vma->vm_lock->lock, subclass); > > + down_read_nested(&vma->vm_lock.lock, subclass); > > } > > > > /* > > @@ -739,13 +745,13 @@ static inline void vma_start_read_locked_nested(s= truct vm_area_struct *vma, int > > static inline void vma_start_read_locked(struct vm_area_struct *vma) > > { > > mmap_assert_locked(vma->vm_mm); > > - down_read(&vma->vm_lock->lock); > > + down_read(&vma->vm_lock.lock); > > } > > > > static inline void vma_end_read(struct vm_area_struct *vma) > > { > > rcu_read_lock(); /* keeps vma alive till the end of up_read */ > > - up_read(&vma->vm_lock->lock); > > + up_read(&vma->vm_lock.lock); > > rcu_read_unlock(); > > } > > > > @@ -774,7 +780,7 @@ static inline void vma_start_write(struct vm_area_s= truct *vma) > > if (__is_vma_write_locked(vma, &mm_lock_seq)) > > return; > > > > - down_write(&vma->vm_lock->lock); > > + down_write(&vma->vm_lock.lock); > > /* > > * We should use WRITE_ONCE() here because we can have concurrent= reads > > * from the early lockless pessimistic check in vma_start_read(). > > @@ -782,7 +788,7 @@ static inline void vma_start_write(struct vm_area_s= truct *vma) > > * we should use WRITE_ONCE() for cleanliness and to keep KCSAN h= appy. > > */ > > WRITE_ONCE(vma->vm_lock_seq, mm_lock_seq); > > - up_write(&vma->vm_lock->lock); > > + up_write(&vma->vm_lock.lock); > > } > > > > static inline void vma_assert_write_locked(struct vm_area_struct *vma) > > @@ -794,7 +800,7 @@ static inline void vma_assert_write_locked(struct v= m_area_struct *vma) > > > > static inline void vma_assert_locked(struct vm_area_struct *vma) > > { > > - if (!rwsem_is_locked(&vma->vm_lock->lock)) > > + if (!rwsem_is_locked(&vma->vm_lock.lock)) > > vma_assert_write_locked(vma); > > } > > > > @@ -827,6 +833,7 @@ struct vm_area_struct *lock_vma_under_rcu(struct mm= _struct *mm, > > > > #else /* CONFIG_PER_VMA_LOCK */ > > > > +static inline void vma_lock_init(struct vm_area_struct *vma) {} > > static inline bool vma_start_read(struct vm_area_struct *vma) > > { return false; } > > static inline void vma_end_read(struct vm_area_struct *vma) {} > > @@ -861,10 +868,6 @@ static inline void assert_fault_locked(struct vm_f= ault *vmf) > > > > extern const struct vm_operations_struct vma_dummy_vm_ops; > > > > -/* > > - * WARNING: vma_init does not initialize vma->vm_lock. > > - * Use vm_area_alloc()/vm_area_free() if vma needs locking. > > - */ > > static inline void vma_init(struct vm_area_struct *vma, struct mm_stru= ct *mm) > > { > > memset(vma, 0, sizeof(*vma)); > > @@ -873,6 +876,7 @@ static inline void vma_init(struct vm_area_struct *= vma, struct mm_struct *mm) > > INIT_LIST_HEAD(&vma->anon_vma_chain); > > vma_mark_detached(vma, false); > > vma_numab_state_init(vma); > > + vma_lock_init(vma); > > } > > > > /* Use when VMA is not part of the VMA tree and needs no locking */ > > diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h > > index 80fef38d9d64..5c4bfdcfac72 100644 > > --- a/include/linux/mm_types.h > > +++ b/include/linux/mm_types.h > > @@ -716,8 +716,6 @@ struct vm_area_struct { > > * slowpath. > > */ > > unsigned int vm_lock_seq; > > - /* Unstable RCU readers are allowed to read this. */ > > - struct vma_lock *vm_lock; > > #endif > > > > /* > > @@ -770,6 +768,10 @@ struct vm_area_struct { > > struct vma_numab_state *numab_state; /* NUMA Balancing state *= / > > #endif > > struct vm_userfaultfd_ctx vm_userfaultfd_ctx; > > +#ifdef CONFIG_PER_VMA_LOCK > > + /* Unstable RCU readers are allowed to read this. */ > > + struct vma_lock vm_lock ____cacheline_aligned_in_smp; > > +#endif > > } __randomize_layout; > > > > #ifdef CONFIG_NUMA > > diff --git a/kernel/fork.c b/kernel/fork.c > > index 0061cf2450ef..7823797e31d2 100644 > > --- a/kernel/fork.c > > +++ b/kernel/fork.c > > @@ -436,35 +436,6 @@ static struct kmem_cache *vm_area_cachep; > > /* SLAB cache for mm_struct structures (tsk->mm) */ > > static struct kmem_cache *mm_cachep; > > > > -#ifdef CONFIG_PER_VMA_LOCK > > - > > -/* SLAB cache for vm_area_struct.lock */ > > -static struct kmem_cache *vma_lock_cachep; > > - > > -static bool vma_lock_alloc(struct vm_area_struct *vma) > > -{ > > - vma->vm_lock =3D kmem_cache_alloc(vma_lock_cachep, GFP_KERNEL); > > - if (!vma->vm_lock) > > - return false; > > - > > - init_rwsem(&vma->vm_lock->lock); > > - vma->vm_lock_seq =3D UINT_MAX; > > - > > - return true; > > -} > > - > > -static inline void vma_lock_free(struct vm_area_struct *vma) > > -{ > > - kmem_cache_free(vma_lock_cachep, vma->vm_lock); > > -} > > - > > -#else /* CONFIG_PER_VMA_LOCK */ > > - > > -static inline bool vma_lock_alloc(struct vm_area_struct *vma) { return= true; } > > -static inline void vma_lock_free(struct vm_area_struct *vma) {} > > - > > -#endif /* CONFIG_PER_VMA_LOCK */ > > - > > struct vm_area_struct *vm_area_alloc(struct mm_struct *mm) > > { > > struct vm_area_struct *vma; > > @@ -474,10 +445,6 @@ struct vm_area_struct *vm_area_alloc(struct mm_str= uct *mm) > > return NULL; > > > > vma_init(vma, mm); > > - if (!vma_lock_alloc(vma)) { > > - kmem_cache_free(vm_area_cachep, vma); > > - return NULL; > > - } > > > > return vma; > > } > > @@ -496,10 +463,7 @@ struct vm_area_struct *vm_area_dup(struct vm_area_= struct *orig) > > * will be reinitialized. > > */ > > data_race(memcpy(new, orig, sizeof(*new))); > > - if (!vma_lock_alloc(new)) { > > - kmem_cache_free(vm_area_cachep, new); > > - return NULL; > > - } > > + vma_lock_init(new); > > INIT_LIST_HEAD(&new->anon_vma_chain); > > vma_numab_state_init(new); > > dup_anon_vma_name(orig, new); > > @@ -511,7 +475,6 @@ void __vm_area_free(struct vm_area_struct *vma) > > { > > vma_numab_state_free(vma); > > free_anon_vma_name(vma); > > - vma_lock_free(vma); > > kmem_cache_free(vm_area_cachep, vma); > > } > > > > @@ -522,7 +485,7 @@ static void vm_area_free_rcu_cb(struct rcu_head *he= ad) > > vm_rcu); > > > > /* The vma should not be locked while being destroyed. */ > > - VM_BUG_ON_VMA(rwsem_is_locked(&vma->vm_lock->lock), vma); > > + VM_BUG_ON_VMA(rwsem_is_locked(&vma->vm_lock.lock), vma); > > __vm_area_free(vma); > > } > > #endif > > @@ -3168,11 +3131,9 @@ void __init proc_caches_init(void) > > sizeof(struct fs_struct), 0, > > SLAB_HWCACHE_ALIGN|SLAB_PANIC|SLAB_ACCOUNT, > > NULL); > > - > > - vm_area_cachep =3D KMEM_CACHE(vm_area_struct, SLAB_PANIC|SLAB_ACC= OUNT); > > -#ifdef CONFIG_PER_VMA_LOCK > > - vma_lock_cachep =3D KMEM_CACHE(vma_lock, SLAB_PANIC|SLAB_ACCOUNT)= ; > > -#endif > > + vm_area_cachep =3D KMEM_CACHE(vm_area_struct, > > + SLAB_HWCACHE_ALIGN|SLAB_NO_MERGE|SLAB_PANIC| > > + SLAB_ACCOUNT); > > Why the SLAB_NO_MERGE? Ah, I had it there for convenience to be able to see them separately in /proc/slabinfo. With SLAB_HWCACHE_ALIGN I don't think it matters for cacheline sharing... Once we add SLAB_TYPESAFE_BY_RCU this flag won't matter anyway because it will prevent slab merging. > > > mmap_init(); > > nsproxy_cache_init(); > > } > > -- > > 2.47.0.277.g8800431eea-goog > >