Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp4744635imm; Mon, 18 Jun 2018 22:16:19 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJ/dTY6l0rS6eewtDwSmtgXgaQwZhmCvL1iUsunadWP5wJDonE+Wrt2GQ8zwJpVt4YX7+IQ X-Received: by 2002:a17:902:d807:: with SMTP id a7-v6mr17298202plz.92.1529385379439; Mon, 18 Jun 2018 22:16:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529385379; cv=none; d=google.com; s=arc-20160816; b=s9AAVHdvpD1kRhKsCPty0zqlmGrLshxM2hXKayFYvuHWYZYxMkNrXJzktQxO/g/nQ1 yMdMbP4hMdm1dpWn0S8GjKDZfWaimjJIt54hRXbgGixvLcUTI/wW5N+5vWYp8P4WuxyF O4xn5OsahR1EfSqocuSADEbM+QdXENVeddCEagGKT9D0hhQutrvc/DyKQ0SndCA6nZGY /KxrXnwBZRxS15BPya2EFGEH8go7ZoGs/zFVkxuTwicOKtxAlWG90cwVtYkwioRW2j+A tK2H7i/9taVM8jxWW7aiK5OkMvVcSKFZ+Ex5p6eet7RBInkeOMAnW5lUAcF/WI9CUaKS 6U1g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=isp0D7fOHm2B+eMegAVDPCkhp4suKkoR3rfaJmek6NA=; b=wCmqsl61LCqHODzrIVl5TFFbSuCyx6MeZpflGBhNs3Gjyfyq4K94vF6Ir0j9ZMwBEl rTjy+Lo4B0186M9M+Qpc5w4pGMT6pCxy3CpRJftPvnmlfKKTwp2W0IBiuhuil1VZLFY6 Z+HiYKJkd9JsI36OZpvR14OmmJ2vSojbIy/o51oGyN3lXMR7LV9fzq8o4PzS6vCtl/ex HgjeWXIaAPPZoLbp8+1yQO1KxZjXbZeEYc4rVklQJzUdJp4Q1+YD1NOrBq77Qm/8P4vH Kwft0+h/AgCvpLQRhp8m9HHsoX+xMkbf1OTcZSpD/Vw6okTPAC5tN4wUoQSjbmdd1a5z prSA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=WMP14NhH; 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 g9-v6si5782091pgs.385.2018.06.18.22.16.05; Mon, 18 Jun 2018 22:16:19 -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=WMP14NhH; 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 S937314AbeFSFNo (ORCPT + 99 others); Tue, 19 Jun 2018 01:13:44 -0400 Received: from mail-pl0-f65.google.com ([209.85.160.65]:37745 "EHLO mail-pl0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S937236AbeFSFNm (ORCPT ); Tue, 19 Jun 2018 01:13:42 -0400 Received: by mail-pl0-f65.google.com with SMTP id 31-v6so10277625plc.4 for ; Mon, 18 Jun 2018 22:13:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=isp0D7fOHm2B+eMegAVDPCkhp4suKkoR3rfaJmek6NA=; b=WMP14NhHdhEEe1tr3TYy4Fh5PUDmWJwERjLvnD7kYaPUNW/EM057iCQl2VBgsu1bhi nXxleeEcUiYLziOmfPbQ3XBANbGx8Cb/Pjhs007nO90wothgdcc8SoAL3JonBg7PXYGi GYuk1Kt2c6Uu+cKpfcwGQGurMCtNKjrYYQUcYnmfmegT0982350lv7OSB+xCP5B4GXM9 7IqhmY8O/uFjEzk05BByqyvD9TIuFbbdlgHlsw1siWXngcX7hzabe0HFTJcg8DuXfZ9N XbXujiMBhcNAFOstQTyTm026k6XijzBRfD5BPQoA+kHxLxPru3NDtXCXdzsqeuGLfWI1 R04A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=isp0D7fOHm2B+eMegAVDPCkhp4suKkoR3rfaJmek6NA=; b=eb9v1KtKwquDeByWkRAoE+dm+oK00AtQZ6mHiMhoBODZgwfw0ft1FQRYLiP7rSbOpR m76yrIm0G7GpW5IPj6JO8VOaP0M2Vbihbgi6SxXWJjMqHxLXJ0mY2OYzNPvQ5yWBUcfQ YDE65U/ecuixd02OHCQlwfdPr0cwDUhnGl3M24CJUBnK4DcK+2R/A355XqAzJTuvwsHH LrsxMdI4GlpQ1mDXh1lVr43zeJPTJCM75z1FZd9EAmH/lZTJ1Asp5zSWQ8L17DimbBfu KqasQHLphgL8KxbL35kOuPJ5h86GzFBHNNTKF+XARdCgw5IF+6+hsiFWqN0tC/5B2ndr fGNQ== X-Gm-Message-State: APt69E0LQ8HKL7gj3eFTk6QM91SeSYEHbhR1zzBztU9KzEpZ/+4y+bQZ 2YafksPdE8N5hpS1aQ95BNXG/w== X-Received: by 2002:a17:902:a9:: with SMTP id a38-v6mr17416687pla.102.1529385221337; Mon, 18 Jun 2018 22:13:41 -0700 (PDT) Received: from shakeelb.mtv.corp.google.com ([2620:15c:2cb:201:3a5f:3a4f:fa44:6b63]) by smtp.gmail.com with ESMTPSA id a23-v6sm28390504pfj.117.2018.06.18.22.13.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 18 Jun 2018 22:13:39 -0700 (PDT) From: Shakeel Butt To: Andrew Morton Cc: Michal Hocko , Johannes Weiner , Vladimir Davydov , Jan Kara , Greg Thelen , linux-kernel@vger.kernel.org, cgroups@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, Shakeel Butt Subject: [PATCH v6 0/3] Directed kmem charging Date: Mon, 18 Jun 2018 22:13:24 -0700 Message-Id: <20180619051327.149716-1-shakeelb@google.com> X-Mailer: git-send-email 2.18.0.rc1.244.gcf134e6275-goog Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This patchset introduces memcg variant memory allocation functions. The caller can explicitly pass the memcg to charge for kmem allocations. Currently the kernel, for __GFP_ACCOUNT memory allocation requests, extract the memcg of the current task to charge for the kmem allocation. This patch series introduces kmem allocation functions where the caller can pass the pointer to the remote memcg. The remote memcg will be charged for the allocation instead of the memcg of the caller. However the caller must have a reference to the remote memcg. This patch series also introduces scope API for targeted memcg charging. So, all the __GFP_ACCOUNT alloctions within the specified scope will be charged to the given target memcg. Shakeel Butt (3): mm: memcg: remote memcg charging for kmem allocations fs: fsnotify: account fsnotify metadata to kmemcg fs, mm: account buffer_head to kmemcg fs/buffer.c | 14 ++++- fs/notify/dnotify/dnotify.c | 5 +- fs/notify/fanotify/fanotify.c | 6 +- fs/notify/fanotify/fanotify_user.c | 5 +- fs/notify/group.c | 6 ++ fs/notify/inotify/inotify_fsnotify.c | 2 +- fs/notify/inotify/inotify_user.c | 5 +- include/linux/fsnotify_backend.h | 12 ++-- include/linux/memcontrol.h | 14 +++++ include/linux/sched.h | 3 + include/linux/sched/mm.h | 24 ++++++++ include/linux/slab.h | 83 ++++++++++++++++++++++++++++ kernel/fork.c | 3 + mm/memcontrol.c | 54 ++++++++++++++++-- 14 files changed, 220 insertions(+), 16 deletions(-) -- 2.18.0.rc1.244.gcf134e6275-goog