From: Breno Leitao Date: Fri, 4 Oct 2024 16:48:31 +0000 (-0700) Subject: mm: remove misleading 'unlikely' hint in vms_gather_munmap_vmas() X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=0325087c5aa884afec92b67fe63b7dc60b1eb030;p=users%2Fjedix%2Flinux-maple.git mm: remove misleading 'unlikely' hint in vms_gather_munmap_vmas() Performance analysis using branch annotation on a fleet of 200 hosts running web servers revealed that the 'unlikely' hint in vms_gather_munmap_vmas() was 100% consistently incorrect. In all observed cases, the branch behavior contradicted the hint. Remove the 'unlikely' qualifier from the condition checking 'vms->uf'. By doing so, we allow the compiler to make optimization decisions based on its own heuristics and profiling data, rather than relying on a static hint that has proven to be inaccurate in real-world scenarios. Link: https://lkml.kernel.org/r/20241004164832.218681-1-leitao@debian.org Signed-off-by: Breno Leitao Reviewed-by: Lorenzo Stoakes Acked-by: Vlastimil Babka Reviewed-by: Liam R. Howlett Signed-off-by: Andrew Morton --- diff --git a/mm/vma.c b/mm/vma.c index 7621384d64cf..bb7cfa2dc282 100644 --- a/mm/vma.c +++ b/mm/vma.c @@ -1254,7 +1254,7 @@ int vms_gather_munmap_vmas(struct vma_munmap_struct *vms, else if (is_data_mapping(next->vm_flags)) vms->data_vm += nrpages; - if (unlikely(vms->uf)) { + if (vms->uf) { /* * If userfaultfd_unmap_prep returns an error the vmas * will remain split, but userland will get a