Skip to content

Commit 7e1813d

Browse files
mjkravetzakpm00
authored andcommitted
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/[email protected] Signed-off-by: Mike Kravetz <[email protected]> Reviewed-by: Miaohe Lin <[email protected]> Cc: Andrea Arcangeli <[email protected]> Cc: "Aneesh Kumar K.V" <[email protected]> Cc: Axel Rasmussen <[email protected]> Cc: David Hildenbrand <[email protected]> Cc: Davidlohr Bueso <[email protected]> Cc: James Houghton <[email protected]> Cc: "Kirill A. Shutemov" <[email protected]> Cc: Michal Hocko <[email protected]> Cc: Mina Almasry <[email protected]> Cc: Muchun Song <[email protected]> Cc: Naoya Horiguchi <[email protected]> Cc: Pasha Tatashin <[email protected]> Cc: Peter Xu <[email protected]> Cc: Prakash Sangappa <[email protected]> Cc: Sven Schnelle <[email protected]> Signed-off-by: Andrew Morton <[email protected]>
1 parent 3a47c54 commit 7e1813d

File tree

3 files changed

+15
-16
lines changed

3 files changed

+15
-16
lines changed

fs/hugetlbfs/inode.c

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,7 @@ static int hugetlbfs_write_end(struct file *file, struct address_space *mapping,
364364
return -EINVAL;
365365
}
366366

367-
static void remove_huge_page(struct page *page)
367+
static void hugetlb_delete_from_page_cache(struct page *page)
368368
{
369369
ClearPageDirty(page);
370370
ClearPageUptodate(page);
@@ -478,15 +478,14 @@ static void remove_inode_hugepages(struct inode *inode, loff_t lstart,
478478
folio_lock(folio);
479479
/*
480480
* We must free the huge page and remove from page
481-
* cache (remove_huge_page) BEFORE removing the
482-
* region/reserve map (hugetlb_unreserve_pages). In
483-
* rare out of memory conditions, removal of the
484-
* region/reserve map could fail. Correspondingly,
485-
* the subpool and global reserve usage count can need
486-
* to be adjusted.
481+
* cache BEFORE removing the region/reserve map
482+
* (hugetlb_unreserve_pages). In rare out of memory
483+
* conditions, removal of the region/reserve map could
484+
* fail. Correspondingly, the subpool and global
485+
* reserve usage count can need to be adjusted.
487486
*/
488487
VM_BUG_ON(HPageRestoreReserve(&folio->page));
489-
remove_huge_page(&folio->page);
488+
hugetlb_delete_from_page_cache(&folio->page);
490489
freed++;
491490
if (!truncate_op) {
492491
if (unlikely(hugetlb_unreserve_pages(inode,
@@ -723,7 +722,7 @@ static long hugetlbfs_fallocate(struct file *file, int mode, loff_t offset,
723722
}
724723
clear_huge_page(page, addr, pages_per_huge_page(h));
725724
__SetPageUptodate(page);
726-
error = huge_add_to_page_cache(page, mapping, index);
725+
error = hugetlb_add_to_page_cache(page, mapping, index);
727726
if (unlikely(error)) {
728727
restore_reserve_on_error(h, &pseudo_vma, addr, page);
729728
put_page(page);
@@ -735,7 +734,7 @@ static long hugetlbfs_fallocate(struct file *file, int mode, loff_t offset,
735734

736735
SetHPageMigratable(page);
737736
/*
738-
* unlock_page because locked by huge_add_to_page_cache()
737+
* unlock_page because locked by hugetlb_add_to_page_cache()
739738
* put_page() due to reference from alloc_huge_page()
740739
*/
741740
unlock_page(page);
@@ -980,7 +979,7 @@ static int hugetlbfs_error_remove_page(struct address_space *mapping,
980979
struct inode *inode = mapping->host;
981980
pgoff_t index = page->index;
982981

983-
remove_huge_page(page);
982+
hugetlb_delete_from_page_cache(page);
984983
if (unlikely(hugetlb_unreserve_pages(inode, index, index + 1, 1)))
985984
hugetlb_fix_reserve_counts(inode);
986985

include/linux/hugetlb.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -666,7 +666,7 @@ struct page *alloc_huge_page_nodemask(struct hstate *h, int preferred_nid,
666666
nodemask_t *nmask, gfp_t gfp_mask);
667667
struct page *alloc_huge_page_vma(struct hstate *h, struct vm_area_struct *vma,
668668
unsigned long address);
669-
int huge_add_to_page_cache(struct page *page, struct address_space *mapping,
669+
int hugetlb_add_to_page_cache(struct page *page, struct address_space *mapping,
670670
pgoff_t idx);
671671
void restore_reserve_on_error(struct hstate *h, struct vm_area_struct *vma,
672672
unsigned long address, struct page *page);

mm/hugetlb.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5430,7 +5430,7 @@ static bool hugetlbfs_pagecache_present(struct hstate *h,
54305430
return page != NULL;
54315431
}
54325432

5433-
int huge_add_to_page_cache(struct page *page, struct address_space *mapping,
5433+
int hugetlb_add_to_page_cache(struct page *page, struct address_space *mapping,
54345434
pgoff_t idx)
54355435
{
54365436
struct folio *folio = page_folio(page);
@@ -5569,7 +5569,7 @@ static vm_fault_t hugetlb_no_page(struct mm_struct *mm,
55695569
new_page = true;
55705570

55715571
if (vma->vm_flags & VM_MAYSHARE) {
5572-
int err = huge_add_to_page_cache(page, mapping, idx);
5572+
int err = hugetlb_add_to_page_cache(page, mapping, idx);
55735573
if (err) {
55745574
/*
55755575
* err can't be -EEXIST which implies someone
@@ -5981,11 +5981,11 @@ int hugetlb_mcopy_atomic_pte(struct mm_struct *dst_mm,
59815981

59825982
/*
59835983
* Serialization between remove_inode_hugepages() and
5984-
* huge_add_to_page_cache() below happens through the
5984+
* hugetlb_add_to_page_cache() below happens through the
59855985
* hugetlb_fault_mutex_table that here must be hold by
59865986
* the caller.
59875987
*/
5988-
ret = huge_add_to_page_cache(page, mapping, idx);
5988+
ret = hugetlb_add_to_page_cache(page, mapping, idx);
59895989
if (ret)
59905990
goto out_release_nounlock;
59915991
page_in_pagecache = true;

0 commit comments

Comments
 (0)