Received: by 2002:a25:31c3:0:0:0:0:0 with SMTP id x186csp1517553ybx; Thu, 31 Oct 2019 11:46:00 -0700 (PDT) X-Google-Smtp-Source: APXvYqx/5RbkcuFZnhFT21dY9dJeWCrMuRIRR1hx+q3jg1PHCt1yDGibAaUqtRaJgeEodEMcCPeb X-Received: by 2002:aa7:c048:: with SMTP id k8mr7865618edo.254.1572547560656; Thu, 31 Oct 2019 11:46:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1572547560; cv=none; d=google.com; s=arc-20160816; b=l3RLbVdklrXGOyhBYqaG28ufeyrU43KM3o9lqHyhXFiSzwSdZtkjaQ3vOgc7B6lNNe PcJRzMZTTwylv42cN4GW/3TS23ObeXv1JuZD65k954UMND0eYeH9i9ZOoQHR221IFiGL 7cIfVQEku1nNyr9qSa49jA0nRs/PVwAzUIcK5blLpYW6uJfPaC2R8XdzR87ABZSsA9Wo yTXcpknkMM8Xv6gjF6AOGH2wuEaW6Q64c5MQu6ttggApqQgziMZBtFp18JAEjtVmubdy udQ422gQAFQNkN0GLjSRxbOYn2ytuOobycrsUf/Ol525r4s5Xn4fnRga+Wlm0NwF72EC 4bZg== 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=tVTQ7w70LzXRWNozMw5pcweYnGaSw6wKS7taKOoMvgQ=; b=sMCSFku8hrK5/5DceWLeIyTyo0z5OvFULCctKVly6EauSMRN+bfKkRU9KP9DN69JDQ JHHW90A5iO9fXQL3YISCPa+Ryorp8YVAprgF8mJrfz4khBSZoqdZXAfDPYUPztYQsobk 3J8YKYrQ44AsPGUUOdzytyCd7qw87grH6fdSl/3bHkUwih/9QFVl6E12K5LpqZDQk82j gwsoEeC1tMxH55mZ2qcsDdWFg9V6dthRn+rxIzqDlzR2fKZvkcOXS4HJztKvbvUaHmdU KF5BwIuzwi6dp8NIUUr8m7m+mMtXW72exQj7LYOtDFX44dk31XG9U5lJhEi3rHaTvazS zjgw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nvidia.com header.s=n1 header.b=ItGdt9jP; 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 k43si4658248edb.150.2019.10.31.11.45.37; Thu, 31 Oct 2019 11:46:00 -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=@nvidia.com header.s=n1 header.b=ItGdt9jP; 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 S1729457AbfJaSnn (ORCPT + 99 others); Thu, 31 Oct 2019 14:43:43 -0400 Received: from hqemgate16.nvidia.com ([216.228.121.65]:9937 "EHLO hqemgate16.nvidia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729304AbfJaSnm (ORCPT ); Thu, 31 Oct 2019 14:43:42 -0400 Received: from hqpgpgate101.nvidia.com (Not Verified[216.228.121.13]) by hqemgate16.nvidia.com (using TLS: TLSv1.2, DES-CBC3-SHA) id ; Thu, 31 Oct 2019 11:43:44 -0700 Received: from hqmail.nvidia.com ([172.20.161.6]) by hqpgpgate101.nvidia.com (PGP Universal service); Thu, 31 Oct 2019 11:43:38 -0700 X-PGP-Universal: processed; by hqpgpgate101.nvidia.com on Thu, 31 Oct 2019 11:43:38 -0700 Received: from [10.110.48.28] (10.124.1.5) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Thu, 31 Oct 2019 18:43:37 +0000 Subject: Re: [PATCH 02/19] mm/gup: factor out duplicate code from four routines To: Ira Weiny CC: Andrew Morton , Al Viro , Alex Williamson , Benjamin Herrenschmidt , =?UTF-8?B?QmrDtnJuIFTDtnBlbA==?= , Christoph Hellwig , Dan Williams , Daniel Vetter , Dave Chinner , David Airlie , "David S . Miller" , Jan Kara , Jason Gunthorpe , Jens Axboe , Jonathan Corbet , =?UTF-8?B?SsOpcsO0bWUgR2xpc3Nl?= , Magnus Karlsson , Mauro Carvalho Chehab , Michael Ellerman , Michal Hocko , Mike Kravetz , Paul Mackerras , Shuah Khan , Vlastimil Babka , , , , , , , , , , , , , LKML , Christoph Hellwig , "Aneesh Kumar K . V" References: <20191030224930.3990755-1-jhubbard@nvidia.com> <20191030224930.3990755-3-jhubbard@nvidia.com> <20191031183549.GC14771@iweiny-DESK2.sc.intel.com> From: John Hubbard X-Nvconfidentiality: public Message-ID: <75b557f7-24b2-740c-2640-2f914d131600@nvidia.com> Date: Thu, 31 Oct 2019 11:43:37 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: <20191031183549.GC14771@iweiny-DESK2.sc.intel.com> X-Originating-IP: [10.124.1.5] X-ClientProxiedBy: HQMAIL101.nvidia.com (172.20.187.10) To HQMAIL107.nvidia.com (172.20.187.13) Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nvidia.com; s=n1; t=1572547424; bh=tVTQ7w70LzXRWNozMw5pcweYnGaSw6wKS7taKOoMvgQ=; 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=ItGdt9jPwuaxZEwBZAmOs6QRw3y1ekRCXIkAk884e9fffuoHSkMv3IXuQ7vsU8mJ+ 6sn7OAiE4sod/01pqRwiHcd242kDvH4VxxD334MsuTzmzdN+z2Tf4SkqA4hAm5RUgb DQz3BJUfTbN/krdQz9Fy07dfiumXVmkiVCv2liRNNsMOm+vluNn2/EZjBIhVCKbXA7 WVHpKyr4oMIxF6v1Zhp2z85oNzL7rjapLTslb3D5k7UtqTOOxnqps/GxGVAfXIr7tc /ZNTHbsdctd0KY29GLOk6czDGwBpbgAriROyniZOORRqIrKjgDjOEDFf1BfnHlTH/3 EDGo/Nn1OpOQw== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 10/31/19 11:35 AM, Ira Weiny wrote: > On Wed, Oct 30, 2019 at 03:49:13PM -0700, John Hubbard wrote: ... >> + >> +static void __remove_refs_from_head(struct page *page, int refs) >> +{ >> + /* Do a get_page() first, in case refs == page->_refcount */ >> + get_page(page); >> + page_ref_sub(page, refs); >> + put_page(page); >> +} > > I wonder if this is better implemented as "put_compound_head()"? To match the > try_get_compound_head() call below? Hi Ira, Good idea, I'll rename it to that. > >> + >> +static int __huge_pt_done(struct page *head, int nr_recorded_pages, int *nr) >> +{ >> + *nr += nr_recorded_pages; >> + SetPageReferenced(head); >> + return 1; > > When will this return anything but 1? > Never, but it saves a line at all four call sites, by having it return like that. I could see how maybe people would prefer to just have it be a void function, and return 1 directly at the call sites. Since this was a lower line count I thought maybe it would be slightly better, but it's hard to say really. thanks, John Hubbard NVIDIA