From: Hugh Dickins <[email protected]> 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 <[email protected]> Signed-off-by: Alex Shi <[email protected]> Cc: Andrew Morton <[email protected]> Cc: Johannes Weiner <[email protected]> Cc: Michal Hocko <[email protected]> Cc: Vladimir Davydov <[email protected]> Cc: [email protected] Cc: [email protected] Cc: [email protected] --- 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

