Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp1691923ybc; Wed, 13 Nov 2019 02:53:42 -0800 (PST) X-Google-Smtp-Source: APXvYqyXmAG9Wes5dgFyS63VRuHRTVLgPMdY8PmBKEvpwWe8cfz+O2qvUvzWA3TdWuy1ZQAIawA3 X-Received: by 2002:aa7:d0d4:: with SMTP id u20mr2806011edo.112.1573642422845; Wed, 13 Nov 2019 02:53:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573642422; cv=none; d=google.com; s=arc-20160816; b=W9a4uFXlgPYfrmP5qRR+JyOd5V0x2/9pIwUL8i99z/WYI/SzNy/QBPJV9OES+SXvN/ zAfTN2HKdnhECHOJBdn+uNRI/oBn3Z6CS+4fUdyDE4qMTFHEOw+pVugcLn5R5fP59TMS 8piv+6iuNzijNHPSbWS2kZMzhhJGj0HWEaq+48WZx13Q/A9nUB/XxRIEScXz2xPQU0Gu 5h+1KwmtzJsUu4fpt3+XeTwf9dHpcnUWs9jgV9OURxcV9nvyKmqERti5C6iTJFKCt8iL M7qysx1pN+HDDeilOSwheX2YS2IAPH7SoIkOo+k6w4z1Pxlk/jN+gJOFhaajjlgvADwb +/KQ== 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=xepXuLo61NwxXCsLqRJjMyYatgtlGKLS1/i9cRweGwM=; b=R3R6KyCRdW94/+dDuJ+LISaI0cl0s/V7Mf6Pt826YMdGF5APNmfoz3Se8w8ckQEGCf Bzk292gheRZ0COkIrWfV8ubuvJTz6DYFP6AEYbzMUyfW90o15mYJw+729xiiovNR506I zhw1Fk5aGD3zo2FapsXJ2rSqP8ICQjar2U+FhCLttJfAIunvTKeXoIhmKiQjb3migcPL kL4wZD263tB4Dkpqf7QFIAQDVuyAqH1C/1RWCFMiE2mUFW/LJcbKxL6cnd7Sb6OD8noL wCpkqqlqQrJG1CcH6G/dxvW6O0lwnmuXmLgJSJi0jHZLiOZOg5D7xrJkfZmlbhGxrNNI gALg== 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 g6si1270354edk.210.2019.11.13.02.53.18; Wed, 13 Nov 2019 02:53:42 -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 S1727745AbfKMKu1 (ORCPT + 99 others); Wed, 13 Nov 2019 05:50:27 -0500 Received: from mx2.suse.de ([195.135.220.15]:33800 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727432AbfKMKu1 (ORCPT ); Wed, 13 Nov 2019 05:50:27 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 91AAEB320; Wed, 13 Nov 2019 10:50:23 +0000 (UTC) Received: by quack2.suse.cz (Postfix, from userid 1000) id 550261E1498; Wed, 13 Nov 2019 11:50:23 +0100 (CET) Date: Wed, 13 Nov 2019 11:50:23 +0100 From: Jan Kara 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" , Ira Weiny , 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 Subject: Re: [PATCH v4 03/23] mm/gup: move try_get_compound_head() to top, fix minor issues Message-ID: <20191113105023.GG6367@quack2.suse.cz> References: <20191113042710.3997854-1-jhubbard@nvidia.com> <20191113042710.3997854-4-jhubbard@nvidia.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20191113042710.3997854-4-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 Tue 12-11-19 20:26:50, John Hubbard wrote: > An upcoming patch uses try_get_compound_head() more widely, > so move it to the top of gup.c. > > Also fix a tiny spelling error and a checkpatch.pl warning. > > Signed-off-by: John Hubbard Looks good. You can add: Reviewed-by: Jan Kara Honza > --- > mm/gup.c | 29 +++++++++++++++-------------- > 1 file changed, 15 insertions(+), 14 deletions(-) > > diff --git a/mm/gup.c b/mm/gup.c > index 199da99e8ffc..933524de6249 100644 > --- a/mm/gup.c > +++ b/mm/gup.c > @@ -29,6 +29,21 @@ struct follow_page_context { > unsigned int page_mask; > }; > > +/* > + * Return the compound head page with ref appropriately incremented, > + * or NULL if that failed. > + */ > +static inline struct page *try_get_compound_head(struct page *page, int refs) > +{ > + struct page *head = compound_head(page); > + > + if (WARN_ON_ONCE(page_ref_count(head) < 0)) > + return NULL; > + if (unlikely(!page_cache_add_speculative(head, refs))) > + return NULL; > + return head; > +} > + > /** > * put_user_pages_dirty_lock() - release and optionally dirty gup-pinned pages > * @pages: array of pages to be maybe marked dirty, and definitely released. > @@ -1793,20 +1808,6 @@ static void __maybe_unused undo_dev_pagemap(int *nr, int nr_start, > } > } > > -/* > - * Return the compund head page with ref appropriately incremented, > - * or NULL if that failed. > - */ > -static inline struct page *try_get_compound_head(struct page *page, int refs) > -{ > - struct page *head = compound_head(page); > - if (WARN_ON_ONCE(page_ref_count(head) < 0)) > - return NULL; > - if (unlikely(!page_cache_add_speculative(head, refs))) > - return NULL; > - return head; > -} > - > #ifdef CONFIG_ARCH_HAS_PTE_SPECIAL > static int gup_pte_range(pmd_t pmd, unsigned long addr, unsigned long end, > unsigned int flags, struct page **pages, int *nr) > -- > 2.24.0 > -- Jan Kara SUSE Labs, CR