Re: [External] Re: [RFC PATCH 0/2] zram: objects charge to mem_cgroup

From: 贺中坤
Date: Fri Jul 07 2023 - 10:26:30 EST


> Please state the objective you are trying to achieve by this patchset.
> It is always good to summarize the previous discussion and mention what
> is done differently or how previous review feedback has been addressed
> but the overall idea/purpose should be always explicit.
>
> Please elaborate more about both.
>

Thanks for your reply.
objective:
the compressed memory of zram charge to the cgroup of the user.

summarize the previous discussion:
[1] As I can see, Michal's concern is that the charges are going to fail
and swapout would fail.

The indirect use of zram is in the context of PF_MEMALLOC, so
the charge must be successful.

[2] David's concern is that if there is a page in the BIO that is not charged,
we can not charge the compressed page for the fs->zram and whether
the recompress case is charged.

In the new solution, the recompress case can be charged. But if there is
a BIO not charged, I'm not so sure, to be honest.it would be great if
someone with more FS->BIO experience could comment.
I have to review the relevant code to check it.

[3] Yosry's concern is that the previous patchsets are very complicated,
and do not have wirteback support in zram.

For the new patchset, charging becomes very simple, and zram supports
writing back to disk.At the same time, I am hoping the use of zswap
without a backing swapfile can be enabled.

To summarize the new patchset:
We charge compressed memory directly in the zram module instead of in
the zsmalloc module because zsmallc may be used by zswap, zswap objects
has been charged once in the zswap module, so zsmallc will double charge.