Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp5504995imm; Tue, 26 Jun 2018 12:28:01 -0700 (PDT) X-Google-Smtp-Source: ADUXVKIKLYXexVXeyUpGmWgAtEtELzOLa5CHB5vjozMhw4J9pMl9mpFzflnWxLohT0NEnMWO9tiH X-Received: by 2002:a17:902:112b:: with SMTP id d40-v6mr2949330pla.123.1530041281202; Tue, 26 Jun 2018 12:28:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530041281; cv=none; d=google.com; s=arc-20160816; b=BbK+mAh7PJVF5Y3+6ILok4d4lN+skiyFhulGVR2kyUxLmHA0KLDOiI0nTMJNfqbzyT TBL/jaSn75RuENkhGnau8ULn26WzM0Gasbx2x65fFmOV6ISHFhdWa7iX1vGrekbQlcPN 9BM7MB/JbBiJPx6PSXSmAwstBEYZjvIk7uQDNm1yv9E7nl/lG0LlJLBJxb1JhY3We2kj KtAvqPEK3eiU7F2QHBkhVwXX0+x3D0JNFwiCFivylM7o1KLlodjhcGz8traRND/ydyrU Snb3gP8ynemlnaPXgJvfkhAXytNAY8isnaSPTEGa2q1ErG/d+LQ27usOsIdUTP3B62AN Uozg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature :arc-authentication-results; bh=vSXP8pr9YrZfpq32KDOcDU58bqTWUULMSUjOB+oqM8U=; b=ciVAOlIioASa3Ms2WZWdWrrMCilVfO2bexUeND8xtWKGRBIO3JdA9aL3hjAdoWlD87 Ypcdjb4QEooTmGH1n5DpBeo57I/bwAcb/p2G6onmV1Blv0u2iYbKe+e/xqj+ZyWq0ukW ObMGErYSjIJyCRCvOSKGuvOUDHlMqkF0B0H0f8XB1eyD5EGp81IpcnG+ybxHMBMJhURK JEP1/TUZHbOgB6mJC3YY37lj8iHGYYEb3blSYgn1svKc8i5aR4JiPHcP9EuGb/vpMGWX YBieekivml3SB1E6WpsDFkI13UBq5emPAw1yAwI8uXeu/hySwJnESUXQLr6TfksHfMUV d7dA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=ol3NKKwi; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y126-v6si2005795pgb.23.2018.06.26.12.27.16; Tue, 26 Jun 2018 12:28:01 -0700 (PDT) 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; dkim=pass header.i=@google.com header.s=20161025 header.b=ol3NKKwi; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754647AbeFZTIO (ORCPT + 99 others); Tue, 26 Jun 2018 15:08:14 -0400 Received: from mail-wr0-f194.google.com ([209.85.128.194]:43810 "EHLO mail-wr0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752709AbeFZTIM (ORCPT ); Tue, 26 Jun 2018 15:08:12 -0400 Received: by mail-wr0-f194.google.com with SMTP id c5-v6so7153454wrs.10 for ; Tue, 26 Jun 2018 12:08:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=vSXP8pr9YrZfpq32KDOcDU58bqTWUULMSUjOB+oqM8U=; b=ol3NKKwiDDF2Vuh1Ee5P0rIOzUz2O1+XA4fus5D89gbmWBRCpGqAK1oEBE+OFPj/wO nm99Sy4KsR7YMjLX6/ih53AFovWLIA8D5G0DgptNtgDHA9k0ZNeeCvKPP0uRURwdIkDh 0BEUm3ulQx9di0TsIgqMyp9GuK82uTrJS6iq7d6CovudO+zLBHkOs8jQLoOFgrAbVMBd O9NV5c6SnXGKryc98FTCh6YsbmLf6UotIXGS4WM5wY3IN8gnJWk3nH/kPVa9E+CuS5Yp d/XiAU2TrqH1fiwIscDPp1YtZSrW5ypaeE2qL5D/NuX9Ie01rflKSSm7fr1oHm8vVD2z 7sGA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=vSXP8pr9YrZfpq32KDOcDU58bqTWUULMSUjOB+oqM8U=; b=lql37QxIXIbYQKaMCgj8EatfmzR1glHObaiJioCcZL1s3k01pmu9ZzqpGe30bZSl6a rklndNgUe8oU59oTkHeXUBl5Em0WNO/WOXZsXn2Drs1cckMokFcmwVqb5xsnJrpApAsw z1Z2Q2eoKaTYn3P5zwqk17ldgZTE18XhXNZPuC8y4KFfKifPvXeHhrUpBRhSbfxLfRrT YExyWIoD6SiUT7hcRegeTHExM2gfSG0K3UV6Us4w4fQ5M0xMKRRTNKKR+J65iVvcLgRa eBgnbFwG8CCPun1zYyOOpWzyXejPSruSSgT8VkUQQ9ldDQZe3yqOJg7S3OTkOmrHTp8z 9d9w== X-Gm-Message-State: APt69E29BmoFamcP4C1ak+XdJhIlMI142oMjE187La4GXxjoriVae/+7 O/4nBPzK3vFWmh+D+64NssoOxZo5nUVwbbKShVGe2g== X-Received: by 2002:adf:b3d4:: with SMTP id x20-v6mr2536118wrd.272.1530040089785; Tue, 26 Jun 2018 12:08:09 -0700 (PDT) MIME-Version: 1.0 References: <20180625230659.139822-1-shakeelb@google.com> <20180625230659.139822-2-shakeelb@google.com> <20180626185724.GA3958@cmpxchg.org> In-Reply-To: <20180626185724.GA3958@cmpxchg.org> From: Shakeel Butt Date: Tue, 26 Jun 2018 12:07:57 -0700 Message-ID: Subject: Re: [PATCH 1/2] fs: fsnotify: account fsnotify metadata to kmemcg To: Johannes Weiner Cc: Amir Goldstein , Andrew Morton , Michal Hocko , Vladimir Davydov , Jan Kara , Greg Thelen , Roman Gushchin , Alexander Viro , LKML , Cgroups , linux-fsdevel , Linux MM , Jan Kara Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jun 26, 2018 at 11:55 AM Johannes Weiner wrote: > > On Tue, Jun 26, 2018 at 11:00:53AM -0700, Shakeel Butt wrote: > > On Mon, Jun 25, 2018 at 10:49 PM Amir Goldstein wrote: > > > > > ... > > > > > > The verb 'unuse' takes an argument memcg and 'uses' it - too weird. > > > You can use 'override'/'revert' verbs like override_creds or just call > > > memalloc_use_memcg(old_memcg) since there is no reference taken > > > anyway in use_memcg and no reference released in unuse_memcg. > > > > > > Otherwise looks good to me. > > > > > > > Thanks for your feedback. Just using memalloc_use_memcg(old_memcg) and > > ignoring the return seems more simple. I will wait for feedback from > > other before changing anything. > > We're not nesting calls to memalloc_use_memcg(), right? So we don't > have to return old_memcg and don't have to pass anything to unuse, it > can always set current->active_memcg to NULL. For buffer_head, the allocation is done with GFP_NOFS. So, I think there is no chance of nesting. The fsnotify uses GFP_KERNEL but based on my limited understanding of fsnotify, there should not be any nesting i.e. the allocation triggering reclaim which trigger fsnotify events. Though I would like Amir or Jan to confirm there is no nesting possible. thanks, Shakeel