Received: by 10.213.65.68 with SMTP id h4csp61205imn; Mon, 12 Mar 2018 17:46:51 -0700 (PDT) X-Google-Smtp-Source: AG47ELtzon0fdiyr+KfFEvr9sQtVQ1mciedNlzIq+Rgb1Bl+5qKLGJSmOHM9qAWp5H8IZnXutUkp X-Received: by 10.99.182.10 with SMTP id j10mr8116230pgf.122.1520902011518; Mon, 12 Mar 2018 17:46:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1520902011; cv=none; d=google.com; s=arc-20160816; b=jrz6lagC6dyqPRoCYl73Obd1T9wVNOQVKz9OKFBijNND+wUyM7CERvmbOKw5flB0h0 KGIAJb1vFyjV1WheD95lY89Aw0AJeyYD+FEYWxndorrmu0KcKE89QetdqcPw1Rkc6NJO XNWJpEBwJ2+d57qO7lKrAcPlfW+THWvCATgU54W8oFBL/ynS9awjPs6NCJfPVhhnFj+r dhfvHTI+sP/bL8R8kZZ+xMdATKYK5pAaCPW5+6fSm9QKmlU1DNz9RZK+ZoXLuCRiPulh yDL7DjD7TreaBD+5T+KCv1HOmjiHdrw8DN6z1kuAu40EE9pXP1z7BH94gLYBYGLDx1k7 fKXA== 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:arc-authentication-results; bh=Q0fDWMbYNIulfA32cXs50gMTHLyBf5H7feZqAiXWlE0=; b=pO8BlVotBSuBa2vkbaInq/PqbvCNRXcrm/bAa1B3BhfQBKiuehjz3t3IqcSo41rYAM VUd5WcGy9rw8jRwWs2hcQTXrRkTKK08ObUm9yZe/3vprKR3Q150dakOf09e2SWqAdiy6 vaQw4lJ/4n0kLfOwBX//rOxxAzeaxmMdo0ZxmVWvlZu4H3MRD0dfiCm2OCEXF5DiNtlw BFeWh8yo8d4GMKpfh26VxV7vrKs0iFl+k13Gr/fr7ixVb2c/fsNYpem82vBtl/fGeeXW 3Buw+LxdJPBiQXWwH13OpFHu8HHXNzNGWdVJfolBJFbWRmFjwUmeHMr9lzflb58jPzhB 5n/A== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u2-v6si6818072plm.476.2018.03.12.17.46.37; Mon, 12 Mar 2018 17:46:51 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932379AbeCMApj (ORCPT + 99 others); Mon, 12 Mar 2018 20:45:39 -0400 Received: from zeniv.linux.org.uk ([195.92.253.2]:59946 "EHLO ZenIV.linux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932266AbeCMApi (ORCPT ); Mon, 12 Mar 2018 20:45:38 -0400 Received: from viro by ZenIV.linux.org.uk with local (Exim 4.87 #1 (Red Hat Linux)) id 1evY4K-0006U6-R7; Tue, 13 Mar 2018 00:45:32 +0000 Date: Tue, 13 Mar 2018 00:45:32 +0000 From: Al Viro To: Roman Gushchin Cc: linux-mm@kvack.org, Andrew Morton , Michal Hocko , Johannes Weiner , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-team@fb.com Subject: Re: [PATCH 3/3] dcache: account external names as indirectly reclaimable memory Message-ID: <20180313004532.GU30522@ZenIV.linux.org.uk> References: <20180305133743.12746-1-guro@fb.com> <20180305133743.12746-5-guro@fb.com> <20180312211742.GR30522@ZenIV.linux.org.uk> <20180312223632.GA6124@castle> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180312223632.GA6124@castle> User-Agent: Mutt/1.9.1 (2017-09-22) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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.