Re: [PATCH v4 4/4] mm: convert page kmemcg type to a page memcg flag

2020-10-02 Thread Johannes Weiner
On Fri, Oct 02, 2020 at 12:03:50PM +0200, Michal Koutný wrote: > On Thu, Oct 01, 2020 at 01:27:13PM -0400, Johannes Weiner > wrote: > > I do think there is a bug, though: mem_cgroup_move_account() should > > use WRITE_ONCE() on page->mem_cgroup. > If this were a bug, wouldn't be the proper

Re: [PATCH v4 4/4] mm: convert page kmemcg type to a page memcg flag

2020-10-02 Thread Michal Koutný
On Thu, Oct 01, 2020 at 01:27:13PM -0400, Johannes Weiner wrote: > The activation code is the only path where page migration is not > excluded. Because unlike with page state statistics, we don't really > mind a race when counting an activation event. Thanks for the explanation. I see why the

Re: [PATCH v4 4/4] mm: convert page kmemcg type to a page memcg flag

2020-10-01 Thread Roman Gushchin
On Thu, Oct 01, 2020 at 07:00:36PM +0200, Michal Koutny wrote: > Hi. > > On Wed, Sep 30, 2020 at 05:27:10PM -0700, Roman Gushchin wrote: > > @@ -369,8 +371,12 @@ enum page_memcg_data_flags { > > */ > > static inline struct mem_cgroup *page_memcg(struct page *page) > > { > > + unsigned long

Re: [PATCH v4 4/4] mm: convert page kmemcg type to a page memcg flag

2020-10-01 Thread Johannes Weiner
On Thu, Oct 01, 2020 at 07:00:36PM +0200, Michal Koutný wrote: > Hi. > > On Wed, Sep 30, 2020 at 05:27:10PM -0700, Roman Gushchin wrote: > > @@ -369,8 +371,12 @@ enum page_memcg_data_flags { > > */ > > static inline struct mem_cgroup *page_memcg(struct page *page) > > { > > + unsigned long

Re: [PATCH v4 4/4] mm: convert page kmemcg type to a page memcg flag

2020-10-01 Thread Michal Koutný
Hi. On Wed, Sep 30, 2020 at 05:27:10PM -0700, Roman Gushchin wrote: > @@ -369,8 +371,12 @@ enum page_memcg_data_flags { > */ > static inline struct mem_cgroup *page_memcg(struct page *page) > { > + unsigned long memcg_data = page->memcg_data; > + > VM_BUG_ON_PAGE(PageSlab(page),

Re: [PATCH v4 4/4] mm: convert page kmemcg type to a page memcg flag

2020-10-01 Thread Johannes Weiner
On Wed, Sep 30, 2020 at 05:27:10PM -0700, Roman Gushchin wrote: > PageKmemcg flag is currently defined as a page type (like buddy, > offline, table and guard). Semantically it means that the page > was accounted as a kernel memory by the page allocator and has > to be uncharged on the release. >

[PATCH v4 4/4] mm: convert page kmemcg type to a page memcg flag

2020-09-30 Thread Roman Gushchin
PageKmemcg flag is currently defined as a page type (like buddy, offline, table and guard). Semantically it means that the page was accounted as a kernel memory by the page allocator and has to be uncharged on the release. As a side effect of defining the flag as a page type, the accounted page