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 <alex.shi@xxxxxxxxxxxxxxxxx> Cc: Johannes Weiner <hannes@xxxxxxxxxxx> Cc: Michal Hocko <mhocko@xxxxxxxxxx> Cc: Vladimir Davydov <vdavydov.dev@xxxxxxxxx> Cc: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> Cc: cgroups@xxxxxxxxxxxxxxx Cc: linux-mm@xxxxxxxxx Cc: linux-kernel@xxxxxxxxxxxxxxx --- 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