From patchwork Tue Dec 19 07:55:27 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Xu X-Patchwork-Id: 13497938 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 BC65EC46CD4 for ; Tue, 19 Dec 2023 07:56:25 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 060248D0006; Tue, 19 Dec 2023 02:56:25 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 0363F8D0005; Tue, 19 Dec 2023 02:56:25 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E67D88D0006; Tue, 19 Dec 2023 02:56:24 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id D8F6D8D0005 for ; Tue, 19 Dec 2023 02:56:24 -0500 (EST) Received: from smtpin10.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id A8B3C408C5 for ; Tue, 19 Dec 2023 07:56:24 +0000 (UTC) X-FDA: 81582810288.10.B96CF46 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf26.hostedemail.com (Postfix) with ESMTP id EF356140012 for ; Tue, 19 Dec 2023 07:56:22 +0000 (UTC) Authentication-Results: imf26.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=ZI0L6sbL; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf26.hostedemail.com: domain of peterx@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=peterx@redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1702972583; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=75YlhRgpWvz7xroPDJtpCNniQimqN/967LqIgG1M+eM=; b=nQ2SLU3dHfbCUHX0iAsbBLcSa+zjJ+ffiZSqativtIVzGWwUTUSK8hIxRq1ebzd2iExqDF JIhLaXb2ffAHJyW9kit/Vy3RlVbGrYtdp6ZfH5u48zxvixFpDdguSizUAbvo9nc4jFHYze ZbGvoJzqNG3nsSKFusvf1plPClfQFDg= ARC-Authentication-Results: i=1; imf26.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=ZI0L6sbL; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf26.hostedemail.com: domain of peterx@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=peterx@redhat.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1702972583; a=rsa-sha256; cv=none; b=Pe6U+9iH2a7Bf7jdLHVtiO/R4E2n+zwFizQRcOFnWwYXT5CHC3ikPCL0cmbphpl7+KQ1tH mNFaBOk9Y23C+jGicOCuF8kU6Jd+gG4oo1PHiNz7wouKbkmcODD7Wd8IdYEVQFNWZWQFSK f28Iv3V097gKGWGmOODYTo+KPk9E+Hs= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1702972582; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=75YlhRgpWvz7xroPDJtpCNniQimqN/967LqIgG1M+eM=; b=ZI0L6sbLTVFrGtkM+vcH5a+0jUqvkNkPr9K0tgOuyp9vXoDi8cBVG27Wm53nyinNMN/xVS V32BRHn1bNGcUF/lp8HfBlDFIzSsLWJ7fdLBsZV80fHI2H69vt0x8Jr3Nlq+z/Ee2b6hhW rJpr8bJicawuydJn8QwZ7KT/5UDZfjU= Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-356-wW0mlPoONC2GJ2s_aRZ7hQ-1; Tue, 19 Dec 2023 02:56:18 -0500 X-MC-Unique: wW0mlPoONC2GJ2s_aRZ7hQ-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id AE4F23813F24; Tue, 19 Dec 2023 07:56:16 +0000 (UTC) Received: from x1n.redhat.com (unknown [10.72.116.117]) by smtp.corp.redhat.com (Postfix) with ESMTP id 993A82026D66; Tue, 19 Dec 2023 07:56:05 +0000 (UTC) From: peterx@redhat.com To: linux-kernel@vger.kernel.org, linux-mm@kvack.org Cc: Matthew Wilcox , Christophe Leroy , Lorenzo Stoakes , David Hildenbrand , Vlastimil Babka , Mike Kravetz , Mike Rapoport , Christoph Hellwig , John Hubbard , Andrew Jones , linux-arm-kernel@lists.infradead.org, Michael Ellerman , "Kirill A . Shutemov" , linuxppc-dev@lists.ozlabs.org, Rik van Riel , linux-riscv@lists.infradead.org, Yang Shi , James Houghton , "Aneesh Kumar K . V" , Andrew Morton , Jason Gunthorpe , Andrea Arcangeli , peterx@redhat.com, Axel Rasmussen Subject: [PATCH 02/13] mm/hugetlb: Declare hugetlbfs_pagecache_present() non-static Date: Tue, 19 Dec 2023 15:55:27 +0800 Message-ID: <20231219075538.414708-3-peterx@redhat.com> In-Reply-To: <20231219075538.414708-1-peterx@redhat.com> References: <20231219075538.414708-1-peterx@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.4 X-Rspamd-Queue-Id: EF356140012 X-Rspam-User: X-Rspamd-Server: rspam04 X-Stat-Signature: j34zg7wgqyfqrnqrsd5zuz6omdnb6u1a X-HE-Tag: 1702972582-681103 X-HE-Meta: U2FsdGVkX19c7ZFtMBSVPOnHCie99arM+be9GzefQBAfq7gdmoJJdJkLeklyKTdR4r402FcFbnMfR4qSyqUMhzIUb62LtchrK5ti4gAM7qlqPTp8hLkkwLf4khHZTbNjJ35zSu0DCbrYMmgdXYfy7wBVQ2GSyFezHei3YXmOwSnKBcGJluDyma4bROJc7Ycq4t0GArVq3hj2VchXffmJYhcvPTsLZxwTevqxpbRIUexGMLCxwu78beZURl5MUz34bZRiePrIH+uKJdqkD+TXB1r1sVp6X64Q3EDg0upAnTbFWOPITj2p6BR2Yj8DMgyYcdPguafviEfgHkAiRMsdTpUQ9s0nDc8GS6ThbX63Ih9NhhyOP7kRLiNjOqc2//MkHp0nUF8CHFQUWKE25ntY6Jcc+RQp2MsaNXC6bm9YESe/adZmJkEp6FjBIMIVLsOTOA6ncOwSr24v3Tzji28By+ZcAwkEmC18yAqdoUXaZSIwRJOuw7/oLdFSF2sF22UHUUWZG6IvzilYN7At2j3WV7Iu9qv2kOs1PrRuLuSX7xTCx8eCoeFs4ZghWIcyPgNiIXHcbRyNWaDMlQnJSiuWHjOivGGpdyb9kZhgGhIf/+xAgTWHdU4O8sNrnchxH+royI8hbuW9otDNaGJBGeIB2BjHAMy2USMS7w5O6nTsm5CDQhaXvZRinZpuP4MA3DU7coh5GCcWfbno356WeQaRjLXymQFxLf/TpQdpJv16rMihMaFX8O9WCI3N049NwImN3pOLjgOqlncaRSxli91QrEqGdnlmmSUKGKDLm7YbXlrv+qbwWhuEjoKjjzXIE9V8kDxhA6rImVo9Vpgfor9LaoGPgskxtHmfUzTb40upqli6nSDiOsawLY7dFZCZaiRFWOxI0U2tywxdrQtasRxQb2hw/yHgkN110Rggc5kq95hxlPXKTudQHVzMoqaHHP7S1oVhtS1slhOjDMkWlLv wcThdygG nI/blpACslc7F9TCZecNaqw0onAogNURHJwWbQJBSLb9RAUz/+D1oK7G2xuu/S6OSN9pG2OWlB2mQ53PuEPkltXllBh0dpEOJbzbGxY7pG9Xrni2QkGlF+EDTeAcBtQMOqeHplTwVBgsUf5RgFURMRbuJTJE65pvUEpKfFoBF1PNGCDpMzK4+qLRMXxCMnl3DWTGMRv3qm+C4orSG8CPLvzujnA== 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: List-Subscribe: List-Unsubscribe: From: Peter Xu It will be used outside hugetlb.c soon. Signed-off-by: Peter Xu --- include/linux/hugetlb.h | 9 +++++++++ mm/hugetlb.c | 4 ++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h index 236ec7b63c54..f8c5c174c8a6 100644 --- a/include/linux/hugetlb.h +++ b/include/linux/hugetlb.h @@ -174,6 +174,9 @@ u32 hugetlb_fault_mutex_hash(struct address_space *mapping, pgoff_t idx); pte_t *huge_pmd_share(struct mm_struct *mm, struct vm_area_struct *vma, unsigned long addr, pud_t *pud); +bool hugetlbfs_pagecache_present(struct hstate *h, + struct vm_area_struct *vma, + unsigned long address); struct address_space *hugetlb_page_mapping_lock_write(struct page *hpage); @@ -1221,6 +1224,12 @@ static inline void hugetlb_register_node(struct node *node) static inline void hugetlb_unregister_node(struct node *node) { } + +static inline bool hugetlbfs_pagecache_present( + struct hstate *h, struct vm_area_struct *vma, unsigned long address) +{ + return false; +} #endif /* CONFIG_HUGETLB_PAGE */ static inline spinlock_t *huge_pte_lock(struct hstate *h, diff --git a/mm/hugetlb.c b/mm/hugetlb.c index 6feb3e0630d1..29705e5c6f40 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c @@ -6018,8 +6018,8 @@ static vm_fault_t hugetlb_wp(struct mm_struct *mm, struct vm_area_struct *vma, /* * Return whether there is a pagecache page to back given address within VMA. */ -static bool hugetlbfs_pagecache_present(struct hstate *h, - struct vm_area_struct *vma, unsigned long address) +bool hugetlbfs_pagecache_present(struct hstate *h, + struct vm_area_struct *vma, unsigned long address) { struct address_space *mapping = vma->vm_file->f_mapping; pgoff_t idx = linear_page_index(vma, address);