Skip to content

Commit 22b751c

Browse files
Mel Gormantorvalds
authored andcommitted
mm: rename page struct field helpers
The function names page_xchg_last_nid(), page_last_nid() and reset_page_last_nid() were judged to be inconsistent so rename them to a struct_field_op style pattern. As it looked jarring to have reset_page_mapcount() and page_nid_reset_last() beside each other in memmap_init_zone(), this patch also renames reset_page_mapcount() to page_mapcount_reset(). There are others like init_page_count() but as it is used throughout the arch code a rename would likely cause more conflicts than it is worth. [akpm@linux-foundation.org: fix zcache] Signed-off-by: Mel Gorman <mgorman@suse.de> Suggested-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent e4715f0 commit 22b751c

10 files changed

Lines changed: 25 additions & 25 deletions

File tree

‎drivers/staging/zcache/zbud.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -404,7 +404,7 @@ static inline struct page *zbud_unuse_zbudpage(struct zbudpage *zbudpage,
404404
else
405405
zbud_pers_pageframes--;
406406
zbudpage_spin_unlock(zbudpage);
407-
reset_page_mapcount(page);
407+
page_mapcount_reset(page);
408408
init_page_count(page);
409409
page->index = 0;
410410
return page;

‎drivers/staging/zsmalloc/zsmalloc-main.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -472,7 +472,7 @@ static void reset_page(struct page *page)
472472
set_page_private(page, 0);
473473
page->mapping = NULL;
474474
page->freelist = NULL;
475-
reset_page_mapcount(page);
475+
page_mapcount_reset(page);
476476
}
477477

478478
static void free_zspage(struct page *first_page)

‎include/linux/mm.h‎

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -367,7 +367,7 @@ static inline struct page *compound_head(struct page *page)
367367
* both from it and to it can be tracked, using atomic_inc_and_test
368368
* and atomic_add_negative(-1).
369369
*/
370-
static inline void reset_page_mapcount(struct page *page)
370+
static inline void page_mapcount_reset(struct page *page)
371371
{
372372
atomic_set(&(page)->_mapcount, -1);
373373
}
@@ -658,28 +658,28 @@ static inline int page_to_nid(const struct page *page)
658658

659659
#ifdef CONFIG_NUMA_BALANCING
660660
#ifdef LAST_NID_NOT_IN_PAGE_FLAGS
661-
static inline int page_xchg_last_nid(struct page *page, int nid)
661+
static inline int page_nid_xchg_last(struct page *page, int nid)
662662
{
663663
return xchg(&page->_last_nid, nid);
664664
}
665665

666-
static inline int page_last_nid(struct page *page)
666+
static inline int page_nid_last(struct page *page)
667667
{
668668
return page->_last_nid;
669669
}
670-
static inline void reset_page_last_nid(struct page *page)
670+
static inline void page_nid_reset_last(struct page *page)
671671
{
672672
page->_last_nid = -1;
673673
}
674674
#else
675-
static inline int page_last_nid(struct page *page)
675+
static inline int page_nid_last(struct page *page)
676676
{
677677
return (page->flags >> LAST_NID_PGSHIFT) & LAST_NID_MASK;
678678
}
679679

680-
extern int page_xchg_last_nid(struct page *page, int nid);
680+
extern int page_nid_xchg_last(struct page *page, int nid);
681681

682-
static inline void reset_page_last_nid(struct page *page)
682+
static inline void page_nid_reset_last(struct page *page)
683683
{
684684
int nid = (1 << LAST_NID_SHIFT) - 1;
685685

@@ -688,17 +688,17 @@ static inline void reset_page_last_nid(struct page *page)
688688
}
689689
#endif /* LAST_NID_NOT_IN_PAGE_FLAGS */
690690
#else
691-
static inline int page_xchg_last_nid(struct page *page, int nid)
691+
static inline int page_nid_xchg_last(struct page *page, int nid)
692692
{
693693
return page_to_nid(page);
694694
}
695695

696-
static inline int page_last_nid(struct page *page)
696+
static inline int page_nid_last(struct page *page)
697697
{
698698
return page_to_nid(page);
699699
}
700700

701-
static inline void reset_page_last_nid(struct page *page)
701+
static inline void page_nid_reset_last(struct page *page)
702702
{
703703
}
704704
#endif

‎mm/huge_memory.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1639,7 +1639,7 @@ static void __split_huge_page_refcount(struct page *page)
16391639
page_tail->mapping = page->mapping;
16401640

16411641
page_tail->index = page->index + i;
1642-
page_xchg_last_nid(page_tail, page_last_nid(page));
1642+
page_nid_xchg_last(page_tail, page_nid_last(page));
16431643

16441644
BUG_ON(!PageAnon(page_tail));
16451645
BUG_ON(!PageUptodate(page_tail));

‎mm/mempolicy.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2316,7 +2316,7 @@ int mpol_misplaced(struct page *page, struct vm_area_struct *vma, unsigned long
23162316
* it less likely we act on an unlikely task<->page
23172317
* relation.
23182318
*/
2319-
last_nid = page_xchg_last_nid(page, polnid);
2319+
last_nid = page_nid_xchg_last(page, polnid);
23202320
if (last_nid != polnid)
23212321
goto out;
23222322
}

‎mm/migrate.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1497,7 +1497,7 @@ static struct page *alloc_misplaced_dst_page(struct page *page,
14971497
__GFP_NOWARN) &
14981498
~GFP_IOFS, 0);
14991499
if (newpage)
1500-
page_xchg_last_nid(newpage, page_last_nid(page));
1500+
page_nid_xchg_last(newpage, page_nid_last(page));
15011501

15021502
return newpage;
15031503
}
@@ -1681,7 +1681,7 @@ int migrate_misplaced_transhuge_page(struct mm_struct *mm,
16811681
if (!new_page)
16821682
goto out_fail;
16831683

1684-
page_xchg_last_nid(new_page, page_last_nid(page));
1684+
page_nid_xchg_last(new_page, page_nid_last(page));
16851685

16861686
isolated = numamigrate_isolate_page(pgdat, page);
16871687
if (!isolated) {

‎mm/mmzone.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,14 +98,14 @@ void lruvec_init(struct lruvec *lruvec)
9898
}
9999

100100
#if defined(CONFIG_NUMA_BALANCING) && !defined(LAST_NID_NOT_IN_PAGE_FLAGS)
101-
int page_xchg_last_nid(struct page *page, int nid)
101+
int page_nid_xchg_last(struct page *page, int nid)
102102
{
103103
unsigned long old_flags, flags;
104104
int last_nid;
105105

106106
do {
107107
old_flags = flags = page->flags;
108-
last_nid = page_last_nid(page);
108+
last_nid = page_nid_last(page);
109109

110110
flags &= ~(LAST_NID_MASK << LAST_NID_PGSHIFT);
111111
flags |= (nid & LAST_NID_MASK) << LAST_NID_PGSHIFT;

‎mm/page_alloc.c‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@ static void bad_page(struct page *page)
295295

296296
/* Don't complain about poisoned pages */
297297
if (PageHWPoison(page)) {
298-
reset_page_mapcount(page); /* remove PageBuddy */
298+
page_mapcount_reset(page); /* remove PageBuddy */
299299
return;
300300
}
301301

@@ -327,7 +327,7 @@ static void bad_page(struct page *page)
327327
dump_stack();
328328
out:
329329
/* Leave bad fields for debug, except PageBuddy could make trouble */
330-
reset_page_mapcount(page); /* remove PageBuddy */
330+
page_mapcount_reset(page); /* remove PageBuddy */
331331
add_taint(TAINT_BAD_PAGE);
332332
}
333333

@@ -613,7 +613,7 @@ static inline int free_pages_check(struct page *page)
613613
bad_page(page);
614614
return 1;
615615
}
616-
reset_page_last_nid(page);
616+
page_nid_reset_last(page);
617617
if (page->flags & PAGE_FLAGS_CHECK_AT_PREP)
618618
page->flags &= ~PAGE_FLAGS_CHECK_AT_PREP;
619619
return 0;
@@ -3894,8 +3894,8 @@ void __meminit memmap_init_zone(unsigned long size, int nid, unsigned long zone,
38943894
set_page_links(page, zone, nid, pfn);
38953895
mminit_verify_page_links(page, zone, nid, pfn);
38963896
init_page_count(page);
3897-
reset_page_mapcount(page);
3898-
reset_page_last_nid(page);
3897+
page_mapcount_reset(page);
3898+
page_nid_reset_last(page);
38993899
SetPageReserved(page);
39003900
/*
39013901
* Mark the block movable so that blocks are reserved for

‎mm/slob.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -360,7 +360,7 @@ static void slob_free(void *block, int size)
360360
clear_slob_page_free(sp);
361361
spin_unlock_irqrestore(&slob_lock, flags);
362362
__ClearPageSlab(sp);
363-
reset_page_mapcount(sp);
363+
page_mapcount_reset(sp);
364364
slob_free_pages(b, 0);
365365
return;
366366
}

‎mm/slub.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1408,7 +1408,7 @@ static void __free_slab(struct kmem_cache *s, struct page *page)
14081408
__ClearPageSlab(page);
14091409

14101410
memcg_release_pages(s, order);
1411-
reset_page_mapcount(page);
1411+
page_mapcount_reset(page);
14121412
if (current->reclaim_state)
14131413
current->reclaim_state->reclaimed_slab += pages;
14141414
__free_memcg_kmem_pages(page, order);

0 commit comments

Comments
 (0)