Re: [PATCH v13 12/16] fs: mark list_lru based shrinkers memcg aware

From: Steven Whitehouse
Date: Wed Dec 11 2013 - 06:09:23 EST


Hi,

On Tue, 2013-12-10 at 15:17 +1100, Dave Chinner wrote:
> On Mon, Dec 09, 2013 at 12:05:53PM +0400, Vladimir Davydov wrote:
> > Since now list_lru automatically distributes objects among per-memcg
> > lists and list_lru_{count,walk} employ information passed in the
> > shrink_control argument to scan appropriate list, all shrinkers that
> > keep objects in the list_lru structure can already work as memcg-aware.
> > Let us mark them so.
> >
> > Signed-off-by: Vladimir Davydov <vdavydov@xxxxxxxxxxxxx>
> > Cc: Glauber Costa <glommer@xxxxxxxxxx>
> > Cc: Dave Chinner <dchinner@xxxxxxxxxx>
> > Cc: Al Viro <viro@xxxxxxxxxxxxxxxxxx>
> > ---
> > fs/gfs2/quota.c | 2 +-
> > fs/super.c | 2 +-
> > fs/xfs/xfs_buf.c | 2 +-
> > fs/xfs/xfs_qm.c | 2 +-
> > 4 files changed, 4 insertions(+), 4 deletions(-)
> >
> > diff --git a/fs/gfs2/quota.c b/fs/gfs2/quota.c
> > index f0435da..6cf6114 100644
> > --- a/fs/gfs2/quota.c
> > +++ b/fs/gfs2/quota.c
> > @@ -150,7 +150,7 @@ struct shrinker gfs2_qd_shrinker = {
> > .count_objects = gfs2_qd_shrink_count,
> > .scan_objects = gfs2_qd_shrink_scan,
> > .seeks = DEFAULT_SEEKS,
> > - .flags = SHRINKER_NUMA_AWARE,
> > + .flags = SHRINKER_NUMA_AWARE | SHRINKER_MEMCG_AWARE,
> > };
>
> I'll leave it for Steve to have the final say, but this cache tracks
> objects that have contexts that span multiple memcgs (i.e. global
> scope) and so is not a candidate for memcg based shrinking.
>
> e.g. a single user can have processes running in multiple concurrent
> memcgs, and so the user quota dquot needs to be accessed from all
> those memcg contexts. Same for group quota objects - they can span
> multiple memcgs that different users have instantiated, simply
> because they all belong to the same group and hence are subject to
> the group quota accounting.
>
> And for XFS, there's also project quotas, which means you can have
> files that are unique to both users and groups, but shared the same
> project quota and hence span memcgs that way....
>

Well that seems to make sense to me. I'm not that familiar with memcg
and my main interest was to use the provided lru code, unless there was
a good reason why we should roll our own, and also to take advantage of
the NUMA friendliness of the new code. Although my main target in GFS2
was the glock lru, I've not got that far yet as it is a rather more
complicated thing to do, compared with the quota code,

Steve.


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/