Received: by 10.213.65.68 with SMTP id h4csp468724imn; Fri, 6 Apr 2018 03:35:18 -0700 (PDT) X-Google-Smtp-Source: AIpwx48L3n77N5qbkKVEzW/Nnmdi9qjHXPi86zoQJNgach7Lo1QmfNi8NLQDvOziQFZ45Kbbffrt X-Received: by 10.101.97.208 with SMTP id j16mr17510670pgv.431.1523010918840; Fri, 06 Apr 2018 03:35:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523010918; cv=none; d=google.com; s=arc-20160816; b=n5XuhHFAn9PLQRW8Bmx0eDruyJx51oPIgpi4+9j4Nn8Nlo+KYv+WTpXEKqjHX2GbXB p34JYS7tfMHSgEr2aBfOBwgGZdWI9AaHsl9LTPGzfFUwiTKRfs8U8f3VCrHD6TqgPQ0R lAZG+BvVWHWGqMr4nGLHzqG6DB+JizGzPaILvLD9WsEsW/dX4hBQBaeZgJX1tpzpD1Tz IdTHXAd+FE03OYjSCN3bbQKIFTR01e3uoiGklBYVKfUObOYinB9vkc2SZ2DIPOzS5gq/ x5CxBlP12pJU1aEwmpGOijVDAHXYUeg0edx1e9eP1QjGqGgY7B9E0+IhRalGpVfic6Qo flNw== 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=XtrcnnD74/qpqBYLzOWybAN1Lh3QbaN+uIobs8mxu84=; b=j/KWXlWgdaC4vRY0+t75eBECWQHw/OHFzDMEjadDX8C1jDIdY4ufEcdcVwb+2PfuI5 MuA8R93Y8amGEZIaFEAdaAsukq57jokOfgvBrJyh1DZ1naBOBAx2uP9a75az/FL5lp9/ 2LiVxclNI6rH8UPQ2o3XcYHZ27nis7nm2c8rWQbkmFruE338lo7WGW6gv57KsJQb9oTb gpzoA0JHy0yKqBxgkjS6kBmOKkLKhOPl1U3FkQnwE7xLmJwQ2hSm3zJzHpjaaak0bBjF mguD6NxPTnNBsSCytiAy+lF5Ng5DBnb0YBnh1URNVLNI1xBAF0Gf6Ks97K930hfs/7h6 2xUA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@fb.com header.s=facebook header.b=E6q+lQmP; dkim=fail header.i=@fb.onmicrosoft.com header.s=selector1-fb-com header.b=XhFOT7k1; 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 b6-v6si8390847pls.625.2018.04.06.03.35.05; Fri, 06 Apr 2018 03:35:18 -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=E6q+lQmP; dkim=fail header.i=@fb.onmicrosoft.com header.s=selector1-fb-com header.b=XhFOT7k1; 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 S1752282AbeDFKdc (ORCPT + 99 others); Fri, 6 Apr 2018 06:33:32 -0400 Received: from mx0b-00082601.pphosted.com ([67.231.153.30]:42978 "EHLO mx0b-00082601.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751846AbeDFKd3 (ORCPT ); Fri, 6 Apr 2018 06:33:29 -0400 Received: from pps.filterd (m0109331.ppops.net [127.0.0.1]) by mx0a-00082601.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w36AXHU1009169; Fri, 6 Apr 2018 03:33:17 -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=XtrcnnD74/qpqBYLzOWybAN1Lh3QbaN+uIobs8mxu84=; b=E6q+lQmP63k8ixqBfRsk0O2vm7rFvyQ+xXjo5cvo8v/Wny6DKG33s/6+1HSwjKqTjbCA QWO2iPw9XogXmJQ6Hr9799+q1uR4SeDTbgiK/rK44w8GwIvTtp3duAgv5n2phi6UfCKg 8kF4iqXYwyuhOsjD/Gf4hc+lokGGs1ovXwE= Received: from mail.thefacebook.com ([199.201.64.23]) by mx0a-00082601.pphosted.com with ESMTP id 2h657yr6vc-1 (version=TLSv1 cipher=ECDHE-RSA-AES256-SHA bits=256 verify=NOT); Fri, 06 Apr 2018 03:33:16 -0700 Received: from NAM03-DM3-obe.outbound.protection.outlook.com (192.168.54.28) by o365-in.thefacebook.com (192.168.16.17) with Microsoft SMTP Server (TLS) id 14.3.361.1; Fri, 6 Apr 2018 03:33:14 -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; bh=XtrcnnD74/qpqBYLzOWybAN1Lh3QbaN+uIobs8mxu84=; b=XhFOT7k1nHLuhQyZvIzzwAgR1igk9gFQgItoQXM2KMGk0FOhZXhwGd2izwDfUANm0LRYNAN0v/LwNbqKiaKIdI6hhT0otED8KDoUqo9mVv/IjGO5DOuRm1+z6C0qzQXx3rwEFSLV5BQRAsX+d+KACK+EU+8rtYfNTG/UrQTep04= Received: from castle (2620:10d:c092:180::1:20dc) by BL2PR15MB1074.namprd15.prod.outlook.com (2603:10b6:201:17::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.653.12; Fri, 6 Apr 2018 10:33:09 +0000 Date: Fri, 6 Apr 2018 11:32:56 +0100 From: Roman Gushchin To: Andrew Morton CC: Al Viro , , Michal Hocko , Johannes Weiner , , , Subject: Re: [PATCH 3/3] dcache: account external names as indirectly reclaimable memory Message-ID: <20180406103250.GA3717@castle> References: <20180305133743.12746-1-guro@fb.com> <20180305133743.12746-5-guro@fb.com> <20180312211742.GR30522@ZenIV.linux.org.uk> <20180312223632.GA6124@castle> <20180313004532.GU30522@ZenIV.linux.org.uk> <20180405151123.df20d12168d8a38f7a6b02b5@linux-foundation.org> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: <20180405151123.df20d12168d8a38f7a6b02b5@linux-foundation.org> User-Agent: Mutt/1.9.2 (2017-12-15) X-Originating-IP: [2620:10d:c092:180::1:20dc] X-ClientProxiedBy: HE1PR09CA0059.eurprd09.prod.outlook.com (2603:10a6:7:3c::27) To BL2PR15MB1074.namprd15.prod.outlook.com (2603:10b6:201:17::8) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 445420f5-87b5-47a0-5469-08d59ba9cc71 X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(7020095)(4652020)(5600026)(4604075)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7153060)(7193020);SRVR:BL2PR15MB1074; X-Microsoft-Exchange-Diagnostics: 1;BL2PR15MB1074;3:41LU01q179FHZMAnOqkphW1LF9pc1RZy7Mh/1+gipo25opVefH2N7rBohFTrBsADcfhy439Ja3OtSdePhJzD8To/OfnSo2pXrdaLzNE2cqkr9Hn92AU8CrcUGysEkFN28wITnrgTHDLSSgpEgf4rFy6Sk+hmDULuOb7dVMHH1RPpTNXRvjpHYbnnIRnZ4D7mpYaRyfxS+HlIpw+WTPzfyspxziODKoB1B/u+1h92xg+zwSdGk+rkOiW71273Gr7l;25:INhkLlVHi5AgOmOwLYPO9pYkMzSc8AKW3h181oSf7pVhPiEVpoyoclDcLoM12V3FiLXtZRfdudHpSmbu2iz3w2amvWscnft/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eZVu9zhP3L70078K1l07EwDl24kn4VQ8rL2vsBLYd6cxeutHNtcMS0tf2tptg/+UHnqo3M/KM8DeVTebOcpsZ6n5TA8P6TIxY0YBwSmYGSlJkodGzMun/8RDyF+cLXqGa1Dk1URO9YPLkrTgYXw5yPaao5sl7SZqTRjgmw7LKVxBhs4F7iWrtNuTPav2VZF1ovfYFGaWHyHimlsAJvxNoHPM0/aE7xI1WTjEpsmOpDfWokEebWgxY3je1NJMV/Pw== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(3002001)(93006095)(93001095)(10201501046)(3231221)(11241501184)(944501327)(52105095)(6041310)(20161123558120)(20161123562045)(20161123564045)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011);SRVR:BL2PR15MB1074;BCL:0;PCL:0;RULEID:;SRVR:BL2PR15MB1074; X-Forefront-PRVS: 0634F37BFF X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10019020)(366004)(39380400002)(346002)(396003)(376002)(39860400002)(189003)(199004)(54906003)(52396003)(58126008)(53936002)(316002)(6116002)(16586007)(186003)(46003)(16526019)(23726003)(33656002)(7736002)(86362001)(93886005)(486006)(1076002)(15650500001)(47776003)(6496006)(305945005)(106356001)(5660300001)(476003)(81166006)(6246003)(229853002)(8936002)(9686003)(2906002)(11346002)(81156014)(8676002)(97736004)(6666003)(76176011)(68736007)(55016002)(478600001)(33716001)(50466002)(59450400001)(25786009)(33896004)(4326008)(52116002)(6916009)(105586002)(386003)(446003)(18370500001)(42262002);DIR:OUT;SFP:1102;SCL:1;SRVR:BL2PR15MB1074;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;BL2PR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/uy?= =?us-ascii?Q?6SNm7rnP8dfAsQAXTVDNF7q19q5dy0Zmc6lu0HDs//jMUKc1+RkcOQvk7MF5?= =?us-ascii?Q?RJYD27+l6P4/Tp+qgXnYxumIGvVJ5UvfqIssXyrB+b2pts1xsoUzFF3jjsjT?= =?us-ascii?Q?Iu0y78AdMJ9xVRghfX6rr4ecuVqJSx7QiPrBxEPLE7haKbZv0gp5f/mKri7x?= =?us-ascii?Q?NU43vH+/dvhn/xCLNFoVdS1hKvXEv66hB3rYwbIYxoB68RsYJhvnVgX8Rc85?= =?us-ascii?Q?BefDqlO3UxH65B/PbnhOShQLfEhekhlqmTT3hUPByLiEEMIUrLKI2A1qnOYK?= =?us-ascii?Q?wsPW1eKTUhyJISs72nRtpuVraeFp9IlcyU8CDeZUp39zUskBzT8bCuMZdO68?= =?us-ascii?Q?31/1vSUuBdipSvTu2V3YGk+KNGwKRfJ8O0PBKrrUwSYIqsb3Dmsm0nardiHl?= =?us-ascii?Q?QnN2vapD16stxP6GLW08LtTE+3/nYxPJIkxf3gjP+wg8M+TR+SikaxGmwh0N?= =?us-ascii?Q?xKQnw=3D=3D?= X-Microsoft-Antispam-Message-Info: UGK21CcLiSG4kf2T5jF5Ne8nwNMmvK+52w6FxzLxQsfvkPRPzkOCuQDvnCl0kgadFCIFzV/omOavmamVTP64HG6RPdTw08pPj9ibpk5I4StLxyJOxUq0T3i5ayzyDz2zeBYeobCAMD7iOkuyucvgOt+X1nI9gjOSnww6vXtLtvdBUb3jkr+iSSE92eitU4kL X-Microsoft-Exchange-Diagnostics: 1;BL2PR15MB1074;6:ELo9LHrLR5kvH5z3F8nfWpVPm4WjX8A6H/twa+8BG5GDp8JSLngJGOZei/5k2A6gkocNO/pefHTGZ1OgqjcPtfown3BpTmnOdrn/hbA9he9TUSUv89dOsPmQjRWqnPzIGW8fhdGpG7TbOCxpA60H2ChlVUCcMgPO5HpVWKE0RezrhDoGFJajx28E5Xf2W1orE1sdsnPGqcG+KW47w/+1sYqiXICJ8rh3lNsOuuRLq3h3vZrFcnP7vKhyzFbCsPCM8wRyeYLTVDKZaVrWkfE16+xsDLUmAX7qV6PUHQhoBQnwuQXuscTYZ5BsfPRv14HB+1M0ZOOuligG9h72LJOymW17/Ok1NG6LTjVb9Z8leta0umshEX7pd0V5e7X/ne/T+xKJKFMSfIl4o6U9Hnk75WcKTkar7ONCzBiCq3OiwQinz0B+b+VXf9yQoEa/IwbCpo2Z42241nPp6TgoRDU7Hw==;5:m8INAeOSqJ+i5dBXVedR/xsbRtyp71M+d05QDJwxBdPoqst+D1qP+cjyu08MyLrwkhTLFLILBWlW6rz87Y6mNZepEbvyKF+RT0JJpDDFLf/pq8evofh+isXiaMBk2tUVmLP9fuujNzBsnb1252RKsD/6LSqzqu34q1dGMnz1+DA=;24:9ZmYUGkN2qqCFKXObp7k6xXItywjLvfTyKZy6cnlmcixKLupUTjDcO73f/ZT5gWVpUNn4tXsi/62nHXZyhivlzRjSsnmLwBMzrwUP1CueQ4= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1;BL2PR15MB1074;7:66vdErMtqR9L9dEAz3tjMgoKpaHIox09EFQLckklhZ5WDOrAG8lG9lWcrqRsyB7UMjiU65/rX9tSTiaWplnlMi3Kv9VpI8VpCscKRwGVe9GRaEmm51ZcgQWWjSAiWcfkFCdDjv9CodoL/q5CbL5Pa6MGKIHlulE+qwTDtEzWRvTfeHz9Z/TgGRlS7anJ3+jFtJOT+QmwEVXDYYNlaHG/kvfeBZv9kktq+XtU3dyWaCV5KP4efUm/iw0QqAEzgCfl;20:vx/0g6ihY26DQWHQZK4UZ0n8vTqNK0YBtsrsPO76YqMc5mO7s5xuDpzftr5jvWus4HmpW912j+RTj+NSmJlrFD93LIa62dsAgA+GK334jm4t80m2I9UvVtY9r4QqEQUXLn7bCkaxsSl7YKPrF30pdsWltJNzo0XSvdZT4aQKV6g= X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Apr 2018 10:33:09.9639 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 445420f5-87b5-47a0-5469-08d59ba9cc71 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 8ae927fe-1255-47a7-a2af-5f3a069daaa2 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL2PR15MB1074 X-OriginatorOrg: fb.com X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2018-04-06_06:,, 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 Thu, Apr 05, 2018 at 03:11:23PM -0700, Andrew Morton wrote: > On Tue, 13 Mar 2018 00:45:32 +0000 Al Viro wrote: > > > On Mon, Mar 12, 2018 at 10:36:38PM +0000, Roman Gushchin wrote: > > > > > Ah, I see... > > > > > > I think, it's better to account them when we're actually freeing, > > > otherwise we will have strange path: > > > (indirectly) reclaimable -> unreclaimable -> free > > > > > > Do you agree? > > > > > +static void __d_free_external_name(struct rcu_head *head) > > > +{ > > > + struct external_name *name; > > > + > > > + name = container_of(head, struct external_name, u.head); > > > + > > > + mod_node_page_state(page_pgdat(virt_to_page(name)), > > > + NR_INDIRECTLY_RECLAIMABLE_BYTES, > > > + -ksize(name)); > > > + > > > + kfree(name); > > > +} > > > > Maybe, but then you want to call that from __d_free_external() and from > > failure path in __d_alloc() as well. Duplicating something that convoluted > > and easy to get out of sync is just asking for trouble. > > So.. where are we at with this issue? I assume that commit 0babe6fe1da3 ("dcache: fix indirectly reclaimable memory accounting") address the issue. __d_free_external_name() is now called from all release paths (including __d_free_external()) and is the only place where NR_INDIRECTLY_RECLAIMABLE_BYTES is decremented. __d_alloc()'s error path is slightly different, because I bump NR_INDIRECTLY_RECLAIMABLE_BYTES in a very last moment, when it's already clear, that no errors did occur. So we don't need to increase and decrease the counter back and forth. Thank you!