Received: by 10.223.185.116 with SMTP id b49csp1041189wrg; Wed, 21 Feb 2018 11:03:27 -0800 (PST) X-Google-Smtp-Source: AH8x225PZSKqa/mGClnwzGnag+THzNORkLA6vXk68HQ8MtomB7PZmavxPe2TSM0dve6F0GYNDRSR X-Received: by 2002:a17:902:7d8d:: with SMTP id a13-v6mr4018948plm.304.1519239807164; Wed, 21 Feb 2018 11:03:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519239807; cv=none; d=google.com; s=arc-20160816; b=k9XWEUeQpF/I5dPpWkAY9pDi3dRwmVKOjyWTfcpsqjK62d10FU7zmNXWK2XuTZmjiw wTi3aWDO3kIQcS82R8U++snW2hAK8fjEHMq86sFKLnxTP7e9Yl1vH19RQel9TuDvpdVg JPfZes2QB4/+Ym3WKbGz0vPEqPliKv/W0YJHy0ENmlu+jVo8F3r2z/JQ7WUOgAdz3Fkz ahCvZj4CG+oCknfLb+e9/fQNdlHuPZKcH2BpGx4yxEvqFPjcWo/0Fc/+n5WccNVF+lCt vTnK3dexXFd8Gtg1pXfMJ7xYFCx8SqRcS3d1Dz/DVRV15dYaCshtoAUIbhnmd5Exn/yg qsrw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :message-id:in-reply-to:subject:cc:to:from:date :arc-authentication-results; bh=hDrVEY9NLazDU0i32pcLkbUmg6mH34xG6qOOcHSgHDk=; b=rOKvcCNgauyud38fwxjlOoL4E6kkToQtNrqorNg1qab2uRkhB8GzReW9VehRSfvq+M W+us4ZyZEJ/Yzs3A+ehXrZH/x+Dk05F9hQEnHa/9NqG23cYwY6VpIYV2GGxK/bDQzjoK QAj00ku7JIg2UMLjlx6/FIMceu5HvKNSjyjD+ES7gySJX9utiP97SLPQKE7nPebLdUBz 8e4oLa9DpE9wYL8eSx9jMzW2Kvjgm3I9SRa0ztEzsTKyxbPZXVrLAPxfnIquDVsTjVD9 3iDNIOw03KH248SdzfxzPOXus3zn5OtJNR/5yRj7TZEfN/eSp12dvpUwEWexAU1YK01e b0hA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o33-v6si1768983plb.772.2018.02.21.11.03.13; Wed, 21 Feb 2018 11:03:27 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932973AbeBUQf5 (ORCPT + 99 others); Wed, 21 Feb 2018 11:35:57 -0500 Received: from resqmta-po-12v.sys.comcast.net ([96.114.154.171]:37598 "EHLO resqmta-po-12v.sys.comcast.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932880AbeBUQfz (ORCPT ); Wed, 21 Feb 2018 11:35:55 -0500 Received: from resomta-po-14v.sys.comcast.net ([96.114.154.238]) by resqmta-po-12v.sys.comcast.net with ESMTP id oXMMeU3X3ZrfToXN4eTKpI; Wed, 21 Feb 2018 16:35:54 +0000 Received: from gentwo.org ([98.222.162.64]) by resomta-po-14v.sys.comcast.net with SMTP id oXN2egidrnPjOoXN2eIge1; Wed, 21 Feb 2018 16:35:54 +0000 Received: by gentwo.org (Postfix, from userid 1001) id E297C11601C5; Wed, 21 Feb 2018 10:35:51 -0600 (CST) Received: from localhost (localhost [127.0.0.1]) by gentwo.org (Postfix) with ESMTP id E00531160054; Wed, 21 Feb 2018 10:35:51 -0600 (CST) Date: Wed, 21 Feb 2018 10:35:51 -0600 (CST) From: Christopher Lameter X-X-Sender: cl@nuc-kabylake To: Shakeel Butt cc: Jan Kara , Amir Goldstein , Pekka Enberg , David Rientjes , Joonsoo Kim , Andrew Morton , Greg Thelen , Johannes Weiner , Michal Hocko , Vladimir Davydov , Mel Gorman , Vlastimil Babka , linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, cgroups@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 3/3] fs: fsnotify: account fsnotify metadata to kmemcg In-Reply-To: <20180221030101.221206-4-shakeelb@google.com> Message-ID: References: <20180221030101.221206-1-shakeelb@google.com> <20180221030101.221206-4-shakeelb@google.com> User-Agent: Alpine 2.20 (DEB 67 2015-01-07) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-CMAE-Envelope: MS4wfMHdd0LGot/zrxQ4rqTs5cMhgsmTyr6RkLXbJGlFLQCfYwa8dFg4e+HbOtfk9LQUalzgc55rbeisRmT61RN7BuN3Lm0A8WLrvr+gM/thorQmEfim/TxQ +Hsrxz1298aUYuG29A5/aaEI2pL6+/88VsGGKIJpAWcbVPzjJxL1r6FxCmKt3yqBUMmgi06PEx1cR1ybU+ogzYLx4u4G9uU/au/ODQhzc+PvqbkYmeDHY/Bo Lv0e5Wa8smLdq59Y3pH62lb3FDi6CreNQJ1AN+uRatZDMzL47+DJC/2j5d/nM8UbXIW1Gn2Oitao9Ng7YyMA05+UPvjnbJVYNNPj0DX1NV0jXIviiFcfsrQd VRjeVPF3DCbg/PGuXOya797ODJ3f15ILaU0MaQ5Qe9Curie/ytTrNxaShFfFkm472AZfkN6I4FttP27c+U+4NLI4SuoKQkX6oROEw0YY4C5yBEPqbBWIJb+I z2Bf6dAmr0W2SubbKXWJXLyDSl7cCUT1lFL9EL/BhvUDxoyE7l9y7bjJrAc15BxlLvTiN3XJzxWdFN2GvjUCj818aATopYHFEbbrUhyr74xxtt15rZnrxuf3 sHopa1fkoJwV1F9ptMeUp1zpJ1PZM1U9Ak9GxkrlrUGaz4chh83SDoPnhrXOKHAXsBY= Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 20 Feb 2018, Shakeel Butt wrote: > diff --git a/fs/notify/fanotify/fanotify.c b/fs/notify/fanotify/fanotify.c > index 6702a6a0bbb5..0d9493ebc7cd 100644 > --- a/fs/notify/fanotify/fanotify.c > +++ b/fs/notify/fanotify/fanotify.c > if (fanotify_is_perm_event(mask)) { > struct fanotify_perm_event_info *pevent; > > - pevent = kmem_cache_alloc(fanotify_perm_event_cachep, > - GFP_KERNEL); > + pevent = kmem_cache_alloc_memcg(fanotify_perm_event_cachep, > + GFP_KERNEL, memcg); > if (!pevent) #1 > index 8b73332735ba..ed8e7b5f3981 100644 > --- a/fs/notify/inotify/inotify_fsnotify.c > +++ b/fs/notify/inotify/inotify_fsnotify.c > @@ -98,7 +98,7 @@ int inotify_handle_event(struct fsnotify_group *group, > i_mark = container_of(inode_mark, struct inotify_inode_mark, > fsn_mark); > > - event = kmalloc(alloc_len, GFP_KERNEL); > + event = kmalloc_memcg(alloc_len, GFP_KERNEL, group->memcg); > if (unlikely(!event)) > return -ENOMEM; #2 So we have all this churn for those two allocations which are basically the same code for two different notification schemes. Could you store the task that is requesting the fsnotify action instead of the memcg? Then do the allocation in the context of that task. That reduces the modifications to fsnotify.