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=-8.4 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 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 99D50C10F29 for ; Tue, 17 Mar 2020 08:26:07 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 2A29E206EC for ; Tue, 17 Mar 2020 08:26:07 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="FGAQY5iL" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2A29E206EC Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 848216B0005; Tue, 17 Mar 2020 04:26:06 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 7D19D6B0006; Tue, 17 Mar 2020 04:26:06 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 672EB6B0007; Tue, 17 Mar 2020 04:26:06 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0164.hostedemail.com [216.40.44.164]) by kanga.kvack.org (Postfix) with ESMTP id 4C2E16B0005 for ; Tue, 17 Mar 2020 04:26:06 -0400 (EDT) Received: from smtpin29.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 2C8B5180AD815 for ; Tue, 17 Mar 2020 08:26:06 +0000 (UTC) X-FDA: 76604171532.29.dirt33_5252489a79714 X-HE-Tag: dirt33_5252489a79714 X-Filterd-Recvd-Size: 5202 Received: from us-smtp-delivery-74.mimecast.com (us-smtp-delivery-74.mimecast.com [216.205.24.74]) by imf48.hostedemail.com (Postfix) with ESMTP for ; Tue, 17 Mar 2020 08:26:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1584433565; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=Zv526Cug7eY3LYo4JWW5rNWpX9kZexTXBv9hVKgtHOI=; b=FGAQY5iLqAIm5D3RRBv1258ppMpw8FQicnAPfnZkRqFfNDDGDlvUW+0PRNuu2e4zgtOHjV Q0NZxtHS2nCU3Ns/7IA9bzBejA3rl31zNl3EBql1+7pVQnlQsYnbxeXf8Gk+NsHd5NpJND b7tLMVQp5qPahQS5K2Ndm6ddS5tOPJ8= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-359-s_xHe4yRNWGQaioXiN7t1Q-1; Tue, 17 Mar 2020 04:25:57 -0400 X-MC-Unique: s_xHe4yRNWGQaioXiN7t1Q-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id E08E28017DF; Tue, 17 Mar 2020 08:25:55 +0000 (UTC) Received: from localhost (ovpn-12-34.pek2.redhat.com [10.72.12.34]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D46D69CA3; Tue, 17 Mar 2020 08:25:53 +0000 (UTC) Date: Tue, 17 Mar 2020 16:25:50 +0800 From: Baoquan He To: Christophe Leroy Cc: Mike Kravetz , Andrew Morton , Nishanth Aravamudan , Nick Piggin , Adam Litke , Andi Kleen , linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-mm@kvack.org Subject: Re: [PATCH] mm/hugetlb: Fix build failure with HUGETLB_PAGE but not HUGEBTLBFS Message-ID: <20200317082550.GA3375@MiWiFi-R3L-srv> References: <7e8c3a3c9a587b9cd8a2f146df32a421b961f3a2.1584432148.git.christophe.leroy@c-s.fr> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <7e8c3a3c9a587b9cd8a2f146df32a421b961f3a2.1584432148.git.christophe.leroy@c-s.fr> User-Agent: Mutt/1.10.1 (2018-07-13) X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 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 03/17/20 at 08:04am, Christophe Leroy wrote: > When CONFIG_HUGETLB_PAGE is set but not CONFIG_HUGETLBFS, the > following build failure is encoutered: >From the definition of HUGETLB_PAGE, isn't it relying on HUGETLBFS? I could misunderstand the def_bool, please correct me if I am wrong. config HUGETLB_PAGE def_bool HUGETLBFS > > In file included from arch/powerpc/mm/fault.c:33:0: > ./include/linux/hugetlb.h: In function 'hstate_inode': > ./include/linux/hugetlb.h:477:9: error: implicit declaration of function 'HUGETLBFS_SB' [-Werror=implicit-function-declaration] > return HUGETLBFS_SB(i->i_sb)->hstate; > ^ > ./include/linux/hugetlb.h:477:30: error: invalid type argument of '->' (have 'int') > return HUGETLBFS_SB(i->i_sb)->hstate; > ^ > > Gate hstate_inode() with CONFIG_HUGETLBFS instead of CONFIG_HUGETLB_PAGE. > > Reported-by: kbuild test robot > Link: https://patchwork.ozlabs.org/patch/1255548/#2386036 > Fixes: a137e1cc6d6e ("hugetlbfs: per mount huge page sizes") > Cc: stable@vger.kernel.org > Signed-off-by: Christophe Leroy > --- > include/linux/hugetlb.h | 19 ++++++++----------- > 1 file changed, 8 insertions(+), 11 deletions(-) > > diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h > index 1e897e4168ac..dafb3d70ff81 100644 > --- a/include/linux/hugetlb.h > +++ b/include/linux/hugetlb.h > @@ -390,7 +390,10 @@ static inline bool is_file_hugepages(struct file *file) > return is_file_shm_hugepages(file); > } > > - > +static inline struct hstate *hstate_inode(struct inode *i) > +{ > + return HUGETLBFS_SB(i->i_sb)->hstate; > +} > #else /* !CONFIG_HUGETLBFS */ > > #define is_file_hugepages(file) false > @@ -402,6 +405,10 @@ hugetlb_file_setup(const char *name, size_t size, vm_flags_t acctflag, > return ERR_PTR(-ENOSYS); > } > > +static inline struct hstate *hstate_inode(struct inode *i) > +{ > + return NULL; > +} > #endif /* !CONFIG_HUGETLBFS */ > > #ifdef HAVE_ARCH_HUGETLB_UNMAPPED_AREA > @@ -472,11 +479,6 @@ extern unsigned int default_hstate_idx; > > #define default_hstate (hstates[default_hstate_idx]) > > -static inline struct hstate *hstate_inode(struct inode *i) > -{ > - return HUGETLBFS_SB(i->i_sb)->hstate; > -} > - > static inline struct hstate *hstate_file(struct file *f) > { > return hstate_inode(file_inode(f)); > @@ -729,11 +731,6 @@ static inline struct hstate *hstate_vma(struct vm_area_struct *vma) > return NULL; > } > > -static inline struct hstate *hstate_inode(struct inode *i) > -{ > - return NULL; > -} > - > static inline struct hstate *page_hstate(struct page *page) > { > return NULL; > -- > 2.25.0 > >