2020-03-02 11:04:23

by Alex Shi

[permalink] [raw]
Subject: [PATCH v9 11/20] mm/memcg: move SetPageLRU out of lru_lock in commit_charge

Since lru lock doesn't defense PageLRU anymore, move the setting out of
lock may save a bit lock contention time.

Signed-off-by: Alex Shi <[email protected]>
Cc: Johannes Weiner <[email protected]>
Cc: Michal Hocko <[email protected]>
Cc: Vladimir Davydov <[email protected]>
Cc: Andrew Morton <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
---
mm/memcontrol.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index f8419f3436a8..7d7b861a948c 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -2614,9 +2614,9 @@ static void commit_charge(struct page *page, struct mem_cgroup *memcg,
lruvec = mem_cgroup_page_lruvec(page, pgdat);

VM_BUG_ON_PAGE(PageLRU(page), page);
- SetPageLRU(page);
add_page_to_lru_list(page, lruvec, page_lru(page));
spin_unlock_irq(&pgdat->lru_lock);
+ SetPageLRU(page);
}
}

--
1.8.3.1