Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp3565181ybv; Mon, 10 Feb 2020 02:17:18 -0800 (PST) X-Google-Smtp-Source: APXvYqzhqDM0OO+IwXJB1mHz8x/BZwo3WgQJkl2EWxbxmRfBDvvwHmAYWEvQTZo/gZBGsvTduOiK X-Received: by 2002:aca:5844:: with SMTP id m65mr379705oib.136.1581329838652; Mon, 10 Feb 2020 02:17:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581329838; cv=none; d=google.com; s=arc-20160816; b=cZLpu88l0SkZju3N/bRO2rbBBSXAhUjOvYkntffAmgKlp2twDIKElQ/jEBGT/vLrE2 Cpc9Jy2R2AQD3rgPH060Q1nP6yZS2iohiTRGP+znBsB7hVTzDWMZ6u6Wjt6O2Y7w05no /JTTBcUoIkwjcyiNW/x6SN45GHYpyzfPf+n3+MpPPBkD5I4UBOazEVQyom3mF9wfZHXa uA/vRlU0VuLdZau3tuFEpeTYa2Kt2bGiNT2foaYOIQY2bQ1cqr0LSkPpk8QaKVARFUnh GQ/IXMu4msdggiAz6MbHlm3OX99VPBtl384RoQcFvlLLRTl6RPyivdJfsjvuWF4Es2/4 lx8g== 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; bh=WivPGPGgW0yLO0TL7d1PEjm+CM7S1tgy5YL7MyCxjH4=; b=mW16juCjMl74gBQ1gpfmK2Fs9AZkFFFtSwhT5J9V4U5+q6ie3TQfOZlL/BQ7xnmOSk fDrOOdqZV61Xg4k/QsSCRZaifUBUTif9w74DHnnc4kz/2G+mrrhFTBPmpkixmOkrbFXd PMyTkH+ObV+aHKr2k1/K4gKEEiDGVEkI5vTbIh8HRii3HHB8tGs+REkBCigukbX8bFtm QcYugZh0uZNhtnZlbHB6s9o7kZVH46BgSuu0KUnZZa9Wl5Oird24FqOdK//asLgOfXLb HnGtNn3UwPL+79+dmAO3Zf05EVj4RqIEEKy7vU5acuY/GvpEI25rIcETCweY9LoEb0tk 1YUw== 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 w26si4341390otl.213.2020.02.10.02.17.06; Mon, 10 Feb 2020 02:17:18 -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; 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 S1727452AbgBJKQe (ORCPT + 99 others); Mon, 10 Feb 2020 05:16:34 -0500 Received: from mx2.suse.de ([195.135.220.15]:43448 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726451AbgBJKQe (ORCPT ); Mon, 10 Feb 2020 05:16:34 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 570C7B17A; Mon, 10 Feb 2020 10:16:31 +0000 (UTC) Received: by quack2.suse.cz (Postfix, from userid 1000) id DE6281E0E2C; Mon, 10 Feb 2020 11:16:29 +0100 (CET) Date: Mon, 10 Feb 2020 11:16:29 +0100 From: Jan Kara To: John Hubbard Cc: Andrew Morton , Al Viro , Christoph Hellwig , Dan Williams , Dave Chinner , Ira Weiny , Jan Kara , Jason Gunthorpe , Jonathan Corbet , =?iso-8859-1?B?Suly9G1l?= Glisse , "Kirill A . Shutemov" , Michal Hocko , Mike Kravetz , Shuah Khan , Vlastimil Babka , Matthew Wilcox , linux-doc@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-rdma@vger.kernel.org, linux-mm@kvack.org, LKML Subject: Re: [PATCH v5 10/12] mm/gup: /proc/vmstat: pin_user_pages (FOLL_PIN) reporting Message-ID: <20200210101629.GC12923@quack2.suse.cz> References: <20200207033735.308000-1-jhubbard@nvidia.com> <20200207033735.308000-11-jhubbard@nvidia.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200207033735.308000-11-jhubbard@nvidia.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 -- Jan Kara SUSE Labs, CR