summaryrefslogtreecommitdiff
path: root/mm/vmscan.c
diff options
context:
space:
mode:
authorWei Yang <richard.weiyang@gmail.com>2022-05-12 20:23:00 -0700
committerAndrew Morton <akpm@linux-foundation.org>2022-05-13 07:20:14 -0700
commited657e5568c5fc877c517b654d65fbdaeb628539 (patch)
tree8c8f21e931e80a05b80e85d7af8f547f37d57adb /mm/vmscan.c
parent1ae65e2749b0a3d236fc17d0eca5ea5f6f2c0032 (diff)
mm/vmscan: don't use NUMA_NO_NODE as indicator of page on different node
Now we are sure there is at least 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. Link: https://lkml.kernel.org/r/20220429014426.29223-2-richard.weiyang@gmail.com Signed-off-by: Wei Yang <richard.weiyang@gmail.com> Reviewed-by: Andrew Morton <akpm@linux-foundation.org> Cc: Minchan Kim <minchan@kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Diffstat (limited to 'mm/vmscan.c')
-rw-r--r--mm/vmscan.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/mm/vmscan.c b/mm/vmscan.c
index 43883ff89c1a..9cfce1449af4 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -2562,7 +2562,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;
@@ -2573,10 +2573,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);
@@ -2585,7 +2584,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));