From patchwork Tue Apr 26 02:17:43 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Yang X-Patchwork-Id: 12826422 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 5B2ECC433EF for ; Tue, 26 Apr 2022 02:18:32 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 427B36B0075; Mon, 25 Apr 2022 22:18:30 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 363146B0078; Mon, 25 Apr 2022 22:18:30 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 18C356B007B; Mon, 25 Apr 2022 22:18:30 -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 06F4D6B0075 for ; Mon, 25 Apr 2022 22:18:30 -0400 (EDT) Received: from smtpin02.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id DE79921F3E for ; Tue, 26 Apr 2022 02:18:29 +0000 (UTC) X-FDA: 79397421138.02.5336A26 Received: from mail-ej1-f47.google.com (mail-ej1-f47.google.com [209.85.218.47]) by imf19.hostedemail.com (Postfix) with ESMTP id 08ADD1A0036 for ; Tue, 26 Apr 2022 02:18:25 +0000 (UTC) Received: by mail-ej1-f47.google.com with SMTP id gh6so9110297ejb.0 for ; Mon, 25 Apr 2022 19:18:29 -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:in-reply-to:references; bh=clHSgaZZ2YR0zIZFMmaUuVfrjHIK0ovVC2GMtpd+qEA=; b=QjF2GNrqmU7aV1ArZ847TPzGNZuylgkBHaPpk+zCV3LbCa25iSVCJYsZDqTUhc6w5p WKPMioHA9IH8z7JQF9SRnFTuyuSMU0VlG7QAOdIs1i8ykIW8w78faEW1E2RAgvTZ5c6N EJEcEdMe0G3JVRRwInUb69chY3QbfmsLI45QFzbz4CmGCu94pwJVLc1i4JVgEwFdChuz 8oj75I+5bPLXA1puPGDUQ5ST3xi6NCCAS7B8FtNIMqFlogGP8li/vP8zFQBVy6e34tLu 0+Mdoy6ISqs9eJ1gc1JTOT4iokpdDhEdF6DOZj51RTf53tPCTPWtSOPuTBsRfGsS+DqG vywg== 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:in-reply-to :references; bh=clHSgaZZ2YR0zIZFMmaUuVfrjHIK0ovVC2GMtpd+qEA=; b=HxNR/OPPXh+7168eorvAro9+kOL1lrFrJ/Wm1gtHvLxw6WYxBHezswYeJchib1ytBC HBLp16I64/OP2pNLDXifbknGWQnz4BPIPo/8PaNLUn6srxEQLhVU+4p1Qw3UrFMWrgx/ lEmvikSCDz+DOEjGTFMd9yjyPaBBCICoqmI3m6wZCAlKpxVZIm8QMUAV0rRHwugN0Nbh Mdl6MP1LrgCQMxMdu3fvUh3hqgi+Vvovw/yGiexjEzEaMvR7WFRF0Ka8Ma2yqx1rhRKj lsbwVBiENadrIllJEBje08msHBXDozg5OeJzYxp8oCkxw/n2A/PNrf/YgIiQKcS6EBxF +8uQ== X-Gm-Message-State: AOAM532Oxsml+XEAPClLmAZWu9cduYO4wfQBIb2yjNg0JMxBfwti0DLv x/IxjHtJ8YPoCSRlQ6BwyPc= X-Google-Smtp-Source: ABdhPJwRVNA3FjljoxIQEWKzL0zvRUWdcFbA6109kwwY8pYNmShdalyJgBvS0X55C/Xh91cRHLQfJQ== X-Received: by 2002:a17:907:6d11:b0:6f3:66a9:b57b with SMTP id sa17-20020a1709076d1100b006f366a9b57bmr12857347ejc.374.1650939508334; Mon, 25 Apr 2022 19:18:28 -0700 (PDT) Received: from localhost ([185.92.221.13]) by smtp.gmail.com with ESMTPSA id x24-20020a1709064bd800b006ef606fe5c1sm4185242ejv.43.2022.04.25.19.18.27 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 25 Apr 2022 19:18:28 -0700 (PDT) From: Wei Yang To: akpm@linux-foundation.org Cc: linux-mm@kvack.org, Wei Yang Subject: [PATCH 3/3] mm/vmscan: not use NUMA_NO_NODE as indicator of page on different node Date: Tue, 26 Apr 2022 02:17:43 +0000 Message-Id: <20220426021743.21007-3-richard.weiyang@gmail.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20220426021743.21007-1-richard.weiyang@gmail.com> References: <20220426021743.21007-1-richard.weiyang@gmail.com> X-Stat-Signature: 69papgxx3brqufujf6exstis4u1ysdnr X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: 08ADD1A0036 Authentication-Results: imf19.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=QjF2GNrq; spf=pass (imf19.hostedemail.com: domain of richard.weiyang@gmail.com designates 209.85.218.47 as permitted sender) smtp.mailfrom=richard.weiyang@gmail.com; dmarc=pass (policy=none) header.from=gmail.com X-Rspam-User: X-HE-Tag: 1650939505-309031 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: Now we are sure there is at lease one page on page_list, so it is safe to get the nid of it. This means it is not necessary to use NUMA_NO_NODE as an indicator for the beginning of iteration or a page on different node. Signed-off-by: Wei Yang --- mm/vmscan.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/mm/vmscan.c b/mm/vmscan.c index 3a36ebd6295d..f9998cba236f 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -2519,7 +2519,7 @@ static void shrink_active_list(unsigned long nr_to_scan, unsigned long reclaim_pages(struct list_head *page_list) { - int nid = NUMA_NO_NODE; + int nid; unsigned int nr_reclaimed = 0; LIST_HEAD(node_page_list); struct reclaim_stat dummy_stat; @@ -2538,11 +2538,9 @@ unsigned long reclaim_pages(struct list_head *page_list) noreclaim_flag = memalloc_noreclaim_save(); + nid = page_to_nid(lru_to_page(page_list)); do { page = lru_to_page(page_list); - if (nid == NUMA_NO_NODE) { - nid = page_to_nid(page); - } if (nid == page_to_nid(page)) { ClearPageActive(page); @@ -2559,7 +2557,7 @@ unsigned long reclaim_pages(struct list_head *page_list) putback_lru_page(page); } - nid = NUMA_NO_NODE; + nid = page_to_nid(lru_to_page(page_list)); } while (!list_empty(page_list)); nr_reclaimed += shrink_page_list(&node_page_list,