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 39F0DC433F5 for ; Thu, 7 Apr 2022 12:46:24 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 929AA6B0071; Thu, 7 Apr 2022 08:46:13 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 8B2186B0073; Thu, 7 Apr 2022 08:46:13 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 705176B0074; Thu, 7 Apr 2022 08:46:13 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0048.hostedemail.com [216.40.44.48]) by kanga.kvack.org (Postfix) with ESMTP id 5FEA86B0071 for ; Thu, 7 Apr 2022 08:46:13 -0400 (EDT) Received: from smtpin23.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 16AF6183EE78F for ; Thu, 7 Apr 2022 12:46:03 +0000 (UTC) X-FDA: 79330055406.23.1AECF14 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf31.hostedemail.com (Postfix) with ESMTP id 773A920009 for ; Thu, 7 Apr 2022 12:46:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1649335561; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=9/Us2cruhioCbl6RqJqudnxQAOhVEhkUDGtI39MXnNI=; b=M6p7sicFM3xDGLQF7R+hn+Njj6DxM/8nBwAX4jPYW54e+5yQJsFWt5teyRTbhrSkGY6rrx p6puSVgsk0S7IBLZdG8+3wRYaMgC7lnTp4L4xqTBKXFJ78iRocmiB2bNdnMNZjB+njcgYW FLITsR2PPkikm5K1H3xqPD9XBaRtBPg= Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-612-DT08GNk2P3mZSCsF3OjWLg-1; Thu, 07 Apr 2022 08:46:00 -0400 X-MC-Unique: DT08GNk2P3mZSCsF3OjWLg-1 Received: by mail-wm1-f70.google.com with SMTP id t2-20020a7bc3c2000000b003528fe59cb9so2923739wmj.5 for ; Thu, 07 Apr 2022 05:46:00 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:cc:references:from:organization:in-reply-to :content-transfer-encoding; bh=9/Us2cruhioCbl6RqJqudnxQAOhVEhkUDGtI39MXnNI=; b=zjqIY8haFT43HS70OKIP+U9dd1W0S9/kgITQDW/zPSmSP+AoSVuBYt2Q7CP+KWe2Kp 0CkjFbMW95ZllwHZK+pGwilGZh7ODSXIOZ3smHUhLl3lMsQPqEGgyP7S17DvVQab26P3 nYKvfdCJ7NOtnTgxKoEiKlTdfBEVnQ9xjfqnCeG/258a0R/lS/Hd6lM13RUUjBLuksp1 YEZW02gxKx0rhhc8NCq4EgdC8HOxS7Y81GPnvPP+qwZYcLLOQtT88mBLUDACVQisxSV0 WuohK81gQodOBMxttyL5L48aEtxo+PGZ81iZdLONJvvhuNDeKAGr+0VuR5yBbJh62xhb WaaQ== X-Gm-Message-State: AOAM5327HgzuVLyNwenEnDRPwE4hytUuhWIE2x3aURkzc0QNf5aipOcR zYwRGy2lLwM0Bhh9eXHEa8Pli7qvrpqE5dax6lvIcrRlNXQD+NQaReEJTI0ieakrzRRg55Olnc/ aQ3jjgW+BWZE= X-Received: by 2002:adf:f6c4:0:b0:206:1581:dabc with SMTP id y4-20020adff6c4000000b002061581dabcmr10825216wrp.375.1649335559572; Thu, 07 Apr 2022 05:45:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyM1kHX4+XtYoFq61dk62qQKc+KfdCBkhZ/B4Cy+Xlwxk5a3SuVrXH/rmpX3u/AmPLQfe4l7w== X-Received: by 2002:adf:f6c4:0:b0:206:1581:dabc with SMTP id y4-20020adff6c4000000b002061581dabcmr10825196wrp.375.1649335559301; Thu, 07 Apr 2022 05:45:59 -0700 (PDT) Received: from ?IPV6:2a09:80c0:192:0:20af:34be:985b:b6c8? ([2a09:80c0:192:0:20af:34be:985b:b6c8]) by smtp.gmail.com with ESMTPSA id p5-20020adff205000000b0020614a499fbsm13364584wro.90.2022.04.07.05.45.58 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 07 Apr 2022 05:45:58 -0700 (PDT) Message-ID: <42046fe0-d4da-625d-6412-b5459b80ee11@redhat.com> Date: Thu, 7 Apr 2022 14:45:57 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.6.2 Subject: Re: [PATCH v2] mm, page_alloc: fix build_zonerefs_node() To: Juergen Gross , xen-devel@lists.xenproject.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: Andrew Morton , stable@vger.kernel.org, =?UTF-8?Q?Marek_Marczykowski-G=c3=b3recki?= , Michal Hocko References: <20220407120637.9035-1-jgross@suse.com> From: David Hildenbrand Organization: Red Hat In-Reply-To: <20220407120637.9035-1-jgross@suse.com> X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8 X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: 773A920009 X-Stat-Signature: ekpxk9dtcar6sccgwfdfhyyqtrzfnhbg Authentication-Results: imf31.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=M6p7sicF; dmarc=pass (policy=none) header.from=redhat.com; spf=none (imf31.hostedemail.com: domain of david@redhat.com has no SPF policy when checking 170.10.133.124) smtp.mailfrom=david@redhat.com X-Rspam-User: X-HE-Tag: 1649335562-759676 Content-Transfer-Encoding: quoted-printable 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 07.04.22 14:06, Juergen Gross wrote: > Since commit 6aa303defb74 ("mm, vmscan: only allocate and reclaim from > zones with pages managed by the buddy allocator") 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 when zonelists are being > rebuilt. >=20 > The decision whether to rebuild the zonelists when onlining new memory > is done based on populated_zone() returning 0 for the zone the memory > will be added to. The new zone is added to the zonelists only, if it > has free memory pages (managed_zone() returns a non-zero value) after > the memory has been onlined. This implies, that onlining memory will > always free the added pages to the allocator immediately, but this is > not true in all cases: when e.g. running as a Xen guest the onlined > new memory will be added only to the ballooned memory list, it will be > freed only when the guest is being ballooned up afterwards. >=20 > Another problem with using managed_zone() for the decision whether a > zone is being added to the zonelists is, that a zone with all memory > used will in fact be removed from all zonelists in case the zonelists > happen to be rebuilt. >=20 > Use populated_zone() when building a zonelist as it has been done > before that commit. >=20 > Cc: stable@vger.kernel.org > Fixes: 6aa303defb74 ("mm, vmscan: only allocate and reclaim from zones = with pages managed by the buddy allocator") > Reported-by: Marek Marczykowski-G=C3=B3recki > Signed-off-by: Juergen Gross > Acked-by: Michal Hocko > --- > V2: > - updated commit message (Michal Hocko) > --- > mm/page_alloc.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) >=20 > 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 =3D 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); > } Did you drop my Ack? Also, I'd appreciate getting CCed on patches where I commented. --=20 Thanks, David / dhildenb