From: Miaohe Lin <linmiaohe@huawei.com>
To: <akpm@linux-foundation.org>, <mike.kravetz@oracle.com>,
<songmuchun@bytedance.com>
Cc: <linux-mm@kvack.org>, <linux-kernel@vger.kernel.org>,
<linmiaohe@huawei.com>
Subject: [PATCH v2 07/10] hugetlb: kill hugetlbfs_pagecache_page()
Date: Thu, 1 Sep 2022 20:00:27 +0800 [thread overview]
Message-ID: <20220901120030.63318-8-linmiaohe@huawei.com> (raw)
In-Reply-To: <20220901120030.63318-1-linmiaohe@huawei.com>
Fold hugetlbfs_pagecache_page() into its sole caller to remove some
duplicated code. No functional change intended.
Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>
Reviewed-by: Muchun Song <songmuchun@bytedance.com>
---
mm/hugetlb.c | 15 +--------------
1 file changed, 1 insertion(+), 14 deletions(-)
diff --git a/mm/hugetlb.c b/mm/hugetlb.c
index bb65b7fdca25..26bcc85715eb 100644
--- a/mm/hugetlb.c
+++ b/mm/hugetlb.c
@@ -5467,19 +5467,6 @@ static vm_fault_t hugetlb_wp(struct mm_struct *mm, struct vm_area_struct *vma,
return ret;
}
-/* Return the pagecache page at a given address within a VMA */
-static struct page *hugetlbfs_pagecache_page(struct hstate *h,
- struct vm_area_struct *vma, unsigned long address)
-{
- struct address_space *mapping;
- pgoff_t idx;
-
- mapping = vma->vm_file->f_mapping;
- idx = vma_hugecache_offset(h, vma, address);
-
- return find_lock_page(mapping, idx);
-}
-
/*
* Return whether there is a pagecache page to back given address within VMA.
* Caller follow_hugetlb_page() holds page_table_lock so we cannot lock_page.
@@ -5885,7 +5872,7 @@ vm_fault_t hugetlb_fault(struct mm_struct *mm, struct vm_area_struct *vma,
/* Just decrements count, does not deallocate */
vma_end_reservation(h, vma, haddr);
- pagecache_page = hugetlbfs_pagecache_page(h, vma, haddr);
+ pagecache_page = find_lock_page(mapping, idx);
}
ptl = huge_pte_lock(h, mm, ptep);
--
2.23.0
next prev parent reply other threads:[~2022-09-01 12:01 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-01 12:00 [PATCH v2 00/10] A few cleanup patches for hugetlb Miaohe Lin
2022-09-01 12:00 ` [PATCH v2 01/10] hugetlb: make hugetlb_cma_check() static Miaohe Lin
2022-09-01 12:00 ` [PATCH v2 02/10] hugetlb: Use helper macro SZ_1K Miaohe Lin
2022-09-01 12:00 ` [PATCH v2 03/10] hugetlb: Use LIST_HEAD() to define a list head Miaohe Lin
2022-09-01 12:00 ` [PATCH v2 04/10] hugetlb: Use sizeof() to get the array size Miaohe Lin
2022-09-01 12:00 ` [PATCH v2 05/10] hugetlb: Use helper {huge_pte|pmd}_lock() Miaohe Lin
2022-09-01 12:00 ` [PATCH v2 06/10] hugetlb: pass NULL to kobj_to_hstate() if nid is unused Miaohe Lin
2022-09-01 12:00 ` Miaohe Lin [this message]
2022-09-01 12:00 ` [PATCH v2 08/10] hugetlb: add comment for subtle SetHPageVmemmapOptimized() Miaohe Lin
2022-09-01 12:00 ` [PATCH v2 09/10] hugetlb: remove meaningless BUG_ON(huge_pte_none()) Miaohe Lin
2022-09-01 12:00 ` [PATCH v2 10/10] hugetlb: make hugetlb depends on SYSFS or SYSCTL Miaohe Lin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220901120030.63318-8-linmiaohe@huawei.com \
--to=linmiaohe@huawei.com \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mike.kravetz@oracle.com \
--cc=songmuchun@bytedance.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox