Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp924911pxb; Wed, 6 Apr 2022 04:27:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwIS2qcSiddPWcBoWBasN4aSPGj+Z4LQ1RGpUf7pahZpfJWE70H/XgaCiE4DSJEVGLBFP9r X-Received: by 2002:a17:902:e84f:b0:153:fedf:519 with SMTP id t15-20020a170902e84f00b00153fedf0519mr8116056plg.153.1649244443480; Wed, 06 Apr 2022 04:27:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649244443; cv=none; d=google.com; s=arc-20160816; b=mOw0vfLsVApSaFrPnOL92wQtd/eQi4cBavwohhqr8I3z5ZJfn/xGgy5V8HuaZ+Tv5t +CiN2rlymFiIyDTLEDJ8d5pFr0qD9mruFF3ZkHPZScVXlfungyUre8UXdL3KQNKCBS9m JXd/b4+ncTy+Rcyafeg53L+D/3LLTrAB92w/BZ4PSlTFEgfTXrXviHJL3NePj5Vihiym Vy1C8d6EQh1kUD0/Zod7hrPJOEK9Whh9W/s6rL0/0/I+DP1CutVwWDEM4NjPuXxdenXG o966jRO9XKt1koeLo8wYwt0gx0wFQ/ypwBBj4hPlA5llzmZSxSDK+zcsdtktfqQhBlob pUuQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature:dkim-signature; bh=qXZaguQgzHHMZTiLw5gbfQ9kh4XyH0tzaiUaS6uMhFw=; b=I9alPOYQnDLc3XeXvJXLa8doSmpT0dnjlOHbB1q+//cSkwzbaxci/pAitTCjqLgtPg hgDsr1hkDGxptfYB95oxtpL7zpL2jLdRbJC9eBTrw7gRNBIUyDUW3OtfvTR2NEh/2g7n PL/ZpLmft9zClpr8o7k720ZnToKNLAWVcYYQCEaKXVhaKrvz51dG+I2VdCAi9ZUIN0/z l5ptrcAyNQP5yIZXPmfcARusBftt7Yy5RF61OSxeXq2h8pQmzlYjuFFdWR8LeipgYCYz uUJHZDw4pCbuupdYCKm51QJ/JZi//d3Nk9vLyQB7UJqry6aRNCPM1COmVZW7SKza9isj icYA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=P1Niw4x7; dkim=neutral (no key) header.i=@suse.cz; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id f2-20020a63e302000000b00384330ef3c2si15233653pgh.210.2022.04.06.04.27.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Apr 2022 04:27:23 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=P1Niw4x7; dkim=neutral (no key) header.i=@suse.cz; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id A130C4E2CAF; Wed, 6 Apr 2022 02:49:54 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1836539AbiDFAge (ORCPT + 99 others); Tue, 5 Apr 2022 20:36:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35116 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1572876AbiDERNN (ORCPT ); Tue, 5 Apr 2022 13:13:13 -0400 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2CA1E32989 for ; Tue, 5 Apr 2022 10:11:14 -0700 (PDT) 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 BEE1D210FD; Tue, 5 Apr 2022 17:11:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1649178672; 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: in-reply-to:in-reply-to:references:references; bh=qXZaguQgzHHMZTiLw5gbfQ9kh4XyH0tzaiUaS6uMhFw=; b=P1Niw4x7r4HvoVhVpJmYRniTerVWGNQa6wUn7Ui1YBWr3GPrTv/DDxtfkvC2CYjhu4hPwt vRo+RBTSUTI2wSww9e+aNNtAJDjdZK/C+6YaX98Vj07u/ft/IbH09AI6kOOthu2Z+1MU0T FXIgvSyFmpbK4wYkorchJoof5s0UgxM= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1649178672; 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: in-reply-to:in-reply-to:references:references; bh=qXZaguQgzHHMZTiLw5gbfQ9kh4XyH0tzaiUaS6uMhFw=; b=1mPAQK/8Tc5VWkJTuIOTeqpAAr7YKV2IrbOKQ8iV5kuhxX8JwS1ELK4F58khGigxtSLgop AGReuck+EL/60AAQ== 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 AB5D113A04; Tue, 5 Apr 2022 17:11:12 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id AY4eKTB4TGK7HwAAMHmgww (envelope-from ); Tue, 05 Apr 2022 17:11:12 +0000 Message-ID: Date: Tue, 5 Apr 2022 19:11:12 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.7.0 Subject: Re: [PATCH 1/2] mm/page_alloc: add same penalty is enough to get round-robin order Content-Language: en-US To: Wei Yang , akpm@linux-foundation.org Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org References: <20220123013537.20491-1-richard.weiyang@gmail.com> From: Vlastimil Babka In-Reply-To: <20220123013537.20491-1-richard.weiyang@gmail.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-4.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,NICE_REPLY_A,RDNS_NONE,SPF_HELO_NONE, T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 1/23/22 02:35, Wei Yang wrote: > To make node order in round-robin in the same distance group, we add a > penalty to the first node we got in each round. > > To get a round-robin order in the same distance group, we don't need to > decrease the penalty since: > > * find_next_best_node() always iterates node in the same order > * distance matters more then penalty in find_next_best_node() > * in nodes with the same distance, the first one would be picked up > > So it is fine to increase same penalty when we get the first node in the > same distance group. With that logic I'm not even sure if we need nr_online_nodes as penalty or it could be just 1. Would you know? > > Signed-off-by: Wei Yang > --- > mm/page_alloc.c | 6 ++---- > 1 file changed, 2 insertions(+), 4 deletions(-) > > diff --git a/mm/page_alloc.c b/mm/page_alloc.c > index c5952749ad40..f27afd517652 100644 > --- a/mm/page_alloc.c > +++ b/mm/page_alloc.c > @@ -6245,13 +6245,12 @@ static void build_thisnode_zonelists(pg_data_t *pgdat) > static void build_zonelists(pg_data_t *pgdat) > { > static int node_order[MAX_NUMNODES]; > - int node, load, nr_nodes = 0; > + int node, nr_nodes = 0; > nodemask_t used_mask = NODE_MASK_NONE; > int local_node, prev_node; > > /* NUMA-aware ordering of nodes */ > local_node = pgdat->node_id; > - load = nr_online_nodes; > prev_node = local_node; > > memset(node_order, 0, sizeof(node_order)); > @@ -6263,11 +6262,10 @@ static void build_zonelists(pg_data_t *pgdat) > */ > if (node_distance(local_node, node) != > node_distance(local_node, prev_node)) > - node_load[node] += load; > + node_load[node] += nr_online_nodes; > > node_order[nr_nodes++] = node; > prev_node = node; > - load--; > } > > build_zonelists_in_node_order(pgdat, node_order, nr_nodes);