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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 45AFBC433EF for ; Thu, 7 Apr 2022 12:12:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238785AbiDGMOq (ORCPT ); Thu, 7 Apr 2022 08:14:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43014 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238665AbiDGMOn (ORCPT ); Thu, 7 Apr 2022 08:14:43 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 787C61EC624 for ; Thu, 7 Apr 2022 05:12:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1649333562; 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=He8h+g9gcpriqclLdlbV5LzBn0WlLmTvUFHHwXaoICE=; b=GxmHoz3mvqVkuOjk50fkuE1bi4h4MZKOWFLKa8nWsAp4YZeFb+45Jq3XxZW8Ch4/bqxTCH NiSizmijzHDzMGDBd2VjGmFse/ElX8XZmscI9WhNXKHw3EiJQhL/mgoijBx40taApubI6I /svwLnGe2oH6OIOks9qZNBG3rOYe4mg= Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-614-fvGS0D6-O8moFqeOc5V4ag-1; Thu, 07 Apr 2022 08:12:41 -0400 X-MC-Unique: fvGS0D6-O8moFqeOc5V4ag-1 Received: by mail-wm1-f69.google.com with SMTP id n17-20020a05600c501100b0038e731cf5e1so2896590wmr.2 for ; Thu, 07 Apr 2022 05:12:40 -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=He8h+g9gcpriqclLdlbV5LzBn0WlLmTvUFHHwXaoICE=; b=5vbh5B/9U6ts6cEvrKqjmojVv0aNUR1PaJDzpMQvapE5/0Td4Wp4g5ejDx02CM3GW0 uwcUktR2dRGCRMbTeDia0y4+HoXmvu16KmG/C+eURmI/n5E1aYjGFAQ4prbpSriy32Bn hW4vJSTxvNrl+efQEX5pT4jnpCwscAALcZ/1yRqCwoP8zItRKwkJJKXFPkl3ESEe3g2L yMBb1CcogTaITzztyEkZ6IWP1q5kespdPUnvxWu3aI5rHgmwanIRcvmVhHNL+G9Ak5L6 aOCgSoYgZzn86U/8B0VyX//33CkeerQJZr2Aun2sJ6Jd+nZY/w6rn/JQti/ZyAjia8Sm CmnA== X-Gm-Message-State: AOAM530xIUwWfHMBpsQl4YdmgaudBpJX7RsJFOyXIbYw283pD7seUTA4 1LeKz85FAJ3Y5lsLHk5dD9as31RaWi0F1WCoXmBAZ9ZFlJniYoT4PJEGKNfFmuoy7iA2fAQl9Q7 rArobu0AVTBQjvOl500ZPlD+y X-Received: by 2002:a05:600c:4f08:b0:38c:93fd:570f with SMTP id l8-20020a05600c4f0800b0038c93fd570fmr12048356wmq.136.1649333559851; Thu, 07 Apr 2022 05:12:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx8VD2jmyYCLdT1LS37dFQHExBQz5m/CcSM2lhqIzro2UScARspuOQOmGyPtwzTU/phPmvvNw== X-Received: by 2002:a05:600c:4f08:b0:38c:93fd:570f with SMTP id l8-20020a05600c4f0800b0038c93fd570fmr12048327wmq.136.1649333559539; Thu, 07 Apr 2022 05:12:39 -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 b8-20020a05600c4e0800b0038c6c37efc3sm7370765wmq.12.2022.04.07.05.12.38 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 07 Apr 2022 05:12:38 -0700 (PDT) Message-ID: Date: Thu, 7 Apr 2022 14:12:38 +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] mm, page_alloc: fix build_zonerefs_node() Content-Language: en-US To: Michal Hocko Cc: Juergen Gross , xen-devel@lists.xenproject.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Andrew Morton , stable@vger.kernel.org, =?UTF-8?Q?Marek_Marczykowski-G=c3=b3recki?= , Mel Gorman References: <20220407093221.1090-1-jgross@suse.com> <5e97a7f5-1fc9-d0b4-006e-6894d5653c06@suse.com> <770d8283-4315-3d83-4f8b-723308fffe5c@redhat.com> From: David Hildenbrand Organization: Red Hat In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 07.04.22 14:04, Michal Hocko wrote: > On Thu 07-04-22 13:58:44, David Hildenbrand wrote: > [...] >>> diff --git a/mm/page_alloc.c b/mm/page_alloc.c >>> index 3589febc6d31..130a2feceddc 100644 >>> --- a/mm/page_alloc.c >>> +++ b/mm/page_alloc.c >>> @@ -6112,10 +6112,8 @@ 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)) { >>> - zoneref_set_zone(zone, &zonerefs[nr_zones++]); >>> - check_highest_zone(zone_type); >>> - } >>> + zoneref_set_zone(zone, &zonerefs[nr_zones++]); >>> + check_highest_zone(zone_type); >>> } while (zone_type); >>> >>> return nr_zones; >> >> I don't think having !populated zones in the zonelist is a particularly >> good idea. Populated vs !populated changes only during page >> onlininge/offlining. >> >> If I'm not wrong, with your patch we'd even include ZONE_DEVICE here ... > > What kind of problem that would cause? The allocator wouldn't see any > pages at all so it would fallback to the next one. Maybe kswapd would > need some tweak to have a bail out condition but as mentioned in the > thread already. !populated or !managed for that matter are not all that > much different from completely depleted zones. The fact that we are > making that distinction has led to some bugs and I suspect it makes the > code more complex without a very good reason. I assume performance problems. Assume you have an ordinary system with multiple NUMA nodes and no MOVABLE memory. Most nodes will only have ZONE_NORMAL. Yet, you'd include ZONE_DMA* and ZONE_MOVABLE that will always remain empty to be traversed on each and every allocation fallback. Of course, we could measure, but IMHO at least *that* part of memory onlining/offlining is not the complicated part :D Populated vs. !populated is under pretty good control via page onlining/offlining. We have to be careful with "managed pages", because that's a moving target, especially with memory ballooning. And I assume that's the bigger source of bugs. > >> I'd vote for going with the simple fix first, which should be good >> enough AFAIKT. > > yes, see the other reply > I think we were composing almost simultaneously :) -- Thanks, David / dhildenb