From: Lukas Bulwahn Date: Tue, 15 Dec 2020 03:12:18 +0000 (-0800) Subject: mm/vmscan: drop unneeded assignment in kswapd() X-Git-Tag: v5.15~2223^2~47 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=2b47a24cee0eedbb9b106ef3e992db0ddf48f740;p=platform%2Fkernel%2Flinux-starfive.git mm/vmscan: drop unneeded assignment in kswapd() The refactoring to kswapd() in commit e716f2eb24de ("mm, vmscan: prevent kswapd sleeping prematurely due to mismatched classzone_idx") turned an assignment to reclaim_order into a dead store, as in all further paths, reclaim_order will be assigned again before it is used. make clang-analyzer on x86_64 tinyconfig caught my attention with: mm/vmscan.c: warning: Although the value stored to 'reclaim_order' is used in the enclosing expression, the value is never actually read from 'reclaim_order' [clang-analyzer-deadcode.DeadStores] Compilers will detect this unneeded assignment and optimize this anyway. So, the resulting binary is identical before and after this change. Simplify the code and remove unneeded assignment to make clang-analyzer happy. No functional change. No change in binary code. Link: https://lkml.kernel.org/r/20201004125827.17679-1-lukas.bulwahn@gmail.com Signed-off-by: Lukas Bulwahn Acked-by: Mel Gorman Cc: Vlastimil Babka Cc: Michal Hocko Cc: Nathan Chancellor Cc: Nick Desaulniers Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/mm/vmscan.c b/mm/vmscan.c index 0ec6321..e71b563 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -3895,7 +3895,7 @@ kswapd_try_sleep: highest_zoneidx); /* Read the new order and highest_zoneidx */ - alloc_order = reclaim_order = READ_ONCE(pgdat->kswapd_order); + alloc_order = READ_ONCE(pgdat->kswapd_order); highest_zoneidx = kswapd_highest_zoneidx(pgdat, highest_zoneidx); WRITE_ONCE(pgdat->kswapd_order, 0);