Skip to content

Commit dab6e71

Browse files
Peter Zijlstrahansendc
authored andcommitted
mm: Rename pmd_read_atomic()
There's no point in having the identical routines for PTE/PMD have different names. Signed-off-by: Peter Zijlstra (Intel) <[email protected]> Link: https://lkml.kernel.org/r/20221022114424.841277397%40infradead.org
1 parent 6ca297d commit dab6e71

File tree

7 files changed

+9
-14
lines changed

7 files changed

+9
-14
lines changed

include/linux/pgtable.h

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1352,11 +1352,6 @@ static inline int pud_trans_unstable(pud_t *pud)
13521352
#endif
13531353
}
13541354

1355-
static inline pmd_t pmd_read_atomic(pmd_t *pmdp)
1356-
{
1357-
return pmdp_get_lockless(pmdp);
1358-
}
1359-
13601355
#ifndef arch_needs_pgtable_deposit
13611356
#define arch_needs_pgtable_deposit() (false)
13621357
#endif
@@ -1383,13 +1378,13 @@ static inline pmd_t pmd_read_atomic(pmd_t *pmdp)
13831378
*/
13841379
static inline int pmd_none_or_trans_huge_or_clear_bad(pmd_t *pmd)
13851380
{
1386-
pmd_t pmdval = pmd_read_atomic(pmd);
1381+
pmd_t pmdval = pmdp_get_lockless(pmd);
13871382
/*
13881383
* The barrier will stabilize the pmdval in a register or on
13891384
* the stack so that it will stop changing under the code.
13901385
*
13911386
* When CONFIG_TRANSPARENT_HUGEPAGE=y on x86 32bit PAE,
1392-
* pmd_read_atomic is allowed to return a not atomic pmdval
1387+
* pmdp_get_lockless is allowed to return a not atomic pmdval
13931388
* (for example pointing to an hugepage that has never been
13941389
* mapped in the pmd). The below checks will only care about
13951390
* the low part of the pmd with 32bit PAE x86 anyway, with the

mm/hmm.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,7 @@ static int hmm_vma_walk_pmd(pmd_t *pmdp,
361361
* huge or device mapping one and compute corresponding pfn
362362
* values.
363363
*/
364-
pmd = pmd_read_atomic(pmdp);
364+
pmd = pmdp_get_lockless(pmdp);
365365
barrier();
366366
if (!pmd_devmap(pmd) && !pmd_trans_huge(pmd))
367367
goto again;

mm/khugepaged.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -862,7 +862,7 @@ static int find_pmd_or_thp_or_none(struct mm_struct *mm,
862862
if (!*pmd)
863863
return SCAN_PMD_NULL;
864864

865-
pmde = pmd_read_atomic(*pmd);
865+
pmde = pmdp_get_lockless(*pmd);
866866

867867
#ifdef CONFIG_TRANSPARENT_HUGEPAGE
868868
/* See comments in pmd_none_or_trans_huge_or_clear_bad() */

mm/mapping_dirty_helpers.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ static int clean_record_pte(pte_t *pte, unsigned long addr,
126126
static int wp_clean_pmd_entry(pmd_t *pmd, unsigned long addr, unsigned long end,
127127
struct mm_walk *walk)
128128
{
129-
pmd_t pmdval = pmd_read_atomic(pmd);
129+
pmd_t pmdval = pmdp_get_lockless(pmd);
130130

131131
if (!pmd_trans_unstable(&pmdval))
132132
return 0;

mm/mprotect.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@ static unsigned long change_pte_range(struct mmu_gather *tlb,
294294
*/
295295
static inline int pmd_none_or_clear_bad_unless_trans_huge(pmd_t *pmd)
296296
{
297-
pmd_t pmdval = pmd_read_atomic(pmd);
297+
pmd_t pmdval = pmdp_get_lockless(pmd);
298298

299299
/* See pmd_none_or_trans_huge_or_clear_bad for info on barrier */
300300
#ifdef CONFIG_TRANSPARENT_HUGEPAGE

mm/userfaultfd.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -630,7 +630,7 @@ static __always_inline ssize_t __mcopy_atomic(struct mm_struct *dst_mm,
630630
break;
631631
}
632632

633-
dst_pmdval = pmd_read_atomic(dst_pmd);
633+
dst_pmdval = pmdp_get_lockless(dst_pmd);
634634
/*
635635
* If the dst_pmd is mapped as THP don't
636636
* override it and just be strict.

mm/vmscan.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4039,9 +4039,9 @@ static void walk_pmd_range(pud_t *pud, unsigned long start, unsigned long end,
40394039
/* walk_pte_range() may call get_next_vma() */
40404040
vma = args->vma;
40414041
for (i = pmd_index(start), addr = start; addr != end; i++, addr = next) {
4042-
pmd_t val = pmd_read_atomic(pmd + i);
4042+
pmd_t val = pmdp_get_lockless(pmd + i);
40434043

4044-
/* for pmd_read_atomic() */
4044+
/* for pmdp_get_lockless() */
40454045
barrier();
40464046

40474047
next = pmd_addr_end(addr, end);

0 commit comments

Comments
 (0)