Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp749035imm; Fri, 17 Aug 2018 06:07:00 -0700 (PDT) X-Google-Smtp-Source: AA+uWPw7UzPHJL6he0hS8i7AWApG7r0Y7WYrLG56eQJfR/yCsk4lElGVCc2RybJ6/ZVnv/V9t7Un X-Received: by 2002:a63:586:: with SMTP id 128-v6mr1565167pgf.169.1534511220065; Fri, 17 Aug 2018 06:07:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1534511220; cv=none; d=google.com; s=arc-20160816; b=Sc0AEgdmBrR/kQWcVjYCHQaEp2oYKsfEldwbZHWjec+EDODnz9wXIQ2iqzr5P0AYqu 5bm8SbJAnkQa5IunKPJJUE5rmCH1pCjRDzdtgNXVMWfLx4X3QOLZ/OE/0LDtEMITylHI wR9fjHzXxC8L0hEMVZ/990+SQD3SAUBEb5RrjRmXj+CPUOiu6UTxAUc1TFRSIE0YwqHt rnEe4fOr9a/mtaxTvaga+WUKxB8cHnFEQPKGeJgCco4/nJyJZZ5oRZzlPldrD/mteBCQ sM7gTQ+S7Zhg3ROSW/OFBtfp/NXbKmENjodxlr1OBjiv+vTYmrPEj6Ia/YNmFfhMxpvE XvSg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=aac5Gm9TQQkSyYqATQFmTCaoOMMkRsihgXdj1y0MZos=; b=b+cZLe+QJ1rEYzaHOVGOatNQYXGIGPyVfDjxlguMlp/U6MLGKXsoOK/T3OyNFSXoLj 6iItnP9eUm+QOZyDDKUqJr8t0JDFSxbUEE76EDUiD3aC3fr7Q9WeZqxAxbmA9k7mP/fZ OO0V5CEF/77ZO9aa7ox7W2BT1i2f1OwigzIJRRVba7qhgq9gUkQbm1VbMyH+o9qqv2We grKaVvIgWn9FObnzl7sxqgD3tIvzObMkIOCzRTHo41lX5WEVEu2u8mbz0INUG9hClgQ2 KfuCJuxGHT+vDp5MDfw7GoND1KCbxav/BhomyuUHXOOeFg6Ob6QL6D10D/R8Z0Eap8lm RPCA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cmpxchg-org.20150623.gappssmtp.com header.s=20150623 header.b=OtiZsblM; 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=fail (p=NONE sp=NONE dis=NONE) header.from=cmpxchg.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 31-v6si2327353pla.129.2018.08.17.06.06.44; Fri, 17 Aug 2018 06:07:00 -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=@cmpxchg-org.20150623.gappssmtp.com header.s=20150623 header.b=OtiZsblM; 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=fail (p=NONE sp=NONE dis=NONE) header.from=cmpxchg.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727445AbeHQQHt (ORCPT + 99 others); Fri, 17 Aug 2018 12:07:49 -0400 Received: from mail-yb0-f194.google.com ([209.85.213.194]:36198 "EHLO mail-yb0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727160AbeHQQHt (ORCPT ); Fri, 17 Aug 2018 12:07:49 -0400 Received: by mail-yb0-f194.google.com with SMTP id d34-v6so1893010yba.3 for ; Fri, 17 Aug 2018 06:04:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cmpxchg-org.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=aac5Gm9TQQkSyYqATQFmTCaoOMMkRsihgXdj1y0MZos=; b=OtiZsblMVy9ij4AVKGz73RvZsz9fpyEfp91t6viXYTzJ16rSUShEoEi70GV/2AG1NL rnz0tbi/zojUEc8iq06IMBkcEt4USlvY13ivlB6BesauDPUzgIfHkun/9Wy82ty8RSGp Y/lp/nQ6VeW154zdoQvhOHqqBzwEYW0rCFWO080EVbm23XmI+AXF3qLmq/cR1kqYg5GV YqwfLCiijolLFX6OFTKjE8fp7VVlVClG9gcDqXLLKWP1oxQVkhK50cyPpAcQhgCfZg4c FdkJxhqOQoQNMxkC5a7GbehJUNhojPjbMNXZL1IeICyXY4YjpPpcftysqpnqFDjKWV4m mGIw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=aac5Gm9TQQkSyYqATQFmTCaoOMMkRsihgXdj1y0MZos=; b=BLOmDWbaUJJ//avzqK/S+BJUECiq3gpOhyl6AVWmH2FGngONfnI22a4ctY3tVVX/EY FhMZVYUql7S3bPviZl4+aApTqfQDWeK86iOUrFcZ91RF8ibJgymfnYnXHDNLFyJsAZLf nVe/PKokkSHSG0QusIhEZ9/4dyj22cn9kWh8oHS7T2H6TeVp9MnAlC4NCWTe9HBrBlw7 n7/zXbnVxkR47E1zu65Y6Q9KswHpuhSjY/pGdiNtipOp9g4DFtIcbQL8fViqx9TQGifV fM4KjZ4UMkDm5wTdBMOhmSITnC7LH4t7haAAElEccSgGqKbdlSDsxBiMGop0cN7YAsZZ HI+g== X-Gm-Message-State: AOUpUlHLracZDK4SKEA2SM+QL0m/lOr1hP2WILmFSIZSKo5XCS3TmeuG zcImTVCQb4YuLGBKvARX85DnBA== X-Received: by 2002:a25:384c:: with SMTP id f73-v6mr11951670yba.196.1534511067683; Fri, 17 Aug 2018 06:04:27 -0700 (PDT) Received: from localhost ([2620:10d:c091:180::1:df3]) by smtp.gmail.com with ESMTPSA id w8-v6sm1090180ywa.12.2018.08.17.06.04.26 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 17 Aug 2018 06:04:26 -0700 (PDT) Date: Fri, 17 Aug 2018 09:04:25 -0400 From: Johannes Weiner To: Andrew Morton Cc: Shakeel Butt , Michal Hocko , Vladimir Davydov , Jan Kara , Greg Thelen , Amir Goldstein , Roman Gushchin , Alexander Viro , linux-kernel@vger.kernel.org, cgroups@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org Subject: Re: [PATCH v8 0/2] Directed kmem charging Message-ID: <20180817130425.GA12351@cmpxchg.org> References: <20180627191250.209150-1-shakeelb@google.com> <20180815152511.3ea63aa54c5fac0bfe9370da@linux-foundation.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180815152511.3ea63aa54c5fac0bfe9370da@linux-foundation.org> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Aug 15, 2018 at 03:25:11PM -0700, Andrew Morton wrote: > On Wed, 27 Jun 2018 12:12:48 -0700 Shakeel Butt wrote: > > > The Linux kernel's memory cgroup allows limiting the memory usage of > > the jobs running on the system to provide isolation between the jobs. > > All the kernel memory allocated in the context of the job and marked > > with __GFP_ACCOUNT will also be included in the memory usage and be > > limited by the job's limit. > > > > The kernel memory can only be charged to the memcg of the process in > > whose context kernel memory was allocated. However there are cases where > > the allocated kernel memory should be charged to the memcg different > > from the current processes's memcg. This patch series contains two such > > concrete use-cases i.e. fsnotify and buffer_head. > > > > The fsnotify event objects can consume a lot of system memory for large > > or unlimited queues if there is either no or slow listener. The events > > are allocated in the context of the event producer. However they should > > be charged to the event consumer. Similarly the buffer_head objects can > > be allocated in a memcg different from the memcg of the page for which > > buffer_head objects are being allocated. > > > > To solve this issue, this patch series introduces mechanism to charge > > kernel memory to a given memcg. In case of fsnotify events, the memcg of > > the consumer can be used for charging and for buffer_head, the memcg of > > the page can be charged. For directed charging, the caller can use the > > scope API memalloc_[un]use_memcg() to specify the memcg to charge for > > all the __GFP_ACCOUNT allocations within the scope. > > This patchset is not showing signs of having been well reviewed at > this time. Could people please take another look? I don't have the mailing list archives for this anymore, but the series as it stands in mmots looks good to me and incorporates all the feedback I remember giving. [ My only gripe really is that it applies current->active_memcg only to kmem charges, not others as well. Right now it doesn't matter, but I can see this costing a kernel developer implementing remote charges for something other than kmem some time to realize. ] Anyway, please feel free to add Acked-by: Johannes Weiner for 1/2 and 2/2 plus their two fixlets.