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 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3D585C433EF for ; Thu, 7 Apr 2022 12:33:15 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id CBE596B0071; Thu, 7 Apr 2022 08:33:04 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id C43C56B0075; Thu, 7 Apr 2022 08:33:04 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B0C2C6B0078; Thu, 7 Apr 2022 08:33:04 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0101.hostedemail.com [216.40.44.101]) by kanga.kvack.org (Postfix) with ESMTP id 9D5ED6B0071 for ; Thu, 7 Apr 2022 08:33:04 -0400 (EDT) Received: from smtpin30.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 5B4F0183B5C25 for ; Thu, 7 Apr 2022 12:32:54 +0000 (UTC) X-FDA: 79330022268.30.2659BAD Received: from outbound-smtp35.blacknight.com (outbound-smtp35.blacknight.com [46.22.139.218]) by imf07.hostedemail.com (Postfix) with ESMTP id A2FB940003 for ; Thu, 7 Apr 2022 12:32:53 +0000 (UTC) Received: from mail.blacknight.com (pemlinmail06.blacknight.ie [81.17.255.152]) by outbound-smtp35.blacknight.com (Postfix) with ESMTPS id 229761A17 for ; Thu, 7 Apr 2022 13:32:52 +0100 (IST) Received: (qmail 22167 invoked from network); 7 Apr 2022 12:32:51 -0000 Received: from unknown (HELO techsingularity.net) (mgorman@techsingularity.net@[84.203.17.223]) by 81.17.254.9 with ESMTPSA (AES256-SHA encrypted, authenticated); 7 Apr 2022 12:32:51 -0000 Date: Thu, 7 Apr 2022 13:32:44 +0100 From: Mel Gorman To: Juergen Gross Cc: Michal Hocko , xen-devel@lists.xenproject.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Andrew Morton , stable@vger.kernel.org, Marek Marczykowski-G?recki , Mel Gorman Subject: Re: [PATCH] mm, page_alloc: fix build_zonerefs_node() Message-ID: <20220407115414.GA4148@techsingularity.net> References: <20220407093221.1090-1-jgross@suse.com> <5e97a7f5-1fc9-d0b4-006e-6894d5653c06@suse.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15 Content-Disposition: inline In-Reply-To: <5e97a7f5-1fc9-d0b4-006e-6894d5653c06@suse.com> User-Agent: Mutt/1.10.1 (2018-07-13) Authentication-Results: imf07.hostedemail.com; dkim=none; dmarc=none; spf=pass (imf07.hostedemail.com: domain of mgorman@techsingularity.net designates 46.22.139.218 as permitted sender) smtp.mailfrom=mgorman@techsingularity.net X-Rspam-User: X-Rspamd-Server: rspam10 X-Rspamd-Queue-Id: A2FB940003 X-Stat-Signature: z7w7k65zsrie4h384acwg9gs6joa4f41 X-HE-Tag: 1649334773-291919 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 Thu, Apr 07, 2022 at 01:17:19PM +0200, Juergen Gross wrote: > On 07.04.22 13:07, Michal Hocko wrote: > > On Thu 07-04-22 12:45:41, Juergen Gross wrote: > > > On 07.04.22 12:34, Michal Hocko wrote: > > > > Ccing Mel > > > > > > > > On Thu 07-04-22 11:32:21, Juergen Gross wrote: > > > > > 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. > > > > > > > > What is the actual problem there? > > > > > > When running as Xen guest new hotplugged memory will not be onlined > > > automatically, but only on special request. This is done in order to > > > support adding e.g. the possibility to use another GB of memory, while > > > adding only a part of that memory initially. > > > > > > In case adding that memory is populating a new zone, the page allocator > > > won't be able to use this memory when it is onlined, as the zone wasn't > > > added to the zonelist, due to managed_zone() returning 0. > > > > How is that memory onlined? Because "regular" onlining (online_pages()) > > does rebuild zonelists if their zone hasn't been populated before. > > The Xen balloon driver has an own callback for onlining pages. The pages > are just added to the ballooned-out page list without handing them to the > allocator. This is done only when the guest is ballooned up. > Is this new behaviour? I ask because keeping !managed_zones out of the zonelist and reclaim paths and the behaviour makes sense. Elsewhere you state "zone can always happen to have no free memory left" and this is true but it's usually a transient event. The difference between a populated vs managed zone is usually permanent event where no memory will ever be placed on the buddy lists because the memory was reserved early in boot or a similar reason. The patch is probably harmless but it has the potential to waste CPUs allocating or reclaiming from zones that will never succeed. -- Mel Gorman SUSE Labs