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

贺中坤
2023-06-15T13:41:02Z

> 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.

Hi David，the charged memory will be released in swap->zram. New pages
are allocated by alloc_zspage(), and we did not charge the page directly，but
the objects(like slab), because the zspage are shared by any memcg.

>
> 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).
>

Yes， the pagecaches are charged in fs->zram, but will be released if
we drop the cache. the compressed objects are not charged.

> --
> Cheers,
>
> David / dhildenb
>