Thread (3 messages) 3 messages, 2 authors, 2026-01-12

Re: [PATCH] powerpc/mm: Use pte_advance_pfn() in set_huge_pte_at()

From: Andrew Donnellan <hidden>
Date: 2026-01-12 04:23:50

On Thu, 2025-12-18 at 19:29 +0100, Christophe Leroy (CS GROUP) wrote:
quoted
  	for (i = 0; i < sz / pdsize; i++, ptep++, addr += pdsize) {
  		__set_pte_at(mm, addr, ptep, pte, 0);
-		pte = __pte(pte_val(pte) + ((unsigned long long)pdsize /
PAGE_SIZE << PFN_PTE_SHIFT));
+		pte = pte_advance_pfn(pte, pdsize / PAGE_SIZE);
How can this work ?

pdsize is 4M, PAGE_SIZE is 4k so pdsize/PAGE_SIZE is 0x400.

PFN_PTE_SHIFT is 24.

0x400 << 24 is more than what an unsigned long can contain in 
pte_advance_pfn()
Ah, in spite of the explicit unsigned long long cast that should've reminded me
otherwise, I forgot that a long isn't 64 bits on 32 bit machines.


-- 
Andrew Donnellan    OzLabs, ADL Canberra
ajd@linux.ibm.com   IBM Australia Limited
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help