From: David Hildenbrand <david@redhat.com>
To: 贺中坤 <hezhongkun.hzk@bytedance.com>
Cc: minchan@kernel.org, senozhatsky@chromium.org, mhocko@suse.com,
linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [External] Re: [RFC PATCH 1/3] zram: charge the compressed RAM to the page's memcgroup
Date: Thu, 15 Jun 2023 13:19:20 +0200 [thread overview]
Message-ID: <3f54542e-235b-8456-f13f-786d21c6c14f@redhat.com> (raw)
In-Reply-To: <CACSyD1NxcYn_Uy2DUk1ywSyWsxFzq4H+poaWvF55SZZz5W-uRw@mail.gmail.com>
On 15.06.23 13:15, 贺中坤 wrote:
> On Thu, Jun 15, 2023 at 5:27 PM David Hildenbrand <david@redhat.com> wrote:
>>
>> Interesting. When looking at possible ways to achieve that in a clean
>> way, my understanding was that the page might not always be accounted to
>> a memcg (e.g., simply some buffer?). Besides the swap->zram case I was
>> thinking about other fs->zram case, or just a straight read/write to the
>> zram device.
>>
>> The easiest way to see where that goes wrong I think is
>> zram_bvec_write_partial(), where we simply allocate a temporary page.
>>
>> Either I am missing something important, or this only works in some
>> special cases.
>>
>> I came to the conclusion that the only reasonable way is to assign a
>> complete zram device to a single cgroup and have all memory accounted to
>> that cgroup. Does also not solve all use cases (especially the
>> swap->zram case that might be better offjust using zswap?) but at least
>> the memory gets accounted in a more predictable way.
>>
>> Happy to learn more.
>>
>> --
>> Cheers,
>>
>> David / dhildenb
>>
>
> Hi david, thanks for your reply. This should be my mistake, I didn't
> describe the
> problem clearly.
>
> The reason for the problem is not the temporary page allocated at the beginning
> of zram_bvec_write_partial() and released at the end,but the compressed memory
> allocated by zs_malloc() in zram_write_page().
>
> So, it may not meet the need to assign a complete zram device to a
> single cgroup.
> we need to charge the compressed memory to the original page's memory cgroup,
> which is not charged so far.
>
Yes, but my point is that there are cases where the pages you get are
not charged. zram_bvec_write_partial() is just one such example that
highlights the issue.
--
Cheers,
David / dhildenb
next prev parent reply other threads:[~2023-06-15 11:19 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-15 3:48 Zhongkun He
2023-06-15 4:59 ` Yu Zhao
2023-06-15 8:57 ` Fabian Deutsch
2023-06-15 10:00 ` [External] " 贺中坤
2023-06-15 12:14 ` Fabian Deutsch
2023-06-16 1:39 ` Yosry Ahmed
2023-06-16 4:40 ` [External] " 贺中坤
2023-06-16 7:37 ` Yosry Ahmed
2023-06-16 7:57 ` David Hildenbrand
2023-06-16 8:04 ` Yosry Ahmed
2023-06-16 8:37 ` David Hildenbrand
2023-06-16 8:39 ` Yosry Ahmed
2023-06-15 9:32 ` Fabian Deutsch
2023-06-15 9:41 ` [External] " 贺中坤
2023-06-15 9:27 ` David Hildenbrand
2023-06-15 11:15 ` [External] " 贺中坤
2023-06-15 11:19 ` David Hildenbrand [this message]
2023-06-15 12:19 ` 贺中坤
2023-06-15 12:56 ` David Hildenbrand
2023-06-15 13:40 ` 贺中坤
2023-06-15 14:46 ` David Hildenbrand
2023-06-16 3:44 ` 贺中坤
2023-06-15 9:35 ` Michal Hocko
2023-06-15 11:58 ` [External] " 贺中坤
2023-06-15 12:16 ` Michal Hocko
2023-06-15 13:09 ` 贺中坤
2023-06-15 13:27 ` Michal Hocko
2023-06-15 14:13 ` 贺中坤
2023-06-15 14:20 ` Michal Hocko
2023-06-16 3:31 ` 贺中坤
2023-06-16 6:40 ` Michal Hocko
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=3f54542e-235b-8456-f13f-786d21c6c14f@redhat.com \
--to=david@redhat.com \
--cc=hezhongkun.hzk@bytedance.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mhocko@suse.com \
--cc=minchan@kernel.org \
--cc=senozhatsky@chromium.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox