mirror of
https://github.com/torvalds/linux.git
synced 2024-12-25 20:32:22 +00:00
hugetlb: rename remove_huge_page to hugetlb_delete_from_page_cache
remove_huge_page removes a hugetlb page from the page cache. Change to hugetlb_delete_from_page_cache as it is a more descriptive name. huge_add_to_page_cache is global in scope, but only deals with hugetlb pages. For consistency and clarity, rename to hugetlb_add_to_page_cache. Link: https://lkml.kernel.org/r/20220914221810.95771-4-mike.kravetz@oracle.com Signed-off-by: Mike Kravetz <mike.kravetz@oracle.com> Reviewed-by: Miaohe Lin <linmiaohe@huawei.com> Cc: Andrea Arcangeli <aarcange@redhat.com> Cc: "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com> Cc: Axel Rasmussen <axelrasmussen@google.com> Cc: David Hildenbrand <david@redhat.com> Cc: Davidlohr Bueso <dave@stgolabs.net> Cc: James Houghton <jthoughton@google.com> Cc: "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com> Cc: Michal Hocko <mhocko@suse.com> Cc: Mina Almasry <almasrymina@google.com> Cc: Muchun Song <songmuchun@bytedance.com> Cc: Naoya Horiguchi <naoya.horiguchi@linux.dev> Cc: Pasha Tatashin <pasha.tatashin@soleen.com> Cc: Peter Xu <peterx@redhat.com> Cc: Prakash Sangappa <prakash.sangappa@oracle.com> Cc: Sven Schnelle <svens@linux.ibm.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
This commit is contained in:
parent
3a47c54f09
commit
7e1813d48d
@ -364,7 +364,7 @@ static int hugetlbfs_write_end(struct file *file, struct address_space *mapping,
|
|||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void remove_huge_page(struct page *page)
|
static void hugetlb_delete_from_page_cache(struct page *page)
|
||||||
{
|
{
|
||||||
ClearPageDirty(page);
|
ClearPageDirty(page);
|
||||||
ClearPageUptodate(page);
|
ClearPageUptodate(page);
|
||||||
@ -478,15 +478,14 @@ static void remove_inode_hugepages(struct inode *inode, loff_t lstart,
|
|||||||
folio_lock(folio);
|
folio_lock(folio);
|
||||||
/*
|
/*
|
||||||
* We must free the huge page and remove from page
|
* We must free the huge page and remove from page
|
||||||
* cache (remove_huge_page) BEFORE removing the
|
* cache BEFORE removing the region/reserve map
|
||||||
* region/reserve map (hugetlb_unreserve_pages). In
|
* (hugetlb_unreserve_pages). In rare out of memory
|
||||||
* rare out of memory conditions, removal of the
|
* conditions, removal of the region/reserve map could
|
||||||
* region/reserve map could fail. Correspondingly,
|
* fail. Correspondingly, the subpool and global
|
||||||
* the subpool and global reserve usage count can need
|
* reserve usage count can need to be adjusted.
|
||||||
* to be adjusted.
|
|
||||||
*/
|
*/
|
||||||
VM_BUG_ON(HPageRestoreReserve(&folio->page));
|
VM_BUG_ON(HPageRestoreReserve(&folio->page));
|
||||||
remove_huge_page(&folio->page);
|
hugetlb_delete_from_page_cache(&folio->page);
|
||||||
freed++;
|
freed++;
|
||||||
if (!truncate_op) {
|
if (!truncate_op) {
|
||||||
if (unlikely(hugetlb_unreserve_pages(inode,
|
if (unlikely(hugetlb_unreserve_pages(inode,
|
||||||
@ -723,7 +722,7 @@ static long hugetlbfs_fallocate(struct file *file, int mode, loff_t offset,
|
|||||||
}
|
}
|
||||||
clear_huge_page(page, addr, pages_per_huge_page(h));
|
clear_huge_page(page, addr, pages_per_huge_page(h));
|
||||||
__SetPageUptodate(page);
|
__SetPageUptodate(page);
|
||||||
error = huge_add_to_page_cache(page, mapping, index);
|
error = hugetlb_add_to_page_cache(page, mapping, index);
|
||||||
if (unlikely(error)) {
|
if (unlikely(error)) {
|
||||||
restore_reserve_on_error(h, &pseudo_vma, addr, page);
|
restore_reserve_on_error(h, &pseudo_vma, addr, page);
|
||||||
put_page(page);
|
put_page(page);
|
||||||
@ -735,7 +734,7 @@ static long hugetlbfs_fallocate(struct file *file, int mode, loff_t offset,
|
|||||||
|
|
||||||
SetHPageMigratable(page);
|
SetHPageMigratable(page);
|
||||||
/*
|
/*
|
||||||
* unlock_page because locked by huge_add_to_page_cache()
|
* unlock_page because locked by hugetlb_add_to_page_cache()
|
||||||
* put_page() due to reference from alloc_huge_page()
|
* put_page() due to reference from alloc_huge_page()
|
||||||
*/
|
*/
|
||||||
unlock_page(page);
|
unlock_page(page);
|
||||||
@ -980,7 +979,7 @@ static int hugetlbfs_error_remove_page(struct address_space *mapping,
|
|||||||
struct inode *inode = mapping->host;
|
struct inode *inode = mapping->host;
|
||||||
pgoff_t index = page->index;
|
pgoff_t index = page->index;
|
||||||
|
|
||||||
remove_huge_page(page);
|
hugetlb_delete_from_page_cache(page);
|
||||||
if (unlikely(hugetlb_unreserve_pages(inode, index, index + 1, 1)))
|
if (unlikely(hugetlb_unreserve_pages(inode, index, index + 1, 1)))
|
||||||
hugetlb_fix_reserve_counts(inode);
|
hugetlb_fix_reserve_counts(inode);
|
||||||
|
|
||||||
|
@ -666,7 +666,7 @@ struct page *alloc_huge_page_nodemask(struct hstate *h, int preferred_nid,
|
|||||||
nodemask_t *nmask, gfp_t gfp_mask);
|
nodemask_t *nmask, gfp_t gfp_mask);
|
||||||
struct page *alloc_huge_page_vma(struct hstate *h, struct vm_area_struct *vma,
|
struct page *alloc_huge_page_vma(struct hstate *h, struct vm_area_struct *vma,
|
||||||
unsigned long address);
|
unsigned long address);
|
||||||
int huge_add_to_page_cache(struct page *page, struct address_space *mapping,
|
int hugetlb_add_to_page_cache(struct page *page, struct address_space *mapping,
|
||||||
pgoff_t idx);
|
pgoff_t idx);
|
||||||
void restore_reserve_on_error(struct hstate *h, struct vm_area_struct *vma,
|
void restore_reserve_on_error(struct hstate *h, struct vm_area_struct *vma,
|
||||||
unsigned long address, struct page *page);
|
unsigned long address, struct page *page);
|
||||||
|
@ -5430,7 +5430,7 @@ static bool hugetlbfs_pagecache_present(struct hstate *h,
|
|||||||
return page != NULL;
|
return page != NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
int huge_add_to_page_cache(struct page *page, struct address_space *mapping,
|
int hugetlb_add_to_page_cache(struct page *page, struct address_space *mapping,
|
||||||
pgoff_t idx)
|
pgoff_t idx)
|
||||||
{
|
{
|
||||||
struct folio *folio = page_folio(page);
|
struct folio *folio = page_folio(page);
|
||||||
@ -5569,7 +5569,7 @@ static vm_fault_t hugetlb_no_page(struct mm_struct *mm,
|
|||||||
new_page = true;
|
new_page = true;
|
||||||
|
|
||||||
if (vma->vm_flags & VM_MAYSHARE) {
|
if (vma->vm_flags & VM_MAYSHARE) {
|
||||||
int err = huge_add_to_page_cache(page, mapping, idx);
|
int err = hugetlb_add_to_page_cache(page, mapping, idx);
|
||||||
if (err) {
|
if (err) {
|
||||||
/*
|
/*
|
||||||
* err can't be -EEXIST which implies someone
|
* err can't be -EEXIST which implies someone
|
||||||
@ -5981,11 +5981,11 @@ int hugetlb_mcopy_atomic_pte(struct mm_struct *dst_mm,
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* Serialization between remove_inode_hugepages() and
|
* Serialization between remove_inode_hugepages() and
|
||||||
* huge_add_to_page_cache() below happens through the
|
* hugetlb_add_to_page_cache() below happens through the
|
||||||
* hugetlb_fault_mutex_table that here must be hold by
|
* hugetlb_fault_mutex_table that here must be hold by
|
||||||
* the caller.
|
* the caller.
|
||||||
*/
|
*/
|
||||||
ret = huge_add_to_page_cache(page, mapping, idx);
|
ret = hugetlb_add_to_page_cache(page, mapping, idx);
|
||||||
if (ret)
|
if (ret)
|
||||||
goto out_release_nounlock;
|
goto out_release_nounlock;
|
||||||
page_in_pagecache = true;
|
page_in_pagecache = true;
|
||||||
|
Loading…
Reference in New Issue
Block a user