[RFC,v1,46/50] mm/shuffle.c: use get_random_max()
diff mbox series

Message ID 202003281643.02SGhPmY017434@sdf.org
State New
Headers show
Series
  • Untitled series #263211
Related show

Commit Message

George Spelvin Oct. 3, 2019, 9:51 a.m. UTC
Now that we have it, this is an example of where it helps.

Signed-off-by: George Spelvin <lkml@sdf.org>
Cc: Dan Williams <dan.j.williams@intel.com>
Cc: Qian Cai <cai@lca.pw>
Cc: Kees Cook <keescook@chromium.org>
Cc: Michal Hocko <mhocko@suse.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: linux-mm@kvack.org
---
 mm/shuffle.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Dan Williams March 28, 2020, 6:23 p.m. UTC | #1
On Sat, Mar 28, 2020 at 9:43 AM George Spelvin <lkml@sdf.org> wrote:
>
> Now that we have it, this is an example of where it helps.

I didn't get copied on the cover and this series does not seem to be
threaded in a way lore can find the cover either:
https://lore.kernel.org/r/202003281643.02SGhPmY017434@sdf.org

Mind including a short blurb about what it is and why it helps in the changelog?

>
> Signed-off-by: George Spelvin <lkml@sdf.org>
> Cc: Dan Williams <dan.j.williams@intel.com>
> Cc: Qian Cai <cai@lca.pw>
> Cc: Kees Cook <keescook@chromium.org>
> Cc: Michal Hocko <mhocko@suse.com>
> Cc: Andrew Morton <akpm@linux-foundation.org>
> Cc: linux-mm@kvack.org
> ---
>  mm/shuffle.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/mm/shuffle.c b/mm/shuffle.c
> index b3fe97fd66541..e0ed247f8d907 100644
> --- a/mm/shuffle.c
> +++ b/mm/shuffle.c
> @@ -135,7 +135,7 @@ void __meminit __shuffle_zone(struct zone *z)
>                          * in the zone.
>                          */
>                         j = z->zone_start_pfn +
> -                               ALIGN_DOWN(get_random_long() % z->spanned_pages,
> +                               ALIGN_DOWN(get_random_max(z->spanned_pages),
>                                                 order_pages);
>                         page_j = shuffle_valid_page(j, order);
>                         if (page_j && page_j != page_i)
> --
> 2.26.0
>

Patch
diff mbox series

diff --git a/mm/shuffle.c b/mm/shuffle.c
index b3fe97fd66541..e0ed247f8d907 100644
--- a/mm/shuffle.c
+++ b/mm/shuffle.c
@@ -135,7 +135,7 @@  void __meminit __shuffle_zone(struct zone *z)
 			 * in the zone.
 			 */
 			j = z->zone_start_pfn +
-				ALIGN_DOWN(get_random_long() % z->spanned_pages,
+				ALIGN_DOWN(get_random_max(z->spanned_pages),
 						order_pages);
 			page_j = shuffle_valid_page(j, order);
 			if (page_j && page_j != page_i)