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: 180814 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:24d3:b0:fb:cd0c:d3e with SMTP id r19csp1782845dyi; Tue, 19 Dec 2023 00:06:32 -0800 (PST) X-Google-Smtp-Source: AGHT+IH4SfmdRsoq5knDd9dttyDcu/s3Ccx24JuqrkmtB5iSy7WZVshVUtDWao4l2lLatOpue9K+ X-Received: by 2002:a50:d697:0:b0:553:354b:18f1 with SMTP id r23-20020a50d697000000b00553354b18f1mr2279306edi.19.1702973191795; Tue, 19 Dec 2023 00:06:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702973191; cv=none; d=google.com; s=arc-20160816; b=TLGzaTIuYRqK4rF4Gn3NzZB0M0BnpCf7FNECIB0ZVRKmhK+bjMaG3vc0OL/ALsm4m5 2N32x8Vi+1QfIvC5K7ZeD4FzCZ2MvTQRQlglJ2Vk3pZjkyCwO++K4rtQcAZNezWofmp8 gSiszx/nMSjeU6V32muOmCrYyovPpxs5BGOG7tOHxJsJs0pZZ4P2rqgWKOvlLOSST73Y jKuCeWUd16/IIGFiJD5ADwiY7IUEXnISNuPxkMXMdJVsYGaf1SOBIsXIsGTl9AR6L9Oi 2aW+TshROw0/yzW42XC49mBpzv5thMKEBJv/rFZoVE1scfeIZOxqcnlIe1EIJWrjepq0 KF+A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=75YlhRgpWvz7xroPDJtpCNniQimqN/967LqIgG1M+eM=; fh=3mpu6Yyr5hMzDKtkQvzcApl7ZSQGU4G8QyIY2BAU7VY=; b=UtX/pk8eh1hP0sT8PfMC+vTmIpBSLVAKIOHA2wYYsU4nPnCBvDkn3E9wHwI5bmp+oJ AXJvRR+BLnxWDem4bYD5+3HqW1tlP54mxnrm1yR4xjsOkwkhxtt87i60ws1IRmy2oNjX vOzFYdcBjNEawNUKL2wImipsBfwzFxfvaucSPcuXSKSMm/1ppyj3cVVN9M6T8w6RfDLz A8k5WYfjp9LiNlWu7qwu5AitImaaUPFTFl/CQSTdhlj/DxOwXlMQ8soFYB+PPrEOVWEu iN2RC443kuBsTDadPKzM6jW1SmHtuiQ4CC79KJhv4Zh7sYagN4L6anIUUr7Xbuh9QqRM cpmA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=ZI0L6sbL; spf=pass (google.com: domain of linux-kernel+bounces-4835-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-4835-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id i28-20020a50871c000000b005539e083f7csi226027edb.535.2023.12.19.00.06.31 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Dec 2023 00:06:31 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-4835-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=ZI0L6sbL; spf=pass (google.com: domain of linux-kernel+bounces-4835-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-4835-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 97F101F25B49 for ; Tue, 19 Dec 2023 07:56:48 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5952A14293; Tue, 19 Dec 2023 07:56:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="ZI0L6sbL" X-Original-To: linux-kernel@vger.kernel.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 465C113FF9 for ; Tue, 19 Dec 2023 07:56:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com 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> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.4 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1785696817523340400 X-GMAIL-MSGID: 1785696817523340400 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);