Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp3938322ybv; Mon, 10 Feb 2020 09:10:40 -0800 (PST) X-Google-Smtp-Source: APXvYqxxCotKV/OD/hHFFsHVYppLmK8DdkMVIxlZRfpzdXqXIAkyqWHE/VXS4mPT4wK5uCq75PkL X-Received: by 2002:aca:5083:: with SMTP id e125mr50891oib.96.1581354639955; Mon, 10 Feb 2020 09:10:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581354639; cv=none; d=google.com; s=arc-20160816; b=gcgJ5+7gyEiANdQZf5v3p0Pb3PFJqTzoQocU3lXSry2yqf+PMbzhVDHJAGhlemwVNa 62jzoCRq41lcBYEhNqlJOU/I3oh4ffwlDuXAhKqdF7aaw5KwZGTvAkSxXR0EpeF9x7cn PMM9Sd2SO6Hry0qYzfEzI1zDb8+W1KZ4nEVORBRFILsaaE8jALRhebgDup8UxFML8Azg e6RQMD3icO3rK7OpoGbghV2XNuQf+TgDtW7byeB/YVZv+kfKjLx9atnoBDk/3bodWIp7 3QDgtwm5kKsgFDreGW2f8EvII7Syu3suIQbaGGOjEijfIm6ArefMHbypWzglcfazrs3a EsCA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:dkim-signature:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=GFFwsx57sCxj2sUkp7PeUAMx5ZDz2er8KdXyQLBksyc=; b=NsQ+6dVwllimDPhhE6gsm+j3k86ioWK0Dqhho6pwKxkU+Mhx5CntuS8lI7hOsyFgl2 Ei/+46lfiYTG9Gdmnb112tI7ei64VK1sVSp/D2J9rZAejE1ojtXFcMZ3Nw5JVBoHz1vG EHnzmCIzNeUuv9F4grhLfdPKsGOdnzejoEXWUZctrcATzmHOQI5NYhhum4GLPDPDbkew XCxz3jSELaiJBhA2nFr8Tk2t52uPrZu+Mhe+0THmcoQk1vmXGifLcnSl7ll9ghBJBiOF 98vAxA57YW6MDvB7EOGdwIOCh8IvJql+vbPs3cG6eZePUvL2dYT5JoCYv4IRJtzXCSie yEHw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nvidia.com header.s=n1 header.b=mgiGuvh4; 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=nvidia.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r6si427886otn.216.2020.02.10.09.10.28; Mon, 10 Feb 2020 09:10:39 -0800 (PST) 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=@nvidia.com header.s=n1 header.b=mgiGuvh4; 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=nvidia.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728174AbgBJRKL (ORCPT + 99 others); Mon, 10 Feb 2020 12:10:11 -0500 Received: from hqnvemgate24.nvidia.com ([216.228.121.143]:17750 "EHLO hqnvemgate24.nvidia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728149AbgBJRKJ (ORCPT ); Mon, 10 Feb 2020 12:10:09 -0500 Received: from hqpgpgate101.nvidia.com (Not Verified[216.228.121.13]) by hqnvemgate24.nvidia.com (using TLS: TLSv1.2, DES-CBC3-SHA) id ; Mon, 10 Feb 2020 09:09:04 -0800 Received: from hqmail.nvidia.com ([172.20.161.6]) by hqpgpgate101.nvidia.com (PGP Universal service); Mon, 10 Feb 2020 09:10:07 -0800 X-PGP-Universal: processed; by hqpgpgate101.nvidia.com on Mon, 10 Feb 2020 09:10:07 -0800 Received: from [10.2.168.250] (10.124.1.5) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Mon, 10 Feb 2020 17:10:07 +0000 Subject: Re: [PATCH v5 10/12] mm/gup: /proc/vmstat: pin_user_pages (FOLL_PIN) reporting To: Jan Kara CC: Andrew Morton , Al Viro , Christoph Hellwig , Dan Williams , Dave Chinner , Ira Weiny , Jason Gunthorpe , Jonathan Corbet , =?UTF-8?B?SsOpcsO0bWUgR2xpc3Nl?= , "Kirill A . Shutemov" , Michal Hocko , Mike Kravetz , Shuah Khan , Vlastimil Babka , Matthew Wilcox , , , , , , LKML References: <20200207033735.308000-1-jhubbard@nvidia.com> <20200207033735.308000-11-jhubbard@nvidia.com> <20200210101629.GC12923@quack2.suse.cz> From: John Hubbard X-Nvconfidentiality: public Message-ID: <7fcc15f4-e548-78bc-788d-f93293a1be74@nvidia.com> Date: Mon, 10 Feb 2020 09:07:07 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.4.2 MIME-Version: 1.0 In-Reply-To: <20200210101629.GC12923@quack2.suse.cz> X-Originating-IP: [10.124.1.5] X-ClientProxiedBy: HQMAIL105.nvidia.com (172.20.187.12) To HQMAIL107.nvidia.com (172.20.187.13) Content-Type: text/plain; charset="utf-8"; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nvidia.com; s=n1; t=1581354545; bh=GFFwsx57sCxj2sUkp7PeUAMx5ZDz2er8KdXyQLBksyc=; h=X-PGP-Universal:Subject:To:CC:References:From:X-Nvconfidentiality: Message-ID:Date:User-Agent:MIME-Version:In-Reply-To: X-Originating-IP:X-ClientProxiedBy:Content-Type:Content-Language: Content-Transfer-Encoding; b=mgiGuvh4a8/j5qP8rVJeI+8VQbHf2jVdOGqN8dzHXZ+aeb7PZyeJbMOhxY+1OUqQ5 e12UVW9rEfOpg4y6UBRpdDTiOg0K2Lz6Jd2BtFewg+9KyFwPzPT7AP3Wzt6s+CkwmB rUuU0Q0ki0c9cXfzej3YnAfaBNDiecxV+Lx5Xmw8bNccE+px/ak0HTpJUmMOyZ0hgK 9nmpeudR7hWQ2f8b5IKfN1LJlE+w/bvqIwHXLJmN2ZGvt0UHj2RPFjU2kgHWUG+2cM wTUjRMQp5P5znDTg5h0Rzk288BjQiK8Jkvj7oxWo3tMlHRD66hPcedX3dSQGyreutP p41fLIcZHUnWg== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2/10/20 2:16 AM, Jan Kara wrote: > On Thu 06-02-20 19:37:33, John Hubbard wrote: >> @@ -2258,6 +2268,8 @@ static int record_subpages(struct page *page, unsigned long addr, >> >> static void put_compound_head(struct page *page, int refs, unsigned int flags) >> { >> + int orig_refs = refs; >> + >> if (flags & FOLL_PIN) { >> if (hpage_pincount_available(page)) >> hpage_pincount_sub(page, refs); >> @@ -2273,6 +2285,8 @@ static void put_compound_head(struct page *page, int refs, unsigned int flags) >> if (refs > 1) >> page_ref_sub(page, refs - 1); >> put_page(page); >> + >> + mod_node_page_state(page_pgdat(page), NR_FOLL_PIN_RELEASED, orig_refs); >> } > > Still not quite happy about this :) Now you update NR_FOLL_PIN_RELEASED > even if 'flags' don't have FOLL_PIN set. You need to have the > mod_node_page_state() inside the "if (flags & FOLL_PIN)" branch above... > > Honza Arggh, yes that's true. Thanks for catching that, will fix in v6. thanks, -- John Hubbard NVIDIA