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 X-Spam-Level: X-Spam-Status: No, score=-6.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D20AFC43331 for ; Tue, 12 Nov 2019 21:13:27 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 8E04C2196E for ; Tue, 12 Nov 2019 21:13:27 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8E04C2196E Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=perches.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 0A28E6B0003; Tue, 12 Nov 2019 16:13:27 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 0544A6B0005; Tue, 12 Nov 2019 16:13:27 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id EAB126B0006; Tue, 12 Nov 2019 16:13:26 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0106.hostedemail.com [216.40.44.106]) by kanga.kvack.org (Postfix) with ESMTP id D28C86B0003 for ; Tue, 12 Nov 2019 16:13:26 -0500 (EST) Received: from smtpin06.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with SMTP id 931F9181AEF07 for ; Tue, 12 Nov 2019 21:13:26 +0000 (UTC) X-FDA: 76148876412.06.ball64_1e048b3bccc4b X-HE-Tag: ball64_1e048b3bccc4b X-Filterd-Recvd-Size: 4479 Received: from smtprelay.hostedemail.com (smtprelay0097.hostedemail.com [216.40.44.97]) by imf12.hostedemail.com (Postfix) with ESMTP for ; Tue, 12 Nov 2019 21:13:26 +0000 (UTC) Received: from filter.hostedemail.com (clb03-v110.bra.tucows.net [216.40.38.60]) by smtprelay04.hostedemail.com (Postfix) with ESMTP id E3C03180A68D7; Tue, 12 Nov 2019 21:13:25 +0000 (UTC) X-Session-Marker: 6A6F6540706572636865732E636F6D X-HE-Tag: head78_1dbdc56a2c617 X-Filterd-Recvd-Size: 3277 Received: from XPS-9350.home (unknown [47.151.135.224]) (Authenticated sender: joe@perches.com) by omf17.hostedemail.com (Postfix) with ESMTPA; Tue, 12 Nov 2019 21:13:24 +0000 (UTC) Message-ID: Subject: Re: [PATCH 2/2] hugetlbfs: convert macros to static inline, fix sparse warning From: Joe Perches To: Mike Kravetz , linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: Michael Ellerman , Ben Dooks , Jason Gunthorpe , kbuild@lists.01.org, Andrew Morton Date: Tue, 12 Nov 2019 13:13:07 -0800 In-Reply-To: <20191112194558.139389-3-mike.kravetz@oracle.com> References: <20191112194558.139389-1-mike.kravetz@oracle.com> <20191112194558.139389-3-mike.kravetz@oracle.com> Content-Type: text/plain; charset="ISO-8859-1" User-Agent: Evolution 3.34.1-2 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit 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: On Tue, 2019-11-12 at 11:45 -0800, Mike Kravetz wrote: > huge_pte_offset() produced a sparse warning due to an improper > return type when the kernel was built with !CONFIG_HUGETLB_PAGE. > Fix the bad type and also convert all the macros in this block > to static inline wrappers. Two existing wrappers in this block > had lines in excess of 80 columns so clean those up as well. > > No functional change. > > Reported-by: Ben Dooks > Suggested-by: Jason Gunthorpe > Signed-off-by: Mike Kravetz > --- > include/linux/hugetlb.h | 137 +++++++++++++++++++++++++++++++++------- > 1 file changed, 115 insertions(+), 22 deletions(-) > > diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h > index 53fc34f930d0..ef412fe0be3d 100644 > --- a/include/linux/hugetlb.h > +++ b/include/linux/hugetlb.h > @@ -164,38 +164,130 @@ static inline void adjust_range_if_pmd_sharing_possible( > { > } > > -#define follow_hugetlb_page(m,v,p,vs,a,b,i,w,n) ({ BUG(); 0; }) > -#define follow_huge_addr(mm, addr, write) ERR_PTR(-EINVAL) > -#define copy_hugetlb_page_range(src, dst, vma) ({ BUG(); 0; }) > +static inline long follow_hugetlb_page(struct mm_struct *mm, > + struct vm_area_struct *vma, struct page **pages, > + struct vm_area_struct **vmas, unsigned long *position, > + unsigned long *nr_pages, long i, unsigned int flags, > + int *nonblocking) > +{ > + BUG(); While this is not different from the original, perhaps this is also an opportunity to change the BUG()s to WARN()s. > +static inline int copy_hugetlb_page_range(struct mm_struct *dst, > + struct mm_struct *src, struct vm_area_struct *vma) > +{ > + BUG(); > + return 0; > +} [] > +static inline void hugetlb_free_pgd_range(struct mmu_gather *tlb, > + unsigned long addr, unsigned long end, > + unsigned long floor, unsigned long ceiling) > +{ > + BUG(); > +} > + > +static inline int hugetlb_mcopy_atomic_pte(struct mm_struct *dst_mm, > + pte_t *dst_pte, > + struct vm_area_struct *dst_vma, > + unsigned long dst_addr, > + unsigned long src_addr, > + struct page **pagep) > +{ > + BUG(); > + return 0; > +}