On Mon, Nov 8, 2021 at 5:18 PM Dave Chinner <david@xxxxxxxxxxxxx> wrote: > [...] > > > If we are to have this for all filesystems, then let's do that properly > > and make it generic functionality from its introduction. > > Fully agree. > Mina, I think supporting all filesystems might be a much cleaner solution than adding fs specific code. We need to: 1) Add memcg option handling in vfs_parse_fs_param() before fs specific param handling. 2) Add a new page cache memcg charging interface (similar to swap). With (1), no need to change any fs specific code. With (2), fs codepaths will be free of memcg specific handling. This new interface will be used in __filemap_add_folio(), shmem_add_to_page_cache() and collapse_file(). thanks, Shakeel