Received: by 2002:a25:e7d8:0:0:0:0:0 with SMTP id e207csp3519698ybh; Tue, 17 Mar 2020 01:29:40 -0700 (PDT) X-Google-Smtp-Source: ADFU+vsE7weMc88iTadckkT7L+/+fQbf3s/Zm0XO+ceGMpt7jl60Q9qOftVQO1T323MjmuLZGGyA X-Received: by 2002:aca:5354:: with SMTP id h81mr2563821oib.164.1584433780319; Tue, 17 Mar 2020 01:29:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1584433780; cv=none; d=google.com; s=arc-20160816; b=E7F7OaxDJ4RIys79CqqUc4DcX0YZ7kRhJbAQgDR+QsWQpvNOpxPm2B+EbQejax59fk Eq+PX+epfrdWzcL0E8bJt6Y5Svx0M3ZUvnlq0IAQ6e3TqDNGapY/jgoG6LmLls8V27n7 sPB6OCZ8YTaajf2NXd9PQvHouWUjbrEyezeW4gRyMPk5xpO8WYqh/2X6+mf4eqMCDj2z 58sirjncOG0W5gskByU8yiyH6KYJEdl/BdP4egb1VPGKaGXnswWrzWkEDzCnUC9nzYuW c0XvO1I2Pe/lBmqL+bjFOO8CHTYH8WvW/Bw8mKsUGwkecSRB7S/JyThUw9jr6wx51Vf7 PtEw== 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:dkim-signature; bh=Zv526Cug7eY3LYo4JWW5rNWpX9kZexTXBv9hVKgtHOI=; b=vAHUFIzxZqW+t4Wf/ZMopxjnwuiTH3lFOXEElFF1ibuPFAsKHfo1OHzqQ4rgywg0hK vyPc4AnKp9hkqGtSA3BAqQFo1jvHtPXHcCg0E6z5Tbr6e6l0/1pHzsN1z16B/IYa+u99 A6ScRZz9omwpQoA0UQClNK2pLRtL/pXDtWwXSnleMq8ksRUjBnCRck3B7TDFGMLUo3sL QQSy/SHNbSJZTxc8ZppAogsZ2jBcjnBkNzB07fGe7nzMhOu8oBQVXb6mPVm8p3GHiouJ SmnJTztVYyegvY77jSYS4gLu0eBxIu60f+X3Y8eu3OmLujth3NUqZhE+PvxLxUcm+rMR 6iIw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=gEJPe7IK; 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=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f20si1336533otl.313.2020.03.17.01.29.28; Tue, 17 Mar 2020 01:29:40 -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; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=gEJPe7IK; 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=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726132AbgCQI2D (ORCPT + 99 others); Tue, 17 Mar 2020 04:28:03 -0400 Received: from us-smtp-delivery-74.mimecast.com ([63.128.21.74]:29984 "EHLO us-smtp-delivery-74.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725868AbgCQI2D (ORCPT ); Tue, 17 Mar 2020 04:28:03 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1584433682; 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=gEJPe7IKpslBSzYStO1+EKIG7ldFXoNVQwzjfTYnoi/7jhc/OcFx4G1DQcuItdMrogwomQ 1I61rJNRl19lT7yDtR+Y7sGYqLu5d97Zix5xRLtrzYlh82PtVRrBEXe1K4n1lGjrfMnabD xg6GxjI3hwpIlSWc2MOYABji5xVW17w= 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 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 > >