Re: [REF PATCH v3 2/2] mm/slab: decouple the SLAB_OBJ_EXT from MEMCG

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On 7/12/24 3:27 PM, Vlastimil Babka wrote:
>> I checked the history of slab for this part. It introduced
>> from commit 10befea91b61c ("mm: memcg/slab: use a single set of kmem_caches for all allocations")
>> But still don't know why !page_has_obj_cgroups followed by memcg_alloc_page_obj_cgroups. Anyone like
>> to give a hints?
>>
>>                         page = virt_to_head_page(p[i]);
>> +
>> +                       if (!page_has_obj_cgroups(page) &&
>> +                           memcg_alloc_page_obj_cgroups(page, s, flags)) {
>> +                               obj_cgroup_uncharge(objcg, obj_full_size(s));
>> +                               continue;
>> +                       }
> I'm not sure I understand your question. The code is trying to charge the
> allocation to a memcg and use the objext.memcg to associate that memcg to
> the object so it can be properly uncharged when freeing.
> When it's the first object in the particular slab page to be charged, the
> objext may not be yet allocated, so it has has to be allocated at that point.

I see. Thanks for explanation!




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux