From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id BF17AC433FE for ; Fri, 4 Feb 2022 20:21:42 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id BF17D6B007B; Fri, 4 Feb 2022 15:21:35 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id B78248D0005; Fri, 4 Feb 2022 15:21:35 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A174E6B007E; Fri, 4 Feb 2022 15:21:35 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 8F0326B007B for ; Fri, 4 Feb 2022 15:21:35 -0500 (EST) Received: from smtpin25.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 4A39018213814 for ; Fri, 4 Feb 2022 20:21:35 +0000 (UTC) X-FDA: 79106217750.25.5305AE2 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf03.hostedemail.com (Postfix) with ESMTP id DB2122000B for ; Fri, 4 Feb 2022 20:21:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=XL5FkBrc2ylV5KQH/3coVOI3jsRBl16W89t8vD99zAw=; b=jkYaZT3Ycuh9rDyCJLWRte1oto TgUTh+cdmgStfzhy5meqbDm3amqz55GHwM2UiqMAQrgbxbkBWkquOF3ur3C1sPDIDGzya70sixZi3 MFvXzOQB7f/YHvsOgranDOokRzyWGAr7rqQYYNDy+w+S2RN75scyVYAxeyjLMbjSJ1/BBtMYfTRDk isPJZVumR165Ve28HFzi8frNGEwPGbv5qNqYqBjwD0rz8sJb9dTX1+0/WRxjBg0scjuMJFk49Hi5T lZ8hqC1ph/nK1EbCc6XH9oKJa29nrU1E/0MV7HmiMuchYPiojKdAcCx4YhG2Cx/qNxyAw+B3HmzeF H9Ythg+Q==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1nG4jV-007Llp-9T; Fri, 04 Feb 2022 19:59:01 +0000 From: "Matthew Wilcox (Oracle)" To: linux-mm@kvack.org Cc: "Matthew Wilcox (Oracle)" , linux-kernel@vger.kernel.org, Christoph Hellwig , John Hubbard , Jason Gunthorpe , William Kucharski Subject: [PATCH 19/75] mm/hugetlb: Use try_grab_folio() instead of try_grab_compound_head() Date: Fri, 4 Feb 2022 19:57:56 +0000 Message-Id: <20220204195852.1751729-20-willy@infradead.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220204195852.1751729-1-willy@infradead.org> References: <20220204195852.1751729-1-willy@infradead.org> MIME-Version: 1.0 X-Rspam-User: nil X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: DB2122000B X-Stat-Signature: gk5o47yrfy8t6j83nes7tpwsnffma113 Authentication-Results: imf03.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=jkYaZT3Y; dmarc=none; spf=none (imf03.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org X-HE-Tag: 1644006094-250130 Content-Transfer-Encoding: quoted-printable X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: follow_hugetlb_page() only cares about success or failure, so it doesn't need to know the type of the returned pointer, only whether it's NULL or not. Signed-off-by: Matthew Wilcox (Oracle) Reviewed-by: Christoph Hellwig Reviewed-by: John Hubbard Reviewed-by: Jason Gunthorpe Reviewed-by: William Kucharski --- include/linux/mm.h | 3 --- mm/gup.c | 2 +- mm/hugetlb.c | 7 +++---- 3 files changed, 4 insertions(+), 8 deletions(-) diff --git a/include/linux/mm.h b/include/linux/mm.h index 703bc2ec40a9..da565dc1029d 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -1162,9 +1162,6 @@ static inline void get_page(struct page *page) } =20 bool __must_check try_grab_page(struct page *page, unsigned int flags); -struct page *try_grab_compound_head(struct page *page, int refs, - unsigned int flags); - =20 static inline __must_check bool try_get_page(struct page *page) { diff --git a/mm/gup.c b/mm/gup.c index 04a370b1580e..00227b2cb1cf 100644 --- a/mm/gup.c +++ b/mm/gup.c @@ -133,7 +133,7 @@ struct folio *try_grab_folio(struct page *page, int r= efs, unsigned int flags) return NULL; } =20 -struct page *try_grab_compound_head(struct page *page, +static inline struct page *try_grab_compound_head(struct page *page, int refs, unsigned int flags) { return &try_grab_folio(page, refs, flags)->page; diff --git a/mm/hugetlb.c b/mm/hugetlb.c index 61895cc01d09..5ce3a0d891c6 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c @@ -6072,7 +6072,7 @@ long follow_hugetlb_page(struct mm_struct *mm, stru= ct vm_area_struct *vma, =20 if (pages) { /* - * try_grab_compound_head() should always succeed here, + * try_grab_folio() should always succeed here, * because: a) we hold the ptl lock, and b) we've just * checked that the huge page is present in the page * tables. If the huge page is present, then the tail @@ -6081,9 +6081,8 @@ long follow_hugetlb_page(struct mm_struct *mm, stru= ct vm_area_struct *vma, * any way. So this page must be available at this * point, unless the page refcount overflowed: */ - if (WARN_ON_ONCE(!try_grab_compound_head(pages[i], - refs, - flags))) { + if (WARN_ON_ONCE(!try_grab_folio(pages[i], refs, + flags))) { spin_unlock(ptl); remainder =3D 0; err =3D -ENOMEM; --=20 2.34.1