linux-stable/include
Steven Rostedt (Google) f67f8d4a8c mm/rmap: fix misplaced parenthesis of a likely()
Running my yearly branch profiler to see where likely/unlikely annotation
may be added or removed, I discovered this:

correct incorrect  %        Function                  File              Line
 ------- ---------  -        --------                  ----              ----
       0   457918 100 page_try_dup_anon_rmap         rmap.h               264
[..]
  458021        0   0 page_try_dup_anon_rmap         rmap.h               265

I thought it was interesting that line 264 of rmap.h had a 100% incorrect
annotation, but the line directly below it was 100% correct. Looking at the
code:

	if (likely(!is_device_private_page(page) &&
	    unlikely(page_needs_cow_for_dma(vma, page))))

It didn't make sense. The "likely()" was around the entire if statement
(not just the "!is_device_private_page(page)"), which also included the
"unlikely()" portion of that if condition.

If the unlikely portion is unlikely to be true, that would make the entire
if condition unlikely to be true, so it made no sense at all to say the
entire if condition is true.

What is more likely to be likely is just the first part of the if statement
before the && operation. It's likely to be a misplaced parenthesis. And
after making the if condition broken into a likely() && unlikely(), both
now appear to be correct!

Link: https://lkml.kernel.org/r/20231201145936.5ddfdb50@gandalf.local.home
Fixes:fb3d824d1a46c ("mm/rmap: split page_dup_rmap() into page_dup_file_rmap() and page_try_dup_anon_rmap()")
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
Acked-by: Vlastimil Babka <vbabka@suse.cz>
Cc: David Hildenbrand <david@redhat.com>
Cc: Vlastimil Babka <vbabka@suse.cz>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
2023-12-12 10:57:06 -08:00
..
acpi ACPI: PM: Add acpi_device_fix_up_power_children() function 2023-11-20 17:31:49 +01:00
asm-generic asm-generic: qspinlock: fix queued_spin_value_unlocked() implementation 2023-11-22 09:32:49 -08:00
clocksource
crypto
drm amd-drm-fixes-6.7-2023-11-30: 2023-12-01 13:57:11 +10:00
dt-bindings linux-watchdog 6.7-rc1 tag 2023-11-09 13:54:25 -08:00
keys
kunit
kvm
linux mm/rmap: fix misplaced parenthesis of a likely() 2023-12-12 10:57:06 -08:00
math-emu
media
memory
misc
net wireless fixes: 2023-11-29 19:43:34 -08:00
pcmcia
ras
rdma
rv
scsi scsi: sd: Fix system start for ATA devices 2023-11-24 20:44:21 -05:00
soc IOMMU Updates for Linux v6.7 2023-11-09 13:37:28 -08:00
sound ALSA: cs35l41: Fix for old systems which do not support command 2023-11-20 12:37:01 +01:00
target
trace rxrpc: Fix RTT determination to use any ACK as a source 2023-11-17 02:50:33 +00:00
uapi fs/proc/task_mmu: report SOFT_DIRTY bits through the PAGEMAP_SCAN ioctl 2023-12-10 16:51:35 -08:00
ufs
vdso
video
xen xen/events: reduce externally visible helper functions 2023-11-14 09:29:28 +01:00