lkml.org 
[lkml]   [2020]   [Sep]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v3 4/4] mm: convert page kmemcg type to a page memcg flag
On Tue, Sep 29, 2020 at 04:59:20PM -0700, Roman Gushchin wrote:
> @@ -3087,7 +3087,7 @@ int __memcg_kmem_charge_page(struct page *page, gfp_t gfp, int order)
> ret = __memcg_kmem_charge(memcg, gfp, 1 << order);
> if (!ret) {
> set_page_memcg(page, memcg);
> - __SetPageKmemcg(page);
> + __SetPageMemcgKmem(page);
> return 0;
> }
> css_put(&memcg->css);
> @@ -3112,10 +3112,6 @@ void __memcg_kmem_uncharge_page(struct page *page, int order)
> __memcg_kmem_uncharge(memcg, nr_pages);
> clear_page_memcg(page);
> css_put(&memcg->css);
> -
> - /* slab pages do not have PageKmemcg flag set */
> - if (PageKmemcg(page))
> - __ClearPageKmemcg(page);

Hm, the named flags are great, and the getter functions are complex
enough to justify helpers.

But both flags are set along with the object pointer, and cleared when
the pointer is cleared (which makes sense, because pages can not
change their type while they're alive). page_clear_memcg() and
page_clear_objcgs() do the same thing.

page->memcg_data = (unsigned long)pointer | MEMCG_DATA_TYPE;

and

page->memcg_data = 0;

are straight-forward and really don't require abstraction. Please
open-code these.

\
 
 \ /
  Last update: 2020-09-30 23:03    [W:0.063 / U:1.180 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site