Re: [PATCH] memcg: remove unused mem_cgroup_from_obj()

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

 




> On May 28, 2023, at 02:54, Yosry Ahmed <yosryahmed@xxxxxxxxxx> wrote:
> 
> On Sat, May 27, 2023 at 8:07 AM Matthew Wilcox <willy@xxxxxxxxxxxxx> wrote:
>> 
>> On Fri, May 26, 2023 at 09:13:05PM -0700, Yosry Ahmed wrote:
>>> On Fri, May 26, 2023 at 9:01 PM Matthew Wilcox <willy@xxxxxxxxxxxxx> wrote:
>>>> 
>>>> On Sat, May 27, 2023 at 06:31:26PM +0800, Miaohe Lin wrote:
>>>>> The function mem_cgroup_from_obj() is not used anymore. Remove it and
>>>>> clean up relevant comments.
>>>> 
>>>> You should have looked at the git history to see why it was created
>>>> and who used it.
>>>> 
>>>> Shakeel, Vasily, are you going to retry adding commit 1d0403d20f6c?
>>> 
>>> That commit did not introduce the function though, no? It was
>>> introduced before it and replaced by other variants over time (like
>>> mem_cgroup_from_slab_obj()). It looks like that commit was reverted ~9
>>> months ago. We can always bring it back if/when needed.
>> 
>> The commit immediately preceding it is fc4db90fe71e.
>> 
>> Of course we can bring it back.  It's just code.  But avoiding
>> unnecessary churn is also good.  Let's wait to hear from Vasily.
>> 
>>> It also looks to me that 1d0403d20f6c was using mem_cgroup_from_obj()
>>> on a struct net object, which is allocated in net_alloc() from a slab
>>> cache, so mem_cgroup_from_slab_obj() should be sufficient, no?
>> 
>> Clearly not.
> 
> I dived deeper into the history on LKML, and you are right:
> https://lore.kernel.org/all/Yp4F6n2Ie32re7Ed@qian/
> 
> I still do not understand why mem_cgroup_from_slab_obj() would not be
> sufficient, so I am hoping Vasily or Shakeel can help me understand
> here. Seems to be something arch-specific.

I think it is because *init_net* which is not allocated from slab meant
its address does not belong to linear mapping addresses on arm64. However,
virt_to_page() is only applicable to linear mapping addresses. So,
mem_cgroup_from_slab_obj() is not sufficient. mem_cgroup_from_obj() is used
in this case, which will use vmalloc_to_page() for the page associated
with *init_net*. If Vasily does not want to bring commit 1d0403d20f6c back,
this patch LGTM. Otherwise, let's wait for Vasily.

Thanks.






[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