Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp4308358pxf; Tue, 30 Mar 2021 04:51:03 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxKGvptlwfSsYdaNKR6NPP6Zed6eFxvTHWZIup0BYTV02ystM6ervF3e+6QfSNZtdJht2Cn X-Received: by 2002:a17:906:fcb2:: with SMTP id qw18mr31802196ejb.434.1617105063221; Tue, 30 Mar 2021 04:51:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617105063; cv=none; d=google.com; s=arc-20160816; b=0nKVlAOR5ySJSX/GXQX+/AwyO0au83KEHwGPXhKcRr/ujgTufbQCIYPBTBKzyfDpcw MkP2Vy0Heqezy5c60vgWPgvf7L6Yqz8VBeThuV4L+DV7BQa88d6b3SyZ2HUhx+W8H6g6 dUhAHB3/OWoznTf9yH6a83R3ur578N+WMo57O4xmB5zGpPjhx/iTx4rs8wJCPF1/cLT+ wNa1f4fV90/Hd5pyxy4j0PmeuwmPlVipol6wd0NfMJwU312sqyJpbbH5dKeDjT0M2M3+ PPk0CJJZS3qe1GAUY6w8grTLNlWoLCEw2n9zF+TYskiKbKIRUaQFrr8ttT5zMs01uHFw u6oQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:content-disposition:mime-version :message-id:subject:cc:to:from:date; bh=XY07De4kNJhRNZi8VmEntpUnKoFMQp81y1K+Nd9Y7mc=; b=D1hIlpVOSuKIvmhFmF8Eib9vZmefq4QJPjqKByVMi11IuAkp1pLseFgMmwOHfcYLdv DjxVoWLV/aHBXEck12zVS+pqKEY8me+6p8LiBsQxFFqicn2voVFLCMZx+cSpNCESGMkv +tKyRHByr9dle+lLnas2SxlQikPsSVtGp7HJ8EDt+Mms6ZvkKTHP29YQaPchQtlQcv6v 26CHJDnT2TPWYvmJscNSYDVvTs54mWvswZ7+XjKH8I6HYWdOZyL11uGfchx3KHB0CVQq yNfmqfPQTN67n+gQ8uw+YuajZf4SeV9mzDtV/k1p8ys1QGHMwZQzCspFgixl2spOQqbG hvOg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id rh9si16133731ejb.341.2021.03.30.04.50.40; Tue, 30 Mar 2021 04:51:03 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232110AbhC3Ltd (ORCPT + 99 others); Tue, 30 Mar 2021 07:49:33 -0400 Received: from outbound-smtp61.blacknight.com ([46.22.136.249]:51103 "EHLO outbound-smtp61.blacknight.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232256AbhC3Lsu (ORCPT ); Tue, 30 Mar 2021 07:48:50 -0400 Received: from mail.blacknight.com (pemlinmail01.blacknight.ie [81.17.254.10]) by outbound-smtp61.blacknight.com (Postfix) with ESMTPS id 9D7A2FAA45 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-Type: text/plain; charset=iso-8859-15 Content-Disposition: inline User-Agent: Mutt/1.10.1 (2018-07-13) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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))