All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mm/vmscan: drop unneeded assignment in kswapd()
@ 2020-10-04 12:58 ` Lukas Bulwahn
  0 siblings, 0 replies; 11+ messages in thread
From: Lukas Bulwahn @ 2020-10-04 12:58 UTC (permalink / raw)
  To: Mel Gorman, Andrew Morton, linux-mm
  Cc: Vlastimil Babka, Michal Hocko, Nathan Chancellor,
	Nick Desaulniers, linux-kernel, clang-built-linux,
	kernel-janitors, linux-safety, Lukas Bulwahn

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.

Signed-off-by: Lukas Bulwahn <lukas.bulwahn@gmail.com>
---
applies cleanly on current master and next-20201002

Mel, please ack.
Andrew, please pick this minor non-urgent clean-up patch.

I quickly confirmed that the binary did not change with this change to the
source code; The hash of mm/vmscan.o remained the same before and after
the change.

So, in my setup:
md5sum mm/vmscan.o
7da4675477f186263e36b726cc2b859d  mm/vmscan.o

linux-safety, please verify and validate this change.

 mm/vmscan.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mm/vmscan.c b/mm/vmscan.c
index 466fc3144fff..130ee40c1255 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -3896,7 +3896,7 @@ static int kswapd(void *p)
 					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);
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2020-10-05  7:59 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-04 12:58 [PATCH] mm/vmscan: drop unneeded assignment in kswapd() Lukas Bulwahn
2020-10-04 12:58 ` Lukas Bulwahn
2020-10-04 19:24 ` Mel Gorman
2020-10-04 19:24   ` Mel Gorman
2020-10-05  6:58   ` Lukas Bulwahn
2020-10-05  6:58     ` Lukas Bulwahn
2020-10-05  6:58     ` Lukas Bulwahn
2020-10-05  7:56     ` Mel Gorman
2020-10-05  7:56       ` Mel Gorman
2020-10-05  7:59     ` Mel Gorman
2020-10-05  7:59       ` Mel Gorman

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.