Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp776373ybb; Sat, 28 Mar 2020 09:48:14 -0700 (PDT) X-Google-Smtp-Source: ADFU+vv/L5KWis3TDIGlorNmn5t8+KF4vOSqWVDWPjS/bIPpS6xxxKWJUcUtLE1mbKwTEVZ6g/f/ X-Received: by 2002:a9d:65ca:: with SMTP id z10mr3530905oth.244.1585414093912; Sat, 28 Mar 2020 09:48:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585414093; cv=none; d=google.com; s=arc-20160816; b=mFUzE/9QQ73BEUPgoC8rX29ArTkA+WjYldqDWPwh2jwkiokbErm4a0DdIH1aIGqW1S 0FR0mJhNIfLv+VojpBxUQkhuRqXh2u4U0mB4PqKk1wYirUDpICcD61gZyQ32EtgMvj5z ep7IiKlWMmC3GWpP7Lfw/AypbdqBtlMlxVdh5eW2VymMBGQdTAARejzjXZOYvukC5yA8 3BgBACfoUSBtwIEpZQdWEKAlq7GMfw5zv50ryLOAXPezUzCu42VU+7clV14EMtrFQmkV i5tWv4GxFgGTxqVQsoZlPVQasKjMVotkccfzDOu3GFB45LCfh13hY46lv3dhtfYUuGOE ZGAA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:date:from:message-id; bh=jG8sUT3jFahHN+0FU0gSvOVjzradBGZ4m2WVw8n/4lw=; b=ygFul0hus9lFnOQxeucCBUOe/DAMVpppmxb3Uem6VgtAv/I3PdeaDY4l+1T+Lk2SQA NKY1luBgwX8Xe7niZMSY0gmxm6t7gmK3RCViU0mnDd28griRTQ4mMz/klbKRsl0Egt5J RU2k3duPZ7xbJgpaRJiMyljXaq35ML2ZILal8xfVcBhsd7x0VecPDjaPLb9WfE5B1eSR G33FvG8a5TLNipv7uG9W8/p8NIxlpciaJs5dt0fslaXlMKvndmqSPG9aldSQX1SLYJIl M0tHhwPGRUZwEuLmjQxZrQoeGXIrl8+S3jywLWYcG5z5m5p2lJq4UxlN7nMLI1MC5f+D YSOA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x189si4004275oia.270.2020.03.28.09.48.01; Sat, 28 Mar 2020 09:48:13 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728158AbgC1QqL (ORCPT + 99 others); Sat, 28 Mar 2020 12:46:11 -0400 Received: from mx.sdf.org ([205.166.94.20]:50100 "EHLO mx.sdf.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727620AbgC1Qn0 (ORCPT ); Sat, 28 Mar 2020 12:43:26 -0400 Received: from sdf.org (IDENT:lkml@sdf.lonestar.org [205.166.94.16]) by mx.sdf.org (8.15.2/8.14.5) with ESMTPS id 02SGhPTa005210 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256 bits) verified NO); Sat, 28 Mar 2020 16:43:25 GMT Received: (from lkml@localhost) by sdf.org (8.15.2/8.12.8/Submit) id 02SGhPmY017434; Sat, 28 Mar 2020 16:43:25 GMT Message-Id: <202003281643.02SGhPmY017434@sdf.org> From: George Spelvin Date: Thu, 3 Oct 2019 05:51:56 -0400 Subject: [RFC PATCH v1 46/50] mm/shuffle.c: use get_random_max() To: linux-kernel@vger.kernel.org, lkml@sdf.org Cc: Dan Williams , Qian Cai , Kees Cook , Michal Hocko , Andrew Morton , linux-mm@kvack.org Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Now that we have it, this is an example of where it helps. Signed-off-by: George Spelvin Cc: Dan Williams Cc: Qian Cai Cc: Kees Cook Cc: Michal Hocko Cc: Andrew Morton 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