From patchwork Tue Mar 30 11:48:47 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mel Gorman X-Patchwork-Id: 12172357 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.2 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,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 D3282C433C1 for ; Tue, 30 Mar 2021 11:48:51 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 3EBC261921 for ; Tue, 30 Mar 2021 11:48:51 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3EBC261921 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=techsingularity.net Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id B18D86B007D; Tue, 30 Mar 2021 07:48:50 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id AC99A6B0080; Tue, 30 Mar 2021 07:48:50 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9B9526B0081; Tue, 30 Mar 2021 07:48:50 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 827756B007D for ; Tue, 30 Mar 2021 07:48:50 -0400 (EDT) Received: from smtpin16.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 41931180AD81F for ; Tue, 30 Mar 2021 11:48:50 +0000 (UTC) X-FDA: 77976368820.16.0A7411D Received: from outbound-smtp37.blacknight.com (outbound-smtp37.blacknight.com [46.22.139.220]) by imf02.hostedemail.com (Postfix) with ESMTP id F37C640002C1 for ; Tue, 30 Mar 2021 11:48:41 +0000 (UTC) Received: from mail.blacknight.com (pemlinmail01.blacknight.ie [81.17.254.10]) by outbound-smtp37.blacknight.com (Postfix) with ESMTPS id 9B71619BC for ; Tue, 30 Mar 2021 12:48:48 +0100 (IST) Received: (qmail 28162 invoked from network); 30 Mar 2021 11:48:48 -0000 Received: from unknown (HELO techsingularity.net) (mgorman@techsingularity.net@[84.203.22.4]) by 81.17.254.9 with ESMTPSA (AES256-SHA encrypted, authenticated); 30 Mar 2021 11:48:48 -0000 Date: Tue, 30 Mar 2021 12:48:47 +0100 From: Mel Gorman To: Andrew Morton Cc: Linux-MM , LKML , Colin Ian King Subject: [PATCH] mm/page_alloc: Add a bulk page allocator -fix -fix Message-ID: <20210330114847.GX3697@techsingularity.net> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.10.1 (2018-07-13) X-Rspamd-Queue-Id: F37C640002C1 X-Stat-Signature: c7yj4dubbr158ud1tfh8dxkeytjep9zc X-Rspamd-Server: rspam02 Received-SPF: none (techsingularity.net>: No applicable sender policy available) receiver=imf02; identity=mailfrom; envelope-from=""; helo=outbound-smtp37.blacknight.com; client-ip=46.22.139.220 X-HE-DKIM-Result: none/none X-HE-Tag: 1617104921-4879 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: 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 Reviewed-by: Colin Ian King --- 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))