Re: [External] Re: [RFC PATCH 1/3] zram: charge the compressed RAM to the page's memcgroup

David Hildenbrand
2023-06-15T12:57:05Z

On 15.06.23 14:19, 贺中坤 wrote:
> On Thu, Jun 15, 2023 at 7:19 PM David Hildenbrand <david@redhat.com> wrote:
>>
>> 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.
>
> Sorry ,I got it.

I suspect for the swap->zram we should always get charged pages, because
we're effectively writing out charged anon/shmem pages only -- without
any buffer in between.

For the fs->zram or direct zram access device case I'm not so sure. It
highly depends on what gets mapped into the bio (e.g., a kernel buffer,
zeropage, ...). If it's a pagecache page, that should be charged and
we're good. No so sure about fs metadata or some other fs cases (e.g.,
write() to a file that bypass the pagecache).

--
Cheers,

David / dhildenb