[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <560c58be-4741-49c3-b47b-b154f564d148@gmail.com>
Date: Tue, 2 Jul 2024 10:39:09 +0800
From: Alex Shi <seakeel@...il.com>
To: Yosry Ahmed <yosryahmed@...gle.com>
Cc: Hyeonggon Yoo <42.hyeyoo@...il.com>, alexs@...nel.org,
Vitaly Wool <vitaly.wool@...sulko.com>, Miaohe Lin <linmiaohe@...wei.com>,
Andrew Morton <akpm@...ux-foundation.org>, linux-kernel@...r.kernel.org,
linux-mm@...ck.org, minchan@...nel.org, willy@...radead.org,
senozhatsky@...omium.org, david@...hat.com
Subject: Re: [PATCH 01/20] mm/zsmalloc: add zpdesc memory descriptor for
zswap.zpool
On 7/1/24 9:42 PM, Yosry Ahmed wrote:
> [..]
>>>> + union {
>>>> + /* Next zpdescs in a zspage in zsmalloc zpool */
>>>> + struct zpdesc *next;
>>>> + /* For huge zspage in zsmalloc zpool */
>>>> + unsigned long handle;
>>>> + };
>>>> + struct zspage *zspage;
>>>
>>> There was a discussion with Yosry on including memcg_data on zpdesc
>>> even if it's not used at the moment.
>>>
>>> Maybe you can look at:
>>> https://lore.kernel.org/linux-mm/CAB=+i9Quz9iP2-Lq=oQfKVVnzPDtOaKMm=hUPbnRg5hRxH+qaA@mail.gmail.com/
>>
>> Thanks for notice.
>> The memcg_data isn't used for zpdesc. And I have a bit confusion since Yosry said: "I think to drop memcg_data we need to enlighten the code that ...". So we actually don't need to have this unused member, is this right, Yosry?
>
> I think we need to have it, at least for now. When the pages are
> freed, put_page() -> folio_put() -> __folio_put() will call
> mem_cgroup_uncharge(). The latter will call folio_memcg() (which reads
> folio->memcg_data) to figure out if uncharging needs to be done.
>
> There are also other similar code paths that will check
> folio->memcg_data. It is currently expected to be present for all
> folios. So until we have custom code paths per-folio type for
> allocation/freeing/etc, we need to keep folio->memcg_data present and
> properly initialized.
Hi Yosry,
Many thanks for detailed comments and requirements!
I'm going to add this member in next version, maybe tomorrow, unless there are more comments for this patchset. :)
Thank a lot!
Alex
Powered by blists - more mailing lists