Skip to content

Commit b235448

Browse files
davidhildenbrandakpm00
authored andcommitted
mm/hugetlb: rename folio_putback_active_hugetlb() to folio_putback_hugetlb()
Now that folio_putback_hugetlb() is only called on folios that were previously isolated through folio_isolate_hugetlb(), let's rename it to match folio_putback_lru(). Add some kernel doc to clarify how this function is supposed to be used. Link: https://lkml.kernel.org/r/20250113131611.2554758-5-david@redhat.com Signed-off-by: David Hildenbrand <david@redhat.com> Reviewed-by: Baolin Wang <baolin.wang@linux.alibaba.com> Cc: Matthew Wilcox (Oracle) <willy@infradead.org> Cc: Muchun Song <muchun.song@linux.dev> Cc: Sidhartha Kumar <sidhartha.kumar@oracle.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
1 parent ba23f58 commit b235448

3 files changed

Lines changed: 18 additions & 7 deletions

File tree

include/linux/hugetlb.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ bool folio_isolate_hugetlb(struct folio *folio, struct list_head *list);
157157
int get_hwpoison_hugetlb_folio(struct folio *folio, bool *hugetlb, bool unpoison);
158158
int get_huge_page_for_hwpoison(unsigned long pfn, int flags,
159159
bool *migratable_cleared);
160-
void folio_putback_active_hugetlb(struct folio *folio);
160+
void folio_putback_hugetlb(struct folio *folio);
161161
void move_hugetlb_state(struct folio *old_folio, struct folio *new_folio, int reason);
162162
void hugetlb_fix_reserve_counts(struct inode *inode);
163163
extern struct mutex *hugetlb_fault_mutex_table;
@@ -430,7 +430,7 @@ static inline int get_huge_page_for_hwpoison(unsigned long pfn, int flags,
430430
return 0;
431431
}
432432

433-
static inline void folio_putback_active_hugetlb(struct folio *folio)
433+
static inline void folio_putback_hugetlb(struct folio *folio)
434434
{
435435
}
436436

mm/hugetlb.c

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7434,7 +7434,7 @@ __weak unsigned long hugetlb_mask_last_page(struct hstate *h)
74347434
* it is already isolated/non-migratable.
74357435
*
74367436
* On success, an additional folio reference is taken that must be dropped
7437-
* using folio_putback_active_hugetlb() to undo the isolation.
7437+
* using folio_putback_hugetlb() to undo the isolation.
74387438
*
74397439
* Return: True if isolation worked, otherwise False.
74407440
*/
@@ -7486,7 +7486,18 @@ int get_huge_page_for_hwpoison(unsigned long pfn, int flags,
74867486
return ret;
74877487
}
74887488

7489-
void folio_putback_active_hugetlb(struct folio *folio)
7489+
/**
7490+
* folio_putback_hugetlb - unisolate a hugetlb folio
7491+
* @folio: the isolated hugetlb folio
7492+
*
7493+
* Putback/un-isolate the hugetlb folio that was previous isolated using
7494+
* folio_isolate_hugetlb(): marking it non-isolated/migratable and putting it
7495+
* back onto the active list.
7496+
*
7497+
* Will drop the additional folio reference obtained through
7498+
* folio_isolate_hugetlb().
7499+
*/
7500+
void folio_putback_hugetlb(struct folio *folio)
74907501
{
74917502
spin_lock_irq(&hugetlb_lock);
74927503
folio_set_hugetlb_migratable(folio);

mm/migrate.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ void putback_movable_pages(struct list_head *l)
137137

138138
list_for_each_entry_safe(folio, folio2, l, lru) {
139139
if (unlikely(folio_test_hugetlb(folio))) {
140-
folio_putback_active_hugetlb(folio);
140+
folio_putback_hugetlb(folio);
141141
continue;
142142
}
143143
list_del(&folio->lru);
@@ -1451,7 +1451,7 @@ static int unmap_and_move_huge_page(new_folio_t get_new_folio,
14511451

14521452
if (folio_ref_count(src) == 1) {
14531453
/* page was freed from under us. So we are done. */
1454-
folio_putback_active_hugetlb(src);
1454+
folio_putback_hugetlb(src);
14551455
return MIGRATEPAGE_SUCCESS;
14561456
}
14571457

@@ -1534,7 +1534,7 @@ static int unmap_and_move_huge_page(new_folio_t get_new_folio,
15341534
folio_unlock(src);
15351535
out:
15361536
if (rc == MIGRATEPAGE_SUCCESS)
1537-
folio_putback_active_hugetlb(src);
1537+
folio_putback_hugetlb(src);
15381538
else if (rc != -EAGAIN)
15391539
list_move_tail(&src->lru, ret);
15401540

0 commit comments

Comments
 (0)