From patchwork Thu Apr 7 09:32:21 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?SsO8cmdlbiBHcm/Dnw==?= X-Patchwork-Id: 12804919 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 657C3C433F5 for ; Thu, 7 Apr 2022 09:32:46 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D866C6B0071; Thu, 7 Apr 2022 05:32:35 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id D36056B0073; Thu, 7 Apr 2022 05:32:35 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C250A6B0074; Thu, 7 Apr 2022 05:32:35 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (relay.hostedemail.com [64.99.140.28]) by kanga.kvack.org (Postfix) with ESMTP id B4A3E6B0071 for ; Thu, 7 Apr 2022 05:32:35 -0400 (EDT) Received: from smtpin19.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 78FF3236B3 for ; Thu, 7 Apr 2022 09:32:25 +0000 (UTC) X-FDA: 79329567450.19.FF0CD2D Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by imf14.hostedemail.com (Postfix) with ESMTP id EEEA7100004 for ; Thu, 7 Apr 2022 09:32:24 +0000 (UTC) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 94A37212C2; Thu, 7 Apr 2022 09:32:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1649323943; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=iMz/fVk+XpC4IDojCtgZdhSbgaH5sJ66FU6YyYC0dAU=; b=srp3svmAJ66vDcJogBKiIGdVGuq5CEJs6NzN+Dq5b4+v+huIvNyS5C2rdiaVbhfch0DbrT 75BoiGD0hZpc6CLImwmff34i2BgedTfCkHnIdUGSlX2blYRSglJ9ApB8mrYmE1yFAMAhOC HK7B66ciQOpkaSSp/7AQBiyKBcgA1u8= Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 5B6E913A66; Thu, 7 Apr 2022 09:32:23 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id 5vzuFKevTmJVLgAAMHmgww (envelope-from ); Thu, 07 Apr 2022 09:32:23 +0000 From: Juergen Gross To: xen-devel@lists.xenproject.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: Juergen Gross , Andrew Morton , stable@vger.kernel.org, =?utf-8?q?Marek_Marczykowski-G=C3=B3recki?= Subject: [PATCH] mm, page_alloc: fix build_zonerefs_node() Date: Thu, 7 Apr 2022 11:32:21 +0200 Message-Id: <20220407093221.1090-1-jgross@suse.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: EEEA7100004 X-Stat-Signature: i6c9xh1o4ceb5adiuo8o5wf1kd731k7o X-Rspam-User: Authentication-Results: imf14.hostedemail.com; dkim=pass header.d=suse.com header.s=susede1 header.b=srp3svmA; dmarc=pass (policy=quarantine) header.from=suse.com; spf=pass (imf14.hostedemail.com: domain of jgross@suse.com designates 195.135.220.28 as permitted sender) smtp.mailfrom=jgross@suse.com X-HE-Tag: 1649323944-469224 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: Since commit 9d3be21bf9c0 ("mm, page_alloc: simplify zonelist initialization") only zones with free memory are included in a built zonelist. This is problematic when e.g. all memory of a zone has been ballooned out. Use populated_zone() when building a zonelist as it has been done before that commit. Cc: stable@vger.kernel.org Fixes: 9d3be21bf9c0 ("mm, page_alloc: simplify zonelist initialization") Reported-by: Marek Marczykowski-Górecki Signed-off-by: Juergen Gross Acked-by: David Hildenbrand Acked-by: Michal Hocko Reviewed-by: Wei Yang --- 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 bdc8f60ae462..3d0662af3289 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -6128,7 +6128,7 @@ static int build_zonerefs_node(pg_data_t *pgdat, struct zoneref *zonerefs) do { zone_type--; zone = pgdat->node_zones + zone_type; - if (managed_zone(zone)) { + if (populated_zone(zone)) { zoneref_set_zone(zone, &zonerefs[nr_zones++]); check_highest_zone(zone_type); }