* [PATCH 1/2] mm/vmscan: filter empty page_list at the beginning
@ 2022-04-29 1:44 Wei Yang
2022-04-29 1:44 ` [PATCH 2/2] mm/vmscan: not use NUMA_NO_NODE as indicator of page on different node Wei Yang
0 siblings, 1 reply; 2+ messages in thread
From: Wei Yang @ 2022-04-29 1:44 UTC (permalink / raw)
To: akpm; +Cc: linux-mm, Wei Yang
node_page_list would always be !empty on finishing the loop, except
page_list is empty.
Let's handle empty page_list before doing any real work including
touching PF_MEMALLOC flag.
Signed-off-by: Wei Yang <richard.weiyang@gmail.com>
---
mm/vmscan.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/mm/vmscan.c b/mm/vmscan.c
index a7ca3916e2ea..085982d53a32 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -2549,9 +2549,12 @@ unsigned long reclaim_pages(struct list_head *page_list)
struct page *page;
unsigned int noreclaim_flag;
+ if (list_empty(page_list))
+ return nr_reclaimed;
+
noreclaim_flag = memalloc_noreclaim_save();
- while (!list_empty(page_list)) {
+ do {
page = lru_to_page(page_list);
if (nid == NUMA_NO_NODE)
nid = page_to_nid(page);
@@ -2564,10 +2567,9 @@ unsigned long reclaim_pages(struct list_head *page_list)
nr_reclaimed += reclaim_page_list(&node_page_list, NODE_DATA(nid));
nid = NUMA_NO_NODE;
- }
+ } while (!list_empty(page_list));
- if (!list_empty(&node_page_list))
- nr_reclaimed += reclaim_page_list(&node_page_list, NODE_DATA(nid));
+ nr_reclaimed += reclaim_page_list(&node_page_list, NODE_DATA(nid));
memalloc_noreclaim_restore(noreclaim_flag);
--
2.33.1
^ permalink raw reply [flat|nested] 2+ messages in thread
* [PATCH 2/2] mm/vmscan: not use NUMA_NO_NODE as indicator of page on different node
2022-04-29 1:44 [PATCH 1/2] mm/vmscan: filter empty page_list at the beginning Wei Yang
@ 2022-04-29 1:44 ` Wei Yang
0 siblings, 0 replies; 2+ messages in thread
From: Wei Yang @ 2022-04-29 1:44 UTC (permalink / raw)
To: akpm; +Cc: linux-mm, Wei Yang
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 <richard.weiyang@gmail.com>
---
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));
--
2.33.1
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-04-29 1:44 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-29 1:44 [PATCH 1/2] mm/vmscan: filter empty page_list at the beginning Wei Yang
2022-04-29 1:44 ` [PATCH 2/2] mm/vmscan: not use NUMA_NO_NODE as indicator of page on different node Wei Yang
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox