[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Z083CD441MML7zsi@casper.infradead.org>
Date: Tue, 3 Dec 2024 16:51:20 +0000
From: Matthew Wilcox <willy@...radead.org>
To: alexs@...nel.org
Cc: 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, senozhatsky@...omium.org, david@...hat.com,
42.hyeyoo@...il.com, Yosry Ahmed <yosryahmed@...gle.com>,
nphamcs@...il.com
Subject: Re: [PATCH v7 01/21] mm/zsmalloc: add zpdesc memory descriptor for
zswap.zpool
On Mon, Sep 02, 2024 at 03:21:12PM +0800, alexs@...nel.org wrote:
> And keep the memcg_data member, since as Yosry pointed out:
> "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.
... why does that mean we need to keep memcg_data in this definition?
If it's unused, it will stay unused.
> 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."
...
> +struct zpdesc {
> + unsigned long flags;
> + struct list_head lru;
> + struct movable_operations *mops;
Hm. I'm not sure this is a wise definition. While yes, we know it
will only point to the mops, we always set the bottom two bits to '10'.
So I think it's safer to make this 'unsigned long mops' and force people
to _not_ use it directly.
Powered by blists - more mailing lists