khugepaged: Raplace barrier() with READ_ONCE() for a selective variable
Subsystems (2)
PATCH 1/1 khugepaged: Raplace barrier() with READ_ONCE() for a selective variable
From: Yanfei Xu <[email protected]>
READ_ONCE() is more selective and lightweight. It is more appropriate that using a READ_ONCE() for the certain variable to prevent the compiler from reordering.
Signed-off-by Yanfei Xu <[email protected]>
--- mm/khugepaged.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
mm/khugepaged.c +1 -3
@@ -2202,11 +2202,9 @@ static void khugepaged_do_scan(void) {struct page *hpage =NULL ;unsigned int progress =0 , pass_through_head =0 ; -unsigned int pages = khugepaged_pages_to_scan; +unsigned int pages =READ_ONCE (khugepaged_pages_to_scan);bool wait = true; -barrier ();/* write khugepaged_pages_to_scan to local stack */ -lru_add_drain_all ();while (progress < pages) {
Signature · 1 line
2.27.0
Quoted 7 lines · On Tue, Mar 23, 2021 at 05:27:30PM +0800, [email protected] wrote:
From: Yanfei Xu <[email protected]>
READ_ONCE()is more selective and lightweight. It is more appropriate that using aREAD_ONCE()for the certain variable to prevent the compiler from reordering.Signed-off-by Yanfei Xu <[email protected]>
Signature · 1 line
Kirill A. Shutemov