mm, swap: Use prandom_u32_max()
Subsystems (2)
PATCH 1/1 mm, swap: Use prandom_u32_max()
To improve the code readability and take advantage of the common implementation.
Signed-off-by "Huang, Ying" <[email protected]>
Acked-by Michal Hocko <[email protected]>
Cc Minchan Kim <[email protected]>
Cc Tim Chen <[email protected]>
Cc Hugh Dickins <[email protected]>
---
Changelog:
v2:
- Revise the patch description per Michal's comments.
--- mm/swapfile.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
mm/swapfile.c +1 -1
@@ -3220,7 +3220,7 @@ SYSCALL_DEFINE2(swapon, const char __user *, specialfile, int, swap_flags)* select a random position to start with to help wear leveling * SSD */ - p->cluster_next =1 + (prandom_u32 () % p->highest_bit); + p->cluster_next =1 +prandom_u32_max (p->highest_bit); nr_cluster =DIV_ROUND_UP (maxpages,SWAPFILE_CLUSTER ); cluster_info = kvcalloc(nr_cluster, sizeof(*cluster_info),
Signature · 1 line
2.26.2