Re: [PATCH] fs: buffer: use raw page_memcg() on locked page
From: Roman Gushchin <hidden>
Date: 2021-02-09 23:29:35
Also in:
linux-mm, lkml
From: Roman Gushchin <hidden>
Date: 2021-02-09 23:29:35
Also in:
linux-mm, lkml
On Tue, Feb 09, 2021 at 02:01:26PM -0500, Johannes Weiner wrote:
alloc_page_buffers() currently uses get_mem_cgroup_from_page() for charging the buffers to the page owner, which does an rcu-protected page->memcg lookup and acquires a reference. But buffer allocation has the page lock held throughout, which pins the page to the memcg and thereby the memcg - neither rcu nor holding an extra reference during the allocation are necessary. Use a raw page_memcg() instead. This was the last user of get_mem_cgroup_from_page(), delete it. Reported-by: Muchun Song <redacted> Signed-off-by: Johannes Weiner <redacted>
Acked-by: Roman Gushchin <redacted> Thanks!