lkml.org 
[lkml]   [2020]   [Aug]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH v18 12/32] mm/memcg: optimize mem_cgroup_page_lruvec
Date
From: Hugh Dickins <hughd@google.com>

Add READ_ONCE on page->mem_cgroup, since we will check it later.
Also the page should not be PageTail(page), so add a check.

Signed-off-by: Hugh Dickins <hughd@google.com>
Signed-off-by: Alex Shi <alex.shi@linux.alibaba.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Michal Hocko <mhocko@kernel.org>
Cc: Vladimir Davydov <vdavydov.dev@gmail.com>
Cc: linux-kernel@vger.kernel.org
Cc: linux-mm@kvack.org
Cc: cgroups@vger.kernel.org
---
mm/memcontrol.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index 505f54087e82..65c1e873153e 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -1321,7 +1321,8 @@ struct lruvec *mem_cgroup_page_lruvec(struct page *page, struct pglist_data *pgd
goto out;
}

- memcg = page->mem_cgroup;
+ VM_BUG_ON_PAGE(PageTail(page), page);
+ memcg = READ_ONCE(page->mem_cgroup);
/* Readahead page is charged too, to see if other page uncharged */
VM_WARN_ON_ONCE_PAGE(!memcg, page);
if (!memcg)
--
1.8.3.1
\
 
 \ /
  Last update: 2020-08-24 14:55    [W:0.197 / U:0.892 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site