From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.3 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 623E9C433C1 for ; Tue, 30 Mar 2021 11:51:34 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id C16A161969 for ; Tue, 30 Mar 2021 11:51:33 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C16A161969 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=canonical.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 522916B007D; Tue, 30 Mar 2021 07:51:33 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 4D30A6B0080; Tue, 30 Mar 2021 07:51:33 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3C3636B0081; Tue, 30 Mar 2021 07:51:33 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0019.hostedemail.com [216.40.44.19]) by kanga.kvack.org (Postfix) with ESMTP id 1F0116B007D for ; Tue, 30 Mar 2021 07:51:33 -0400 (EDT) Received: from smtpin20.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id D50DB181AEF3E for ; Tue, 30 Mar 2021 11:51:32 +0000 (UTC) X-FDA: 77976375624.20.10EDFC2 Received: from youngberry.canonical.com (youngberry.canonical.com [91.189.89.112]) by imf10.hostedemail.com (Postfix) with ESMTP id 293F440002D0 for ; Tue, 30 Mar 2021 11:51:29 +0000 (UTC) Received: from 1.general.cking.uk.vpn ([10.172.193.212]) by youngberry.canonical.com with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1lRCu5-0000CA-Sx; Tue, 30 Mar 2021 11:51:25 +0000 Subject: Re: [PATCH] mm/page_alloc: Add a bulk page allocator -fix -fix To: Mel Gorman , Andrew Morton Cc: Linux-MM , LKML References: <20210330114847.GX3697@techsingularity.net> From: Colin Ian King Message-ID: Date: Tue, 30 Mar 2021 12:51:25 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.0 MIME-Version: 1.0 In-Reply-To: <20210330114847.GX3697@techsingularity.net> Content-Type: text/plain; charset=iso-8859-15 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 293F440002D0 X-Stat-Signature: 8amasn8fyc31y1zhc1itydo5i39hbb1x X-Rspamd-Server: rspam02 Received-SPF: none (canonical.com>: No applicable sender policy available) receiver=imf10; identity=mailfrom; envelope-from=""; helo=youngberry.canonical.com; client-ip=91.189.89.112 X-HE-DKIM-Result: none/none X-HE-Tag: 1617105089-798560 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On 30/03/2021 12:48, Mel Gorman wrote: > Colin Ian King reported the following problem (slightly edited) > > Author: Mel Gorman > Date: Mon Mar 29 11:12:24 2021 +1100 > > mm/page_alloc: add a bulk page allocator > > ... > > Static analysis on linux-next with Coverity has found a potential > uninitialized variable issue in function __alloc_pages_bulk with > the following commit: > > ... > > Uninitialized scalar variable (UNINIT) > 15. uninit_use_in_call: Using uninitialized value alloc_flags when > calling prepare_alloc_pages. > > 5056 if (!prepare_alloc_pages(gfp, 0, preferred_nid, nodemask, > &ac, &alloc_gfp, &alloc_flags)) > > The problem is that prepare_alloc_flags only updates alloc_flags > which must have a valid initial value. The appropriate initial value is > ALLOC_WMARK_LOW to avoid the bulk allocator pushing a zone below the low > watermark without waking kswapd assuming the GFP mask allows kswapd to > be woken. > > This is a second fix to the mmotm patch > mm-page_alloc-add-a-bulk-page-allocator.patch . It will cause a mild conflict > with a later patch due to renaming of an adjacent variable that is trivially > resolved. I can post a full series with the fixes merged if that is preferred. > > Signed-off-by: Mel Gorman > --- > mm/page_alloc.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/mm/page_alloc.c b/mm/page_alloc.c > index 92d55f80c289..dabef0b910c9 100644 > --- a/mm/page_alloc.c > +++ b/mm/page_alloc.c > @@ -4990,7 +4990,7 @@ unsigned long __alloc_pages_bulk(gfp_t gfp, int preferred_nid, > struct list_head *pcp_list; > struct alloc_context ac; > gfp_t alloc_gfp; > - unsigned int alloc_flags; > + unsigned int alloc_flags = ALLOC_WMARK_LOW; > int allocated = 0; > > if (WARN_ON_ONCE(nr_pages <= 0)) > Thanks Mel, that definitely fixes the issue. Reviewed-by: Colin Ian King