Re: [RFC PATCH 3/3] fs: fsnotify: account fsnotify metadata to kmemcg

From: Jan Kara
Date: Mon Feb 19 2018 - 09:33:57 EST


On Wed 14-02-18 10:08:31, Amir Goldstein wrote:
> On Wed, Feb 14, 2018 at 4:56 AM, Shakeel Butt <shakeelb@xxxxxxxxxx> wrote:
> > This is RFC patch and the discussion on the API is still happening at
> > the following link but I am sending the early draft for feedback.
> > [link] https://marc.info/?l=linux-api&m=151850343717274
> >
> > A lot of memory can be consumed by the events generated for the huge or
> > unlimited queues if there is either no or slow listener. This can cause
> > system level memory pressure or OOMs. So, it's better to account the
> > fsnotify kmem caches to the memcg of the listener.
> >
> > There are seven fsnotify kmem caches and among them allocations from
> > dnotify_struct_cache, dnotify_mark_cache, fanotify_mark_cache and
> > inotify_inode_mark_cachep happens in the context of syscall from the
>
> fsnotify_mark_connector_cachep as well.

Yes, but for the purposes of memcg accounting, I'd just ignore this cache
and not account fsnotify_mark_connector objects at all. They are small
compared to the notification mark or events and it is unclear whom to
account connector to since it is shared by all events attached to the
inode.

Honza
--
Jan Kara <jack@xxxxxxxx>
SUSE Labs, CR