Message ID | 20241120000826.335387-1-surenb@google.com (mailing list archive) |
---|---|
Headers | show |
Series | move per-vma lock into vm_area_struct | expand |
On Tue, Nov 19, 2024 at 04:08:21PM -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]. If 'struct vm_area_struct' is prone to performance issues due to cacheline misalignments then we should do something about the __randomize_layout tag for it. I imagine we can identify the fields which might be performance critical to be on same cacheline or different cacheline due to false sharing then we can divide the fields into different cacheline groups and fields can be __randomize_layout within the group. WDYT?
On Wed, Nov 20, 2024 at 2:10 PM Shakeel Butt <shakeel.butt@linux.dev> wrote: > > On Tue, Nov 19, 2024 at 04:08:21PM -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]. > > If 'struct vm_area_struct' is prone to performance issues due to > cacheline misalignments then we should do something about the > __randomize_layout tag for it. I imagine we can identify the fields > which might be performance critical to be on same cacheline or different > cacheline due to false sharing then we can divide the fields into > different cacheline groups and fields can be __randomize_layout within > the group. WDYT? I think that's a good idea since shuffling these fields around does affect performance. I can look into it once these changes get finalized and the layout gets more stable. >
On Wed, Nov 20, 2024 at 02:10:44PM -0800, Shakeel Butt wrote: > If 'struct vm_area_struct' is prone to performance issues due to > cacheline misalignments then we should do something about the > __randomize_layout tag for it. I imagine we can identify the fields > which might be performance critical to be on same cacheline or different > cacheline due to false sharing then we can divide the fields into > different cacheline groups and fields can be __randomize_layout within > the group. WDYT? Pretty sure the people who think security is more important than performance are the only ones who randomize structs.