Received: by 2002:a25:31c3:0:0:0:0:0 with SMTP id x186csp54381ybx; Thu, 31 Oct 2019 15:49:32 -0700 (PDT) X-Google-Smtp-Source: APXvYqz6xwOq7MxOi16yoc91wPgQCkvhgqpsKiDhwrRO6i/125Lve/AHA7zRQPdtiK05MTBxW0qv X-Received: by 2002:a50:d54c:: with SMTP id f12mr9198448edj.116.1572562172486; Thu, 31 Oct 2019 15:49:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1572562172; cv=none; d=google.com; s=arc-20160816; b=CjcvDsO4y0dPtMcu01DG4VtlAXnkQ9gD0ESeSjxrS77y8bihJ92+bJW/rvyL/xoRK8 bPJCt9yJxgQN2inmryYF+1xFf09zg69Ngbwk4K+FytJAJ7Yuu/vWmzk/okxOCR2QtGwu eHvEq+RPGJG+ZCgap5LIFzglJVVPfOR/3NpWJn8mZNBjYstjOtxohbBq5BR4xITzftWv di3gGIG1q28zPTQuvrmYxhZJt7sGECxdjK0CMVwKgqLBJfhfz9/FRmF6tGRngi2qAHIX xk8dsLyWuSgmowBrKBYURcWWU/ZXdkNT1zJgG9bRdGS3EjfDfbI0picvBggOnW8WYaaq irew== 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=epEQW1gVL6sFx1+SFG4OTygh925uGmBdEX6GQPhHLUE=; b=EsBu0p4QGTJvhY63Og4Ke//aJHqI42mKVN/uoAl999CJoIQlHCPFgaiGsIoiJxcFUP i93FdbnFBk/kWUXzRDv+3vZGzSYu9czxZG11+Kok5hJMyQip6SAOcBQMbJkgId6+VAdi WwYa7ZXxXog3A3rTTHoSo4RoN2Fi/cG8ZWhlVcl+QrA/yFMEpeGq+R/v9IBnf3ZPOhuC fweglxH/6Lm6ifU3YNG8VwEnnyBZLTNH0ekni5omrSgDJ8YYdQ0BWh1wZT12diV2u63Z B6Ala952MK0aDWxX0enXAqHQT3pGVSGQXwtSVJ/5W50ZknCi97tCTy5mOTFtX0Wc8BNZ 3x+w== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a28si5681113edc.5.2019.10.31.15.49.09; Thu, 31 Oct 2019 15:49:32 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729870AbfJaVJ7 (ORCPT + 99 others); Thu, 31 Oct 2019 17:09:59 -0400 Received: from mga01.intel.com ([192.55.52.88]:43170 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727957AbfJaVJ6 (ORCPT ); Thu, 31 Oct 2019 17:09:58 -0400 X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 31 Oct 2019 14:09:57 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.68,253,1569308400"; d="scan'208";a="375376881" Received: from iweiny-desk2.sc.intel.com ([10.3.52.157]) by orsmga005.jf.intel.com with ESMTP; 31 Oct 2019 14:09:55 -0700 Date: Thu, 31 Oct 2019 14:09:55 -0700 From: Ira Weiny To: John Hubbard Cc: Andrew Morton , Al Viro , Alex Williamson , Benjamin Herrenschmidt , =?iso-8859-1?Q?Bj=F6rn_T=F6pel?= , Christoph Hellwig , Dan Williams , Daniel Vetter , Dave Chinner , David Airlie , "David S . Miller" , Jan Kara , Jason Gunthorpe , Jens Axboe , Jonathan Corbet , =?iso-8859-1?B?Suly9G1l?= Glisse , Magnus Karlsson , Mauro Carvalho Chehab , Michael Ellerman , Michal Hocko , Mike Kravetz , Paul Mackerras , Shuah Khan , Vlastimil Babka , bpf@vger.kernel.org, dri-devel@lists.freedesktop.org, kvm@vger.kernel.org, linux-block@vger.kernel.org, linux-doc@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-media@vger.kernel.org, linux-rdma@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, netdev@vger.kernel.org, linux-mm@kvack.org, LKML , Christoph Hellwig , "Aneesh Kumar K . V" Subject: Re: [PATCH 02/19] mm/gup: factor out duplicate code from four routines Message-ID: <20191031210954.GE14771@iweiny-DESK2.sc.intel.com> References: <20191030224930.3990755-1-jhubbard@nvidia.com> <20191030224930.3990755-3-jhubbard@nvidia.com> <20191031183549.GC14771@iweiny-DESK2.sc.intel.com> <75b557f7-24b2-740c-2640-2f914d131600@nvidia.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <75b557f7-24b2-740c-2640-2f914d131600@nvidia.com> User-Agent: Mutt/1.11.1 (2018-12-01) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Oct 31, 2019 at 11:43:37AM -0700, John Hubbard wrote: > 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. It is a NIT perhaps but I feel like the signature of a function should stand on it's own. What this does is mix the meaning of this function with those calling it. Which IMO is not good style. We can see what others say. Ira > > thanks, > > John Hubbard > NVIDIA >