The patch titled Subject: mm/khugepaged.c: replace barrier() with READ_ONCE() for a selective variable has been added to the -mm tree. Its filename is khugepaged-raplace-barrier-with-read_once-for-a-selective-variable.patch This patch should soon appear at https://ozlabs.org/~akpm/mmots/broken-out/khugepaged-raplace-barrier-with-read_once-for-a-selective-variable.patch and later at https://ozlabs.org/~akpm/mmotm/broken-out/khugepaged-raplace-barrier-with-read_once-for-a-selective-variable.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/process/submit-checklist.rst when testing your code *** The -mm tree is included into linux-next and is updated there every 3-4 working days ------------------------------------------------------ From: Yanfei Xu <yanfei.xu@xxxxxxxxxxxxx> Subject: mm/khugepaged.c: replace barrier() with READ_ONCE() for a selective variable 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. Link: https://lkml.kernel.org/r/20210323092730.247583-1-yanfei.xu@xxxxxxxxxxxxx Signed-off-by: Yanfei Xu <yanfei.xu@xxxxxxxxxxxxx> Acked-by: Kirill A. Shutemov <kirill.shutemov@xxxxxxxxxxxxxxx> Cc: Mike Kravetz <mike.kravetz@xxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- mm/khugepaged.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) --- a/mm/khugepaged.c~khugepaged-raplace-barrier-with-read_once-for-a-selective-variable +++ a/mm/khugepaged.c @@ -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) { _ Patches currently in -mm which might be from yanfei.xu@xxxxxxxxxxxxx are khugepaged-raplace-barrier-with-read_once-for-a-selective-variable.patch