Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp5587605imm; Tue, 19 Jun 2018 12:58:19 -0700 (PDT) X-Google-Smtp-Source: ADUXVKIsFS/Rn7nTiqYLr1g3j9RdqT8BNPAJJO2ipvc8k6lInWTz2ivDWP3LRw+RRazsohsBG+DE X-Received: by 2002:a65:55c6:: with SMTP id k6-v6mr15997649pgs.6.1529438299823; Tue, 19 Jun 2018 12:58:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529438299; cv=none; d=google.com; s=arc-20160816; b=hZVhlTpvOtPUCxYc/JJ+CZBlAAYQDTpy/p9fHxBYDbAB7Uqe5sOpDyahg1TD5c+Qtl bzZFjr/ryfLidSpTTaJrxb0eYGFLZYKJ7vcmUpBlItLlMK9ZFx7yoAPC716sebEeji/U rA4iZLO1zvbFuhFW2vYkqFg7WC4yA709GYpNZjqZpS6XXivgOJ6ro2EjCdUrrcU2uMGa WECGckylgy0TSMBYQ2SCcXmHpZnQ4FcI3gQvnh/24Pf1k1nZmejYdED8A9WUBcsH2J2C ShfdNPSOfAfTN52wa6Q0N0ZKiZLS56uYChv/OcGucp7ykGGJaVWaYuCi5qUTf73xUed4 sCDg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:spamdiagnosticmetadata :spamdiagnosticoutput:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature:dkim-signature:arc-authentication-results; bh=5ismp5RNMkW12oWlGaLYK/WMhlNbSpd78Lqr5jY/oL0=; b=xTk660E3R2+ed8tbvzpAnluoJsVwh37O3z8iL/hQ10EosmRUQDdubMQT1Zsf2Dx3SK D3vdkDKCMCnvqsaL8QOEtM0YIeL15QeFnc31uxt8C3GnyGCPbZOWD5qTu2nUVyBbjgOP MsdtwSZ821WJBU3m1colc3FxlMBiNXGvw0ybH0O8QiRMYsVmnYgkoq21Q9HHdC/zRi05 kNiAIOSzy4mxnhCJos5dNS3OD7ctH/fZCEmEUgtExIIoDK+Kkk6Skwd9iSUMA5rvn3t0 XXCrDKTJBS2NhaFuS1Wh9fLuVCFXYIfoH1DQHVLDjzyUuKQr8HcPU2LKhAfKqzGO7b6M Ov1w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@fb.com header.s=facebook header.b="LDbR/5br"; dkim=fail header.i=@fb.onmicrosoft.com header.s=selector1-fb-com header.b=jm1C2fFs; 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=NONE sp=NONE dis=NONE) header.from=fb.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g17-v6si470069pfj.283.2018.06.19.12.58.00; Tue, 19 Jun 2018 12:58: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=@fb.com header.s=facebook header.b="LDbR/5br"; dkim=fail header.i=@fb.onmicrosoft.com header.s=selector1-fb-com header.b=jm1C2fFs; 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=NONE sp=NONE dis=NONE) header.from=fb.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1030710AbeFST4A (ORCPT + 99 others); Tue, 19 Jun 2018 15:56:00 -0400 Received: from mx0a-00082601.pphosted.com ([67.231.145.42]:37482 "EHLO mx0a-00082601.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1030472AbeFSTz5 (ORCPT ); Tue, 19 Jun 2018 15:55:57 -0400 Received: from pps.filterd (m0044010.ppops.net [127.0.0.1]) by mx0a-00082601.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w5JJtTP6030573; Tue, 19 Jun 2018 12:55:39 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fb.com; h=date : from : to : cc : subject : message-id : references : mime-version : content-type : in-reply-to; s=facebook; bh=5ismp5RNMkW12oWlGaLYK/WMhlNbSpd78Lqr5jY/oL0=; b=LDbR/5brEplV4jIUBsbgi1C3m0eGgr3PZDgfr87QTojWW2WWHurfIwb+2Ji1S8d0VXLz CsGTKPgkIpa9b2WEY/n7EnwUrGk1CfPV3Cr4SQA2Kuypfz6wyM1TVlnqA6AGngcV4ebo clB2FdFkAjuZxZRpMs3b5ZCB0wmpXqQcHkI= Received: from mail.thefacebook.com ([199.201.64.23]) by mx0a-00082601.pphosted.com with ESMTP id 2jq7ukg2q2-4 (version=TLSv1 cipher=ECDHE-RSA-AES256-SHA bits=256 verify=NOT); Tue, 19 Jun 2018 12:55:39 -0700 Received: from NAM04-CO1-obe.outbound.protection.outlook.com (192.168.54.28) by o365-in.thefacebook.com (192.168.16.16) with Microsoft SMTP Server (TLS) id 14.3.361.1; Tue, 19 Jun 2018 12:55:37 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fb.onmicrosoft.com; s=selector1-fb-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=5ismp5RNMkW12oWlGaLYK/WMhlNbSpd78Lqr5jY/oL0=; b=jm1C2fFsMkKvUHbxJQm+Rq81Eth0fJi2zerBDzEz57Sc8TLS+SRBx5TfVW36LPMkx+KLAkrElauYNgRS9z9BY2dzMUDje8FKLW+SD44UULDVRVIByBvhpacYhZdx922dLJ4bPzdRbuW8MvcdR5LKLZ7miRsnGlGYmHTum2MdHyU= Received: from castle (2620:10d:c090:380::2:787b) by DM3PR15MB1081.namprd15.prod.outlook.com (2603:10b6:0:12::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.863.19; Tue, 19 Jun 2018 19:55:33 +0000 Date: Tue, 19 Jun 2018 12:55:28 -0700 From: Roman Gushchin To: Shakeel Butt CC: Johannes Weiner , Andrew Morton , Michal Hocko , Vladimir Davydov , Jan Kara , Greg Thelen , LKML , Cgroups , linux-fsdevel , Linux MM , Jan Kara , Alexander Viro Subject: Re: [PATCH 3/3] fs, mm: account buffer_head to kmemcg Message-ID: <20180619195525.GA19193@castle> References: <20180619051327.149716-1-shakeelb@google.com> <20180619051327.149716-4-shakeelb@google.com> <20180619162741.GC27423@cmpxchg.org> <20180619174040.GA4304@castle.DHCP.thefacebook.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.2 (2017-12-15) X-Originating-IP: [2620:10d:c090:380::2:787b] X-ClientProxiedBy: MWHPR06CA0007.namprd06.prod.outlook.com (2603:10b6:301:39::20) To DM3PR15MB1081.namprd15.prod.outlook.com (2603:10b6:0:12::7) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: b467804d-55dd-4c20-0fba-08d5d61e9f3a X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(7020095)(4652020)(4534165)(4627221)(201703031133081)(201702281549075)(5600026)(711020)(2017052603328)(7153060)(7193020);SRVR:DM3PR15MB1081; X-Microsoft-Exchange-Diagnostics: 1;DM3PR15MB1081;3:FtliEfvNyGn0FlxGIONJ5hLMXKqinNipxT09bLq6tG+aLt3MfbTyK4BVGxzzm1XZLcDb0H+fWoHen4hgS9kZoG1kmmXxZPMRgyuUTa6IZqW81O8FGxvgLtWH+QgARgF3+AZhLCCZcfNUQoPC11FgrTASehuyyyURaWHUaP8dxU1Qn4liOooBvpkiRDKCWO4axaklUZ7EjTE02ovb+W6E1qu0k3V2MMuTzH27SP5ESu64a8j9j+09vzayGSweU4kX;25:Szm3en0VPJtuVtfJ06LTXB6i9qSvgAyIkw7jeNeFUUGOUHL3xMxN/wl2lDQ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LCEbhfebm6zrLJocABh94CMBTwnZ644vp X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(20558992708506)(85827821059158)(67672495146484)(211936372134217)(153496737603132); X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(3231254)(11241501184)(944501410)(52105095)(93006095)(93001095)(10201501046)(3002001)(149027)(150027)(6041310)(20161123564045)(20161123558120)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(6072148)(201708071742011)(7699016);SRVR:DM3PR15MB1081;BCL:0;PCL:0;RULEID:;SRVR:DM3PR15MB1081; X-Microsoft-Exchange-Diagnostics: 1;DM3PR15MB1081;4:kTlGWyo7VfDgnApi5O14jnCSoo27Mg/PP91cHLsGUEF4DTkOCWGgeNOV4/ShRn6NYG1vBJ3uUjKrsUsUS+418E24us8RB8FgdArtIi88+/SS5YYaf+RwVcjv19wziV87RpIhaFCU5uWm668Xikn+vocPj2N0XZWilMb9KH6M9GZIIA6U1XvtPfyogCVM6aNXL4IF8s5unH3bK9LLb9/FFijLc3YQ1G5kZ3ggaQar+J/AdqrHmjz15Bq1vHvwNK98xTWsEPWhpg/mG9xY5yvDUEmSYG5e6PGIzUFYcXGbN5B4hD8K/xdr6UlgoMVKCzejjZrZfebpSNsQ4a1Mk+EyJ65fBppd577ub5KAXpq81bHpXaSO8eW85V9kyPcW5goQs0sdrnMcojzmCeQXWfvBIz32V7sjc1Uh6Pz3ivsG/FPxvFSbYsskMFdHE7v8cv5Cu3ghA3OxJtR5uEtNjhQDdA== X-Forefront-PRVS: 07083FF734 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10019020)(396003)(366004)(376002)(39380400002)(346002)(39860400002)(189003)(199004)(93886005)(54906003)(5660300001)(23726003)(33716001)(47776003)(316002)(476003)(39060400002)(1076002)(16586007)(16526019)(229853002)(186003)(6916009)(6116002)(46003)(58126008)(7736002)(7416002)(6666003)(55016002)(305945005)(68736007)(86362001)(9686003)(33656002)(52396003)(478600001)(52116002)(486006)(106356001)(11346002)(25786009)(8936002)(50466002)(386003)(53546011)(59450400001)(53936002)(81156014)(6496006)(81166006)(2906002)(97736004)(33896004)(76176011)(105586002)(8676002)(446003)(4326008)(6246003)(18370500001)(42262002);DIR:OUT;SFP:1102;SCL:1;SRVR:DM3PR15MB1081;H:castle;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;MX:1;A:1; Received-SPF: None (protection.outlook.com: fb.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;DM3PR15MB1081;23:OVArNx4f03s6C3XHPTpn/84zslAZLKF2FOlOKc9uT?= =?us-ascii?Q?eOiERx7GY11ktzRM/UNfWCInyTX8maicv1ftiH8dm4w8VuiMRXUCSvuv0ZQf?= =?us-ascii?Q?cL7Dgo+w8YN10orHiRH83H7L9eWhWdlhkOZKJgcUM5qUqxBc26uhcdDzomNe?= =?us-ascii?Q?MkpYJfpiHYREiJdywz6YRfO94JK77sJpvn4NK1znHmuUiofVcFtdiJCShypc?= =?us-ascii?Q?KiCN/qhKbCt72q0NLhMsqZhmxIQCbo7eDpB9qi6E2ygBLnhxGInRjFCOliz1?= =?us-ascii?Q?jmclz4algXzoRAWcUvAz+DZUGgJe7wrEET3QHNeWTbZ008R6s7UXQnWkMzGn?= =?us-ascii?Q?OGH01rcHurBOpqfz6XKmVStACgYu3Bc4rtC4LCJIMIeVyviegsy5+H8oGXb5?= =?us-ascii?Q?Sru4hvNiukt++eBU1PIXaeF441L7sjk3TOx0mCpRfFm4rl9VX3rOFkDuzRse?= =?us-ascii?Q?C+rZu0BDNXVRfG/jwtT9nVgDou+c3tNTkKzKsX6FQZZPAj1HxmHPYRAQ8Lmk?= =?us-ascii?Q?zMJkq65aonh0D/S4vxBH3vCEZJ/2ZNfgSDowNvxNlCIJ+avE0DvNSmrIj6s5?= =?us-ascii?Q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U4= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1;DM3PR15MB1081;7:Zik28PP6f1rmHLiVVXlK+BiEYZTns4N1pFVGFRLuRUKjgyfwc5OoWwTLNKWZOo4wPbsc0B9uan8SVq8ZQJU15NY/muG0NSO852L4v/Fv53fEuH68tMPJZd8+iisn7k6jtL7I2oxczlU6zyOlg7nD4noc9okqpkS756hQRmAyBsaETaKEjgebmP5xbPw5gnOBka4sJypv+k8hATDxEOg3hb0OlnfdJ2ghsss+E3EFwdlkUctp69MxH6wIQTDIblBF;20:aRMOGjh6LV7wXKcl04LXZbYkYw09iRFHb2pwQGyPEJrvy6pAY17osZoEzJJ97zelHXuOldFWqijfK+BwjspZyjhAtDHp9id/BtJPwUKu4JZBlc/22C5Qi1z0FJyPgckXX96U8+iZskpvFmdIhbbPkQ7sB1pnJT4JWJytcbm8KHI= X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Jun 2018 19:55:33.9658 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: b467804d-55dd-4c20-0fba-08d5d61e9f3a X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 8ae927fe-1255-47a7-a2af-5f3a069daaa2 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM3PR15MB1081 X-OriginatorOrg: fb.com X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2018-06-19_10:,, signatures=0 X-Proofpoint-Spam-Reason: safe X-FB-Internal: Safe Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jun 19, 2018 at 12:51:15PM -0700, Shakeel Butt wrote: > On Tue, Jun 19, 2018 at 10:41 AM Roman Gushchin wrote: > > > > On Tue, Jun 19, 2018 at 12:27:41PM -0400, Johannes Weiner wrote: > > > On Mon, Jun 18, 2018 at 10:13:27PM -0700, Shakeel Butt wrote: > > > > The buffer_head can consume a significant amount of system memory and > > > > is directly related to the amount of page cache. In our production > > > > environment we have observed that a lot of machines are spending a > > > > significant amount of memory as buffer_head and can not be left as > > > > system memory overhead. > > > > > > > > Charging buffer_head is not as simple as adding __GFP_ACCOUNT to the > > > > allocation. The buffer_heads can be allocated in a memcg different from > > > > the memcg of the page for which buffer_heads are being allocated. One > > > > concrete example is memory reclaim. The reclaim can trigger I/O of pages > > > > of any memcg on the system. So, the right way to charge buffer_head is > > > > to extract the memcg from the page for which buffer_heads are being > > > > allocated and then use targeted memcg charging API. > > > > > > > > Signed-off-by: Shakeel Butt > > > > Cc: Jan Kara > > > > Cc: Greg Thelen > > > > Cc: Michal Hocko > > > > Cc: Johannes Weiner > > > > Cc: Vladimir Davydov > > > > Cc: Alexander Viro > > > > Cc: Andrew Morton > > > > --- > > > > fs/buffer.c | 14 +++++++++++++- > > > > include/linux/memcontrol.h | 7 +++++++ > > > > mm/memcontrol.c | 21 +++++++++++++++++++++ > > > > 3 files changed, 41 insertions(+), 1 deletion(-) > > > > > > > > diff --git a/fs/buffer.c b/fs/buffer.c > > > > index 8194e3049fc5..26389b7a3cab 100644 > > > > --- a/fs/buffer.c > > > > +++ b/fs/buffer.c > > > > @@ -815,10 +815,17 @@ struct buffer_head *alloc_page_buffers(struct page *page, unsigned long size, > > > > struct buffer_head *bh, *head; > > > > gfp_t gfp = GFP_NOFS; > > > > long offset; > > > > + struct mem_cgroup *old_memcg; > > > > + struct mem_cgroup *memcg = get_mem_cgroup_from_page(page); > > > > > > > > if (retry) > > > > gfp |= __GFP_NOFAIL; > > > > > > > > + if (memcg) { > > > > + gfp |= __GFP_ACCOUNT; > > > > + old_memcg = memalloc_memcg_save(memcg); > > > > + } > > > > > > Please move the get_mem_cgroup_from_page() call out of the > > > declarations and down to right before the if (memcg) branch. > > > > > > > head = NULL; > > > > offset = PAGE_SIZE; > > > > while ((offset -= size) >= 0) { > > > > @@ -835,6 +842,11 @@ struct buffer_head *alloc_page_buffers(struct page *page, unsigned long size, > > > > /* Link the buffer to its page */ > > > > set_bh_page(bh, page, offset); > > > > } > > > > +out: > > > > + if (memcg) { > > > > + memalloc_memcg_restore(old_memcg); > > > > +#ifdef CONFIG_MEMCG > > > > + css_put(&memcg->css); > > > > +#endif > > > > > > Please add a put_mem_cgroup() ;) > > > > I've added such helper by commit 8a34a8b7fd62 ("mm, oom: cgroup-aware OOM killer"). > > It's in the mm tree. > > > > I was using mem_cgroup_put() defined by Roman's patch but there were a > lot of build failure reports where someone was taking this series > without Roman's series or applying the series out of order. Andrew > asked me to keep it like this and then he will convert these callsites > into mem_cgroup_put() after making making sure Roman's series is > applied in mm tree. I will recheck with him, how he wants to handle it > now. I can also split the introduction of mem_cgroup_put() into a separate commit, as it seems to be usable not only by the cgroup oom stuff. Please, let me know, if it's a preferred way to go. Thanks!