]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
Revert "lib/plist.c: enforce memory ordering in plist_check_list"
authorKuan-Wei Chiu <visitorckw@gmail.com>
Thu, 13 Nov 2025 19:34:13 +0000 (19:34 +0000)
committerAndrew Morton <akpm@linux-foundation.org>
Thu, 20 Nov 2025 22:03:43 +0000 (14:03 -0800)
commit9ab38c5216634d8adb22156ddbd32f2d195b27a7
tree3d483200a96a17c1ce72737ec844987c5080d0ad
parentb50144900a56404fb784c9fd6cddeeee4093b383
Revert "lib/plist.c: enforce memory ordering in plist_check_list"

This reverts commit 7abcb84f953df037d40fad66f2109db318dd155b.

The introduction of WRITE_ONCE() calls for the 'prev' and 'next' variables
inside plist_check_list() was a misapplication.  WRITE_ONCE() is
fundamentally a compiler barrier designed to prevent compiler
optimizations (like caching or reordering) on shared memory locations.
However, the variables 'prev' and 'next' are local, stack-allocated
pointers accessed only by the current thread's invocation of the function.

Since these pointers are thread-local and are never accessed concurrently,
applying WRITE_ONCE() to them is semantically incorrect and unnecessary.
Furthermore, the use of WRITE_ONCE() on local variables prevents the
compiler from performing standard optimizations, such as keeping these
variables cached solely in CPU registers throughout the loop, potentially
introducing performance overhead.  Restore the conventional C assignment
for local loop variables, allowing the compiler to generate optimal code.

Link: https://lkml.kernel.org/r/20251113193413.499309-1-visitorckw@gmail.com
Signed-off-by: Kuan-Wei Chiu <visitorckw@gmail.com>
Cc: I Hsin Cheng <richard120310@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
lib/plist.c