Skip to content

Commit 2b47a24

Browse files
bulwahntorvalds
authored andcommitted
mm/vmscan: drop unneeded assignment in kswapd()
The refactoring to kswapd() in commit e716f2e ("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 <lukas.bulwahn@gmail.com> Acked-by: Mel Gorman <mgorman@techsingularity.net> Cc: Vlastimil Babka <vbabka@suse.cz> Cc: Michal Hocko <mhocko@suse.com> Cc: Nathan Chancellor <natechancellor@gmail.com> Cc: Nick Desaulniers <ndesaulniers@google.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent 597c892 commit 2b47a24

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

mm/vmscan.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3895,7 +3895,7 @@ static int kswapd(void *p)
38953895
highest_zoneidx);
38963896

38973897
/* Read the new order and highest_zoneidx */
3898-
alloc_order = reclaim_order = READ_ONCE(pgdat->kswapd_order);
3898+
alloc_order = READ_ONCE(pgdat->kswapd_order);
38993899
highest_zoneidx = kswapd_highest_zoneidx(pgdat,
39003900
highest_zoneidx);
39013901
WRITE_ONCE(pgdat->kswapd_order, 0);

0 commit comments

Comments
 (0)