aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHuang Ying <[email protected]>2020-06-01 21:49:19 -0700
committerLinus Torvalds <[email protected]>2020-06-02 10:59:09 -0700
commit09fe06ce0bf5abe53b77a9515d7fb7579edec9c0 (patch)
tree7a25eba3fee1b17f1f26c359638cbcb3e0f40a04
parent33e16272fe982084e986d4eb6d5b5ca51c0d214e (diff)
mm/swapfile.c: use prandom_u32_max()
To improve the code readability and take advantage of the common implementation. Signed-off-by: "Huang, Ying" <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Acked-by: Michal Hocko <[email protected]> Cc: Minchan Kim <[email protected]> Cc: Tim Chen <[email protected]> Cc: Hugh Dickins <[email protected]> Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Linus Torvalds <[email protected]>
-rw-r--r--mm/swapfile.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/mm/swapfile.c b/mm/swapfile.c
index 2aa272376cae..18dfccb91123 100644
--- a/mm/swapfile.c
+++ b/mm/swapfile.c
@@ -3209,7 +3209,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),