From patchwork Fri Apr 29 01:44:26 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Yang X-Patchwork-Id: 12831406 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 5539AC433EF for ; Fri, 29 Apr 2022 01:44:38 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C28AF6B0074; Thu, 28 Apr 2022 21:44:37 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id B61286B0075; Thu, 28 Apr 2022 21:44:37 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9DA826B0078; Thu, 28 Apr 2022 21:44:37 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (relay.a.hostedemail.com [64.99.140.24]) by kanga.kvack.org (Postfix) with ESMTP id 8D0136B0074 for ; Thu, 28 Apr 2022 21:44:37 -0400 (EDT) Received: from smtpin07.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 5D1DE270B4 for ; Fri, 29 Apr 2022 01:44:37 +0000 (UTC) X-FDA: 79408222194.07.987ED99 Received: from mail-ed1-f44.google.com (mail-ed1-f44.google.com [209.85.208.44]) by imf07.hostedemail.com (Postfix) with ESMTP id 61B9740002 for ; Fri, 29 Apr 2022 01:44:34 +0000 (UTC) Received: by mail-ed1-f44.google.com with SMTP id be20so7424374edb.12 for ; Thu, 28 Apr 2022 18:44:36 -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=+avWVkUZVmhlSlBLUHwLumdWUsDPdQaIXmA5/dzPdCg=; b=KuQRQdP0IUjAG15MToInzk2ghm7ttKjTUo9eB8EcbQxPgl3GlRN6oeE3cEo8lHrJuk 3imq7fNzA9oiUtjiUYQamZ/AvP87WE3e5t4XDrtyweiBSH6xqSjy2JvtjhqjOkcUcmNM D7ueVu6JYZXSmpdGu6m748uJ5jH5D+oH02/f8LrJOJ4CR5OEG+sQKVM+BeJLNpwWZTAm iNPT5waL/7z4QZ8AmFAFYz6RPBN+c/Q9mW//ce+T8grYgSlhvFZXlsb1Fk+zNKgUmDkW NxnQFACFaMlm/rEZPMdLiqhZHm95Hyf/xkyZbpPHnClPS+S6QGJu/rUfn6Brch3f1sgf pECA== 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=+avWVkUZVmhlSlBLUHwLumdWUsDPdQaIXmA5/dzPdCg=; b=lL6+gGWRCS1bNpMvTPKsYJ+lx3m4dz9oHPaSBJe2DzU97t7OZOiFkE0UKWd84hRq7b zF//EW1TETRXsEt7psJK93KhaOPZEL7OVHlVz2z+y7GMC6WU8DgBTDkaLVUATqWkkG0x eLSYOZfOrqgx3VeinLR2yDY+h1+FWZiolCaK+oQ8QCX4LfMaI+jua6reBOo4euAjY5iS zwS0w4ydv47pN60EQ5MNOG0oXonXfIS3xEex/uP/JDcQ/XCkbhEBWu2Q4C6injaQAzUQ iMuIeCbSvgCcjefslW0i53UvHEQS2D3zDZJznIp87J2i/JXX5A7pwmCHxf+yzdgZ/WFE FsBw== X-Gm-Message-State: AOAM533wgrMDyzVWJii6eGokRs5yInJCgTYTu/SwnoRArHmv2U82bteM smvZ5/Ogakp1muX5/ijTvuPWPAoatGA= X-Google-Smtp-Source: ABdhPJwSEok8YFahrTU6TQoMpFUlu61m3WiW2MfdU8A2eZ4rd66ORwyCFD90SI5hWxjtirTPdqHDTg== X-Received: by 2002:a50:d79a:0:b0:425:e577:c71a with SMTP id w26-20020a50d79a000000b00425e577c71amr25314373edi.188.1651196675846; Thu, 28 Apr 2022 18:44:35 -0700 (PDT) Received: from localhost ([185.92.221.13]) by smtp.gmail.com with ESMTPSA id dq10-20020a170907734a00b006f3ef214de9sm186114ejc.79.2022.04.28.18.44.35 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 28 Apr 2022 18:44:35 -0700 (PDT) From: Wei Yang To: akpm@linux-foundation.org Cc: linux-mm@kvack.org, Wei Yang Subject: [PATCH 2/2] mm/vmscan: not use NUMA_NO_NODE as indicator of page on different node Date: Fri, 29 Apr 2022 01:44:26 +0000 Message-Id: <20220429014426.29223-2-richard.weiyang@gmail.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20220429014426.29223-1-richard.weiyang@gmail.com> References: <20220429014426.29223-1-richard.weiyang@gmail.com> X-Stat-Signature: 349b7p13qn81z4gdgksicx6q5csqkogu X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: 61B9740002 Authentication-Results: imf07.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=KuQRQdP0; spf=pass (imf07.hostedemail.com: domain of richard.weiyang@gmail.com designates 209.85.208.44 as permitted sender) smtp.mailfrom=richard.weiyang@gmail.com; dmarc=pass (policy=none) header.from=gmail.com X-Rspam-User: X-HE-Tag: 1651196674-48320 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 | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/mm/vmscan.c b/mm/vmscan.c index 085982d53a32..0c502dc42222 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -2543,7 +2543,7 @@ static unsigned int reclaim_page_list(struct list_head *page_list, 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 page *page; @@ -2554,10 +2554,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); @@ -2566,7 +2565,7 @@ unsigned long reclaim_pages(struct list_head *page_list) } nr_reclaimed += reclaim_page_list(&node_page_list, NODE_DATA(nid)); - nid = NUMA_NO_NODE; + nid = page_to_nid(lru_to_page(page_list)); } while (!list_empty(page_list)); nr_reclaimed += reclaim_page_list(&node_page_list, NODE_DATA(nid));