Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp186174ybl; Wed, 21 Aug 2019 17:17:30 -0700 (PDT) X-Google-Smtp-Source: APXvYqzfQiyFrd0aFtmdYQVMv4y4vW98YuPOmYxdDRncxWjM4K1yL4N5yZMoppkiJxp/CDnRtESk X-Received: by 2002:aa7:96b3:: with SMTP id g19mr37181487pfk.26.1566433050870; Wed, 21 Aug 2019 17:17:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566433050; cv=none; d=google.com; s=arc-20160816; b=CAcTy1autrgVQNH//f6Pza+ja4iJ6CBpoXsoKSMQH9ZzTsWzzzFn9lSZUDVUgh5iy2 zaFmJePD8aqf5hXQVKNOPpN7MO5D9gPz4mdIoj8v2UwjF25Xv8I15KHPCM6+C9aUgkKC anlGa1VnDrNyf4LG0Kfgm0yrEVUUEdazehLePq9MK7KhOtMhdbCMB8YKc6N6jTj96idI /Ocj0or311gLTxfcnb2hOk9jaT0MmgYZlvjAPV+kPEGX/Y3JJahrlDE4ux+cuifGECSR RisJbuEibsNFDiTk6ZrFnut2xFE8PRtYqIFKbqKhm5Iq6mTL3OEVS9CVedHK7IoQxRX7 HZ4g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:from:subject:references :mime-version:message-id:in-reply-to:date:dkim-signature; bh=AyQNolgMX833/X5DxQq+yfb1DTSBcK57n5nfh7LiGZY=; b=tj4x6bQX6W7pLqu7s62So52I1XRnUhpanuB/EvYysn75FWbE1dlZRav6fWw/730Wn5 dpfwdy6FUmQeeFrIskuSrMUcYE3A/YYQUDPfVDB7F1ZlU85CFAhjBHK4yBcKyR55ZXen oVP1/2ZDCkhxcravPZ5Njyi1McTl5MpLcosZ4q9D6ht3fMeXf4t2wGExJQ0GGtpKtAHc 6acXKOahUDj9bUN3Zb6QmfpuveYGq4Jnpn4FrUdkArcx54li5lA+S4q+MoEh1dlZkXoz 6qTwzXqFufT3o8EXyd8YCa3XgGIPV4Wb8ZDHBlJvELWpExR4FFIwx69erw+fzeIm750z WYaQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=CXWxYdY2; 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 q4si15375819pgt.20.2019.08.21.17.17.15; Wed, 21 Aug 2019 17:17:30 -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=CXWxYdY2; 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 S1729741AbfHVAKK (ORCPT + 99 others); Wed, 21 Aug 2019 20:10:10 -0400 Received: from mail-pl1-f201.google.com ([209.85.214.201]:37026 "EHLO mail-pl1-f201.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729038AbfHVAKJ (ORCPT ); Wed, 21 Aug 2019 20:10:09 -0400 Received: by mail-pl1-f201.google.com with SMTP id v13so2501034plo.4 for ; Wed, 21 Aug 2019 17:10:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=AyQNolgMX833/X5DxQq+yfb1DTSBcK57n5nfh7LiGZY=; b=CXWxYdY2fz8qnTLgNoq5USbT2+vkn500HAIsMO5Uh9eHjkfxfI7UrVZZuZ7SmUGZGP dB3tTHlmMLHOwKhFqMRSIvMsQpUhf3NzCW00PPLLUVvHn9hCDlRC9YCAu3sMSlglmR0/ Ho4YKXnexV7YxR3Z7YeEihCwOO/B5jtZK6Mkq+iiU3qi1QMcq9OFYB67Qt48IXPAP6sa HQmtwfrhdBCdnt8x9N1z+TK2Xs3SKMcICya5PBq3dtfjcT0u56UK6jGAbZ9HEBIDup2U S6yUljm4oQrVtgkp+9Wy3dIycEJmSOLpToqBuQurfL2hkD5Urq403INsyLxlUAnC54FJ xvjw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=AyQNolgMX833/X5DxQq+yfb1DTSBcK57n5nfh7LiGZY=; b=X3QpNvKKAvzJngo1BPVVg2+OAW7ESMReuOHAiVm9l80uKsrcfwCyMMbuxp1ktyfrhE /gzdtGBjcuGrBSxpzkIWQLU6UORwRssPkXA1u0Di7dFeXdAFaBEsRoRcKSba0NSMzMqJ QORcgsIp5MQXWtB8TacKNigewS7n7gPfJ7DkRjuR4+/CVgsVSYKUJmUZ/E+kwjia2WZv yuVPVQdt8NbeOLUsbCPNFIcKZM1gjEuMhLQkwC75lZpt+OjFtZW4jhWOdmD34x2613Yu 4P9WfJacqIwGziLQj9vleIYDi6mDcI9N/C2CB23VmsiYIylEBD89cxM6Ne0b4QvHa+VK 4kUA== X-Gm-Message-State: APjAAAWSVaoMIak39AtZOQmrpg4MtDw+u+vnSkmQGJmHZBkwRCvY943+ p7/IgfZJ/o7p1IxsI0v/BIwt/9zEdcc= X-Received: by 2002:a63:704:: with SMTP id 4mr31164087pgh.242.1566432608279; Wed, 21 Aug 2019 17:10:08 -0700 (PDT) Date: Wed, 21 Aug 2019 17:09:32 -0700 In-Reply-To: <20190822000933.180870-1-khazhy@google.com> Message-Id: <20190822000933.180870-2-khazhy@google.com> Mime-Version: 1.0 References: <20190822000933.180870-1-khazhy@google.com> X-Mailer: git-send-email 2.23.0.187.g17f5b7556c-goog Subject: [PATCH 2/3] fuse: kmemcg account fs data From: Khazhismel Kumykov To: miklos@szeredi.hu Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, shakeelb@google.com, Khazhismel Kumykov 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 account per-file, dentry, and inode data accounts the per-file reserved request, adding new fuse_request_alloc_account() blockdev/superblock and temporary per-request data was left alone, as this usually isn't accounted Signed-off-by: Khazhismel Kumykov --- fs/fuse/dev.c | 6 ++++++ fs/fuse/dir.c | 3 ++- fs/fuse/file.c | 4 ++-- fs/fuse/fuse_i.h | 2 ++ fs/fuse/inode.c | 3 ++- 5 files changed, 14 insertions(+), 4 deletions(-) diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c index ea8237513dfa..a0d166a6596f 100644 --- a/fs/fuse/dev.c +++ b/fs/fuse/dev.c @@ -97,6 +97,12 @@ struct fuse_req *fuse_request_alloc(unsigned npages) } EXPORT_SYMBOL_GPL(fuse_request_alloc); +struct fuse_req *fuse_request_alloc_account(unsigned int npages) +{ + return __fuse_request_alloc(npages, GFP_KERNEL_ACCOUNT); +} +EXPORT_SYMBOL_GPL(fuse_request_alloc_account); + struct fuse_req *fuse_request_alloc_nofs(unsigned npages) { return __fuse_request_alloc(npages, GFP_NOFS); diff --git a/fs/fuse/dir.c b/fs/fuse/dir.c index f9c59a296568..2013e1222de7 100644 --- a/fs/fuse/dir.c +++ b/fs/fuse/dir.c @@ -258,7 +258,8 @@ static int fuse_dentry_revalidate(struct dentry *entry, unsigned int flags) #if BITS_PER_LONG < 64 static int fuse_dentry_init(struct dentry *dentry) { - dentry->d_fsdata = kzalloc(sizeof(union fuse_dentry), GFP_KERNEL); + dentry->d_fsdata = kzalloc(sizeof(union fuse_dentry), + GFP_KERNEL_ACCOUNT | __GFP_RECLAIMABLE); return dentry->d_fsdata ? 0 : -ENOMEM; } diff --git a/fs/fuse/file.c b/fs/fuse/file.c index 5ae2828beb00..c584ad7478b3 100644 --- a/fs/fuse/file.c +++ b/fs/fuse/file.c @@ -45,12 +45,12 @@ struct fuse_file *fuse_file_alloc(struct fuse_conn *fc) { struct fuse_file *ff; - ff = kzalloc(sizeof(struct fuse_file), GFP_KERNEL); + ff = kzalloc(sizeof(struct fuse_file), GFP_KERNEL_ACCOUNT); if (unlikely(!ff)) return NULL; ff->fc = fc; - ff->reserved_req = fuse_request_alloc(0); + ff->reserved_req = fuse_request_alloc_account(0); if (unlikely(!ff->reserved_req)) { kfree(ff); return NULL; diff --git a/fs/fuse/fuse_i.h b/fs/fuse/fuse_i.h index 24dbca777775..08161b2d9b08 100644 --- a/fs/fuse/fuse_i.h +++ b/fs/fuse/fuse_i.h @@ -904,6 +904,8 @@ void __exit fuse_ctl_cleanup(void); */ struct fuse_req *fuse_request_alloc(unsigned npages); +struct fuse_req *fuse_request_alloc_account(unsigned int npages); + struct fuse_req *fuse_request_alloc_nofs(unsigned npages); bool fuse_req_realloc_pages(struct fuse_conn *fc, struct fuse_req *req, diff --git a/fs/fuse/inode.c b/fs/fuse/inode.c index 4bb885b0f032..eab44ddc68b9 100644 --- a/fs/fuse/inode.c +++ b/fs/fuse/inode.c @@ -76,7 +76,8 @@ struct fuse_mount_data { struct fuse_forget_link *fuse_alloc_forget(void) { - return kzalloc(sizeof(struct fuse_forget_link), GFP_KERNEL); + return kzalloc(sizeof(struct fuse_forget_link), + GFP_KERNEL_ACCOUNT | __GFP_RECLAIMABLE); } static struct inode *fuse_alloc_inode(struct super_block *sb) -- 2.23.0.187.g17f5b7556c-goog