From patchwork Wed Jan 3 09:14:12 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Xu X-Patchwork-Id: 184672 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:6f82:b0:100:9c79:88ff with SMTP id tb2csp4911206dyb; Wed, 3 Jan 2024 01:16:20 -0800 (PST) X-Google-Smtp-Source: AGHT+IFMgi/f8fV4OfO8U49zdMchPqIX0fDbVracj523pmNgactV4jYGYhrwE38a8jr2Kn/7KdAb X-Received: by 2002:a05:6870:ac10:b0:204:1a1f:c0ff with SMTP id kw16-20020a056870ac1000b002041a1fc0ffmr21841087oab.38.1704273380365; Wed, 03 Jan 2024 01:16:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704273380; cv=none; d=google.com; s=arc-20160816; b=pfipFklnsDeqbnHr8CFq3gQCK78CqzlD1VdEoOD32rbxfl6kR573esR5hCy0x5XOic pksYYkvaUd1VJXH+DcwoJHnmRpywqTzM3RhL7Bd6BfxFIb9TJpAn3zZgt4dfpCUt+7zq VtIv6D5xGu2oBbIdCg6V4TYNXzpihQt8RQOgJnkLfC3UZysCl1gJKV7Ozmrf/v1EDWUM Omb5WfrLksdKjP6yHZHGbmFNZtfzmpbRKlj7vx+A9Tzudpr1wXJGCYUgTsgx/8f93FEX fgubzF4/NnOG51xJAbwai5ZGaOk6vi9dPGrUOfDO309FGDVKSh4uXbwz8Y8HYXS29vKv uA5Q== 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=UYdbUpgayprdP7mOXYmvw/zAFGJlyw1zyb2FaqhnNyk=; fh=JvQ3nGflNTIwPBfhSW2OJAIjHOHR+R1SiFkwzYoQoWY=; b=tuc5yVgf3bWXsBL71gbNuHIsNp95vBTQmzQvlJ2ItqvHppa1566ICpRlp//N9+xbR5 d0USjd392ZV9H9tCLz+PnYr7Esx9w20tftMJIsXPM6Sl+gzQFSs3Tl6lWJJhPJXc9O1W Y34zqQFPkl0iaNq1pcUFMKiOoeSHa7n2ywaHpiDiz1AhfEhJRVfimvOSnp+IBWfhzydn f6Tn51tHnCwKlWQfkXAK8k86oxfTScH14gRFGisk54CNeG0WekXNTrkfskzwMyydYDBs 8ctTWdkqv0ZZ2Hh6R3+r9pCAsgTwpwRqs0tduhBayr+RpqK/8sKZYiNZbJ1UvqxS3oAU h0Jw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=eyLdagZo; spf=pass (google.com: domain of linux-kernel+bounces-15317-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-15317-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id e20-20020a656894000000b005c6bc2367ebsi18321200pgt.216.2024.01.03.01.16.20 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Jan 2024 01:16:20 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-15317-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=eyLdagZo; spf=pass (google.com: domain of linux-kernel+bounces-15317-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-15317-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 25517284DE8 for ; Wed, 3 Jan 2024 09:16:20 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id DF79718E2D; Wed, 3 Jan 2024 09:15:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="eyLdagZo" 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 001C418E14 for ; Wed, 3 Jan 2024 09:15:09 +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=1704273308; 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=UYdbUpgayprdP7mOXYmvw/zAFGJlyw1zyb2FaqhnNyk=; b=eyLdagZoQKSxjruraGbK7BkKzn/SQWlTSmyUFA7CDkEyv2lIGO/Xb5ZK6DFaoTBIrrHxvv T+kiWTmQPx5DtE4sfjfcA0mNqfz4VsB43nIms0WJ0b+evWSs+WcJUH+CByMhtZE/Ym1zFN XAOn2nX9u4ik6lYtdjBIOlz3evqZOdg= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-298-bCcbehl8OCy9I42YtKqcXA-1; Wed, 03 Jan 2024 04:15:05 -0500 X-MC-Unique: bCcbehl8OCy9I42YtKqcXA-1 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (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 20CC685CBA6; Wed, 3 Jan 2024 09:15:04 +0000 (UTC) Received: from x1n.redhat.com (unknown [10.72.116.69]) by smtp.corp.redhat.com (Postfix) with ESMTP id B69E3492BE6; Wed, 3 Jan 2024 09:14:52 +0000 (UTC) From: peterx@redhat.com To: linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: James Houghton , David Hildenbrand , "Kirill A . Shutemov" , Yang Shi , peterx@redhat.com, linux-riscv@lists.infradead.org, Andrew Morton , "Aneesh Kumar K . V" , Rik van Riel , Andrea Arcangeli , Axel Rasmussen , Mike Rapoport , John Hubbard , Vlastimil Babka , Michael Ellerman , Christophe Leroy , Andrew Jones , linuxppc-dev@lists.ozlabs.org, Mike Kravetz , Muchun Song , linux-arm-kernel@lists.infradead.org, Jason Gunthorpe , Christoph Hellwig , Lorenzo Stoakes , Matthew Wilcox Subject: [PATCH v2 02/13] mm/hugetlb: Declare hugetlbfs_pagecache_present() non-static Date: Wed, 3 Jan 2024 17:14:12 +0800 Message-ID: <20240103091423.400294-3-peterx@redhat.com> In-Reply-To: <20240103091423.400294-1-peterx@redhat.com> References: <20240103091423.400294-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.10 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1787060163659153049 X-GMAIL-MSGID: 1787060163659153049 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 c1ee640d87b1..e8eddd51fc17 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 0d262784ce60..bfb52bb8b943 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c @@ -6017,8 +6017,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);