Skip to content

Commit 403d133

Browse files
linmag7torvalds
authored andcommitted
mm: pgtable: fix pte_swp_exclusive
Make pte_swp_exclusive return bool instead of int. This will better reflect how pte_swp_exclusive is actually used in the code. This fixes swap/swapoff problems on Alpha due pte_swp_exclusive not returning correct values when _PAGE_SWP_EXCLUSIVE bit resides in upper 32-bits of PTE (like on alpha). Suggested-by: Al Viro <[email protected]> Signed-off-by: Magnus Lindholm <[email protected]> Cc: Sam James <[email protected]> Link: https://lore.kernel.org/lkml/[email protected]/ Link: https://lore.kernel.org/lkml/20250602041118.GA2675383@ZenIV/ [ Applied as the 'sed' script Al suggested - Linus ] Signed-off-by: Linus Torvalds <[email protected]>
1 parent 488ef35 commit 403d133

File tree

26 files changed

+27
-27
lines changed

26 files changed

+27
-27
lines changed

arch/alpha/include/asm/pgtable.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,7 @@ extern inline pte_t mk_swap_pte(unsigned long type, unsigned long offset)
327327
#define __pte_to_swp_entry(pte) ((swp_entry_t) { pte_val(pte) })
328328
#define __swp_entry_to_pte(x) ((pte_t) { (x).val })
329329

330-
static inline int pte_swp_exclusive(pte_t pte)
330+
static inline bool pte_swp_exclusive(pte_t pte)
331331
{
332332
return pte_val(pte) & _PAGE_SWP_EXCLUSIVE;
333333
}

arch/arc/include/asm/pgtable-bits-arcv2.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ void update_mmu_cache_range(struct vm_fault *vmf, struct vm_area_struct *vma,
130130
#define __pte_to_swp_entry(pte) ((swp_entry_t) { pte_val(pte) })
131131
#define __swp_entry_to_pte(x) ((pte_t) { (x).val })
132132

133-
static inline int pte_swp_exclusive(pte_t pte)
133+
static inline bool pte_swp_exclusive(pte_t pte)
134134
{
135135
return pte_val(pte) & _PAGE_SWP_EXCLUSIVE;
136136
}

arch/arm/include/asm/pgtable.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,7 @@ static inline pte_t pte_modify(pte_t pte, pgprot_t newprot)
301301
#define __pte_to_swp_entry(pte) ((swp_entry_t) { pte_val(pte) })
302302
#define __swp_entry_to_pte(swp) __pte((swp).val)
303303

304-
static inline int pte_swp_exclusive(pte_t pte)
304+
static inline bool pte_swp_exclusive(pte_t pte)
305305
{
306306
return pte_isset(pte, L_PTE_SWP_EXCLUSIVE);
307307
}

arch/arm64/include/asm/pgtable.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -563,7 +563,7 @@ static inline pte_t pte_swp_mkexclusive(pte_t pte)
563563
return set_pte_bit(pte, __pgprot(PTE_SWP_EXCLUSIVE));
564564
}
565565

566-
static inline int pte_swp_exclusive(pte_t pte)
566+
static inline bool pte_swp_exclusive(pte_t pte)
567567
{
568568
return pte_val(pte) & PTE_SWP_EXCLUSIVE;
569569
}

arch/csky/include/asm/pgtable.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ static inline pte_t pte_mkyoung(pte_t pte)
200200
return pte;
201201
}
202202

203-
static inline int pte_swp_exclusive(pte_t pte)
203+
static inline bool pte_swp_exclusive(pte_t pte)
204204
{
205205
return pte_val(pte) & _PAGE_SWP_EXCLUSIVE;
206206
}

arch/hexagon/include/asm/pgtable.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -387,7 +387,7 @@ static inline unsigned long pmd_page_vaddr(pmd_t pmd)
387387
(((type & 0x1f) << 1) | \
388388
((offset & 0x3ffff8) << 10) | ((offset & 0x7) << 7)) })
389389

390-
static inline int pte_swp_exclusive(pte_t pte)
390+
static inline bool pte_swp_exclusive(pte_t pte)
391391
{
392392
return pte_val(pte) & _PAGE_SWP_EXCLUSIVE;
393393
}

arch/loongarch/include/asm/pgtable.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,7 @@ static inline pte_t mk_swap_pte(unsigned long type, unsigned long offset)
301301
#define __pmd_to_swp_entry(pmd) ((swp_entry_t) { pmd_val(pmd) })
302302
#define __swp_entry_to_pmd(x) ((pmd_t) { (x).val | _PAGE_HUGE })
303303

304-
static inline int pte_swp_exclusive(pte_t pte)
304+
static inline bool pte_swp_exclusive(pte_t pte)
305305
{
306306
return pte_val(pte) & _PAGE_SWP_EXCLUSIVE;
307307
}

arch/m68k/include/asm/mcf_pgtable.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ extern pgd_t kernel_pg_dir[PTRS_PER_PGD];
268268
#define __pte_to_swp_entry(pte) ((swp_entry_t) { pte_val(pte) })
269269
#define __swp_entry_to_pte(x) (__pte((x).val))
270270

271-
static inline int pte_swp_exclusive(pte_t pte)
271+
static inline bool pte_swp_exclusive(pte_t pte)
272272
{
273273
return pte_val(pte) & _PAGE_SWP_EXCLUSIVE;
274274
}

arch/m68k/include/asm/motorola_pgtable.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ extern pgd_t kernel_pg_dir[128];
185185
#define __pte_to_swp_entry(pte) ((swp_entry_t) { pte_val(pte) })
186186
#define __swp_entry_to_pte(x) ((pte_t) { (x).val })
187187

188-
static inline int pte_swp_exclusive(pte_t pte)
188+
static inline bool pte_swp_exclusive(pte_t pte)
189189
{
190190
return pte_val(pte) & _PAGE_SWP_EXCLUSIVE;
191191
}

arch/m68k/include/asm/sun3_pgtable.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ extern pgd_t kernel_pg_dir[PTRS_PER_PGD];
169169
#define __pte_to_swp_entry(pte) ((swp_entry_t) { pte_val(pte) })
170170
#define __swp_entry_to_pte(x) ((pte_t) { (x).val })
171171

172-
static inline int pte_swp_exclusive(pte_t pte)
172+
static inline bool pte_swp_exclusive(pte_t pte)
173173
{
174174
return pte_val(pte) & _PAGE_SWP_EXCLUSIVE;
175175
}

0 commit comments

Comments
 (0)