From patchwork Thu Nov 16 01:28:57 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Xu X-Patchwork-Id: 13457476 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 1A12AC2BB3F for ; Thu, 16 Nov 2023 01:29:18 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 7C2D66B03BD; Wed, 15 Nov 2023 20:29:18 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 771CF6B03DF; Wed, 15 Nov 2023 20:29:18 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5C4C56B03E0; Wed, 15 Nov 2023 20:29:18 -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 3A41F6B03BD for ; Wed, 15 Nov 2023 20:29:18 -0500 (EST) Received: from smtpin19.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 12F6B1401E4 for ; Thu, 16 Nov 2023 01:29:18 +0000 (UTC) X-FDA: 81462084396.19.FF5DE68 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf30.hostedemail.com (Postfix) with ESMTP id EA1F98000B for ; Thu, 16 Nov 2023 01:29:15 +0000 (UTC) Authentication-Results: imf30.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=IRb4U1PO; spf=pass (imf30.hostedemail.com: domain of peterx@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=peterx@redhat.com; dmarc=pass (policy=none) header.from=redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1700098156; 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-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=j75oQuDXytIzx0fg9CVxcXlN+sYlHIe4GGC/3d4Gln4=; b=JknCO2oGdz3Qv/n2461/FnMkgb4V851T55VPs4LIfVka4fHgrgHfxGHILbDOTiftxENVYc /QPrDzHYn5w1LOe4XhBZfZS9hG1ttx6fQI9v9/zYN7BqGK1sF1yT6tPnDTaywN261CVN1j vTs6Br30AarL2XOmqtZ30p8gUHZd6bM= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1700098156; a=rsa-sha256; cv=none; b=0Oz2T90LtrPifq9JL4By3DZIgK24Z/CKUqK1nYEN4q69vZfM1bxdbucZC8d+Zr0bmyTSem Kr44RSkmKJlS6QiP+IKXD3tMfu2paDr61osgIT46il2yS4x9uJwaE/vVR3ufvWw5Mn6mnm Pbj4P0fyOZYB3Oj08IorNvSZyaoJZjw= ARC-Authentication-Results: i=1; imf30.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=IRb4U1PO; spf=pass (imf30.hostedemail.com: domain of peterx@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=peterx@redhat.com; dmarc=pass (policy=none) header.from=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1700098155; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=j75oQuDXytIzx0fg9CVxcXlN+sYlHIe4GGC/3d4Gln4=; b=IRb4U1POu0WhPCvZObb40AU6wqvMkjWqlqNcfb+fWiH9dO/Xg6pivWiKW35BIRfNKQcrdn J9N7nahPWJ4ovqqVeNv6CGvpVJeES0+RGpknCOifbrDc7y+3D6VM8ui5nGD/NgBVEZtwMd n9rW4MLZ0VYGWlJV40cXro+kZDh5uS0= Received: from mail-qt1-f200.google.com (mail-qt1-f200.google.com [209.85.160.200]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-185-i_Az9E7QMaWrKt5H0Pln6w-1; Wed, 15 Nov 2023 20:29:13 -0500 X-MC-Unique: i_Az9E7QMaWrKt5H0Pln6w-1 Received: by mail-qt1-f200.google.com with SMTP id d75a77b69052e-421ac2bad66so928341cf.0 for ; Wed, 15 Nov 2023 17:29:13 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700098153; x=1700702953; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=j75oQuDXytIzx0fg9CVxcXlN+sYlHIe4GGC/3d4Gln4=; b=QHsTpqSfMk4hEc/jRdjZN9GEl5Nl0P/WpNkP9qWTzufiBoBgUOb1WNg99fLQzHmIQ8 I6/a6Vuc/+RQvbNQkdjCM4NBd94/02FNerltYnXalTtE4zvj73mgGiqRMa4goRZ2KYmn tftwONzSU0HefAhwX3QZi16Z5+6rvxYKWON8WW58vOMl0UPFasokgmHBIoVRDwtZRo9J RHZWgxBiWvnmEtNf+MXlSHhANVzLAgKNnFBN5wTnffC2Pz8fjnO96haeLFxksh+5XZaB Wt067+89jkSjUbnRr6rYncG1R3BEKYkRY/9pvDDmMH/ilBvmiMJaTUZ0aWczRz/sr1vG 1Cpg== X-Gm-Message-State: AOJu0Yzt7GM6GXFGRfBIh3SukTgmR2z/yrctLFiUPhZuI8mJg5igMxP2 svbxYXuwK99pR3oU435t6YQ7cMCO/OC6nXoAzZiLbq5lwvnNIFhK0P3dcU84uUAvgK4z49Bho0r rw47YHWtsAGI= X-Received: by 2002:ac8:7d13:0:b0:41e:4be2:d3eb with SMTP id g19-20020ac87d13000000b0041e4be2d3ebmr10348612qtb.1.1700098153059; Wed, 15 Nov 2023 17:29:13 -0800 (PST) X-Google-Smtp-Source: AGHT+IGyA/ppnbzE3SBmMhc1vSGcpOQYT5DWDMM4yQxJwgB1XG6+271v4ghGsJVWP9HBrNNkwutL1g== X-Received: by 2002:ac8:7d13:0:b0:41e:4be2:d3eb with SMTP id g19-20020ac87d13000000b0041e4be2d3ebmr10348586qtb.1.1700098152747; Wed, 15 Nov 2023 17:29:12 -0800 (PST) Received: from x1n.redhat.com (cpe5c7695f3aee0-cm5c7695f3aede.cpe.net.cable.rogers.com. [99.254.144.39]) by smtp.gmail.com with ESMTPSA id c24-20020ac85198000000b0041e383d527esm3922598qtn.66.2023.11.15.17.29.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Nov 2023 17:29:12 -0800 (PST) From: Peter Xu To: linux-kernel@vger.kernel.org, linux-mm@kvack.org Cc: Mike Kravetz , "Kirill A . Shutemov" , Lorenzo Stoakes , Axel Rasmussen , Matthew Wilcox , John Hubbard , Mike Rapoport , peterx@redhat.com, Hugh Dickins , David Hildenbrand , Andrea Arcangeli , Rik van Riel , James Houghton , Yang Shi , Jason Gunthorpe , Vlastimil Babka , Andrew Morton Subject: [PATCH RFC 01/12] mm/hugetlb: Export hugetlbfs_pagecache_present() Date: Wed, 15 Nov 2023 20:28:57 -0500 Message-ID: <20231116012908.392077-2-peterx@redhat.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231116012908.392077-1-peterx@redhat.com> References: <20231116012908.392077-1-peterx@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Stat-Signature: ykaqxnhnqf69rb4w9fz78rww5wskc9qw X-Rspamd-Server: rspam10 X-Rspamd-Queue-Id: EA1F98000B X-Rspam-User: X-HE-Tag: 1700098155-354664 X-HE-Meta: U2FsdGVkX1/1syfZLg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wkrYcIFK2diPwvTcwJUiYlG9CxEDJe6mK8/Kyml04PwPRt4hcg8N4CaOLnSGFvRsYlBIEzMYhWVhoCn7KQw2sF2O1UMbj8Q3Dbn9lNiKd0DmVFoYAp/80KYdRIEyok4uqrf0ujo2hpvmPwD2r4UIdy7TH0NtEqXJiHJ5X0JIK7/lvj7HW8tVEunbEu0S9RnPfWf9Yir4k6ZqOaHZenPiz6jU7Dp7FDRps9RIx+jTxTW/v/KBd2MwSR5d83KQqjB1n1OMB+NbOyYtpiG1t/71uMzIdNbueix9jwHVRHU2qoN5LdtqVCLp3bUR/s4ipbKGJb5Oo2kJOHxeNA3PlMdQ== 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: It will be used outside hugetlb.c soon. Signed-off-by: Peter Xu --- include/linux/hugetlb.h | 3 +++ mm/hugetlb.c | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h index 236ec7b63c54..bb07279b8991 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); 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);