From patchwork Fri Apr 8 02:59:46 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Yang X-Patchwork-Id: 12806002 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 51773C433F5 for ; Fri, 8 Apr 2022 03:00:03 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id BD4266B0074; Thu, 7 Apr 2022 23:00:02 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id B5B4B6B0075; Thu, 7 Apr 2022 23:00:02 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9D6638D0001; Thu, 7 Apr 2022 23:00:02 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (relay.hostedemail.com [64.99.140.25]) by kanga.kvack.org (Postfix) with ESMTP id 8920B6B0074 for ; Thu, 7 Apr 2022 23:00:02 -0400 (EDT) Received: from smtpin18.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay13.hostedemail.com (Postfix) with ESMTP id 5FA3B6039F for ; Fri, 8 Apr 2022 03:00:02 +0000 (UTC) X-FDA: 79332207444.18.718DCDF Received: from mail-ej1-f47.google.com (mail-ej1-f47.google.com [209.85.218.47]) by imf26.hostedemail.com (Postfix) with ESMTP id EC2F3140003 for ; Fri, 8 Apr 2022 03:00:01 +0000 (UTC) Received: by mail-ej1-f47.google.com with SMTP id bh17so14606374ejb.8 for ; Thu, 07 Apr 2022 20:00:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id; bh=rPoHRDI/7XZAo2PfMvNVBHARTE5I0qTh+h+2rQwQG2A=; b=HoyESBwGfqmdH/+CPETMMlL+KAVCdTlmIPdmdaIefWABrqYDpSVRFQzAzfPX00ukVt 1T2EEKBI7fvbr/MJltE+mDhUnEeiFXHECws0EWs2wJWsibh7TTawsUF5cILaUXPX7xFV 5fSUTSf+BIXZOSgw/eNcw/64m9Jep4Qe59UjkgODWFCFXoTzKS/SJ1MKxuvus1lYpsUQ 8ryDdkpn+HgfYUBld4ksB0jtbHGnnAmTsboxW8PFlKmAbesa1EuKNQxPIP5qK0RPI01W LI4FGDW4uj2sy+tF2mOSHUK50Q35Y9KAO2s06Kp/n7BqabO2ge40dyXoxXZwcNVbKPPW N2aA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=rPoHRDI/7XZAo2PfMvNVBHARTE5I0qTh+h+2rQwQG2A=; b=1SOql0KeZRgVTcHY6OKP/rQND22ehmIxcgxNJdF92rvXWAfOkKsZDxpXzGXOEw4rnL 8yvlS5fiPKmzm8E0mLio2SUpXR/9fhh3bMhZM7goHZDty1dUjuekwzJTSe0Dqdcho7Mx Ev79btgENvD9+JS41XgmTIDfal0K9RGLAwGAJdzJd6xCdry7idq9Lw91kN/xWl7cCem/ MR65of78OMdTRlwVHU89XLtQZq4M2tZy1exYwOqxzoCXCJxPunu7sfJZCGZrMIrEB/l4 TZEbc2QALMLhUuzw6qPfuhZneOgiFePVkW4l2KjEj8v4p6g2OikN+Wpx3rXOsHrUmPMq Lzsw== X-Gm-Message-State: AOAM5336EZS1n/++jpLsj1vXvgxywWFfYER7HOkDhwDBAA9hp8T06Vor GKCanuEV3flC3qttF+YEH7g= X-Google-Smtp-Source: ABdhPJz9fSC3g2En5eqBOQW5e5Riou3PV7WhxXaiPEx0KioYmKi0hcsqhdX2PBsIv9mc7fPYLNsXDQ== X-Received: by 2002:a17:907:d13:b0:6e0:b799:8fcc with SMTP id gn19-20020a1709070d1300b006e0b7998fccmr16791354ejc.11.1649386800515; Thu, 07 Apr 2022 20:00:00 -0700 (PDT) Received: from localhost ([185.92.221.13]) by smtp.gmail.com with ESMTPSA id l26-20020a1709062a9a00b006e7ee7ad20bsm5504741eje.149.2022.04.07.19.59.59 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 07 Apr 2022 20:00:00 -0700 (PDT) From: Wei Yang To: akpm@linux-foundation.org Cc: linux-mm@kvack.org, Wei Yang , Vlastimil Babka , David Hildenbrand , Oscar Salvador Subject: [Patch v2 1/2] mm/page_alloc: add same penalty is enough to get round-robin order Date: Fri, 8 Apr 2022 02:59:46 +0000 Message-Id: <20220408025947.1619-1-richard.weiyang@gmail.com> X-Mailer: git-send-email 2.11.0 X-Stat-Signature: y558dtr5cb8g1hhgiaqgoexa5x1b4x33 X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: EC2F3140003 Authentication-Results: imf26.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=HoyESBwG; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf26.hostedemail.com: domain of richard.weiyang@gmail.com designates 209.85.218.47 as permitted sender) smtp.mailfrom=richard.weiyang@gmail.com X-Rspam-User: X-HE-Tag: 1649386801-442826 X-Bogosity: Ham, tests=bogofilter, spamicity=0.002095, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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. Signed-off-by: Wei Yang CC: Vlastimil Babka CC: David Hildenbrand CC: Oscar Salvador --- v2: adjust constant penalty to 1 --- 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 7ccd9aced0ca..86b6573fbeb5 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -6283,13 +6283,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)); @@ -6301,11 +6300,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] += 1; node_order[nr_nodes++] = node; prev_node = node; - load--; } build_zonelists_in_node_order(pgdat, node_order, nr_nodes);