Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 24 Jul 2026 19:35:03 +0000
From:      Bjoern A. Zeeb <bz@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: f45506c6a6f4 - main - LinuxKPI: page.h: use atop() and ptoa() instead of PAGE_SHIFT
Message-ID:  <6a63be67.253cb.5154dc76@gitrepo.freebsd.org>

index | next in thread | raw e-mail

The branch main has been updated by bz:

URL: https://cgit.FreeBSD.org/src/commit/?id=f45506c6a6f4742cd5129d636902b61045c4754b

commit f45506c6a6f4742cd5129d636902b61045c4754b
Author:     Bjoern A. Zeeb <bz@FreeBSD.org>
AuthorDate: 2026-07-17 13:09:01 +0000
Commit:     Bjoern A. Zeeb <bz@FreeBSD.org>
CommitDate: 2026-07-24 19:33:56 +0000

    LinuxKPI: page.h: use atop() and ptoa() instead of PAGE_SHIFT
    
    With upcoming changes to 'struct page' this will make the lines
    easier to read by using the predefined macros from param.h.
    
    Sponsored by:   The FreeBSD Foundation
    MFC after:      3 days
    Reviewed by:    markj, kib
    Differential Revision: https://reviews.freebsd.org/D58298
---
 sys/compat/linuxkpi/common/include/linux/page.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sys/compat/linuxkpi/common/include/linux/page.h b/sys/compat/linuxkpi/common/include/linux/page.h
index a8e266af95fd..eb0083f5fecc 100644
--- a/sys/compat/linuxkpi/common/include/linux/page.h
+++ b/sys/compat/linuxkpi/common/include/linux/page.h
@@ -74,8 +74,8 @@ pgprot2cachemode(pgprot_t prot)
 
 #define	page_to_virt(page)	linux_page_address(page)
 #define	virt_to_page(x)		PHYS_TO_VM_PAGE(vtophys(x))
-#define	page_to_pfn(pp)		(VM_PAGE_TO_PHYS(pp) >> PAGE_SHIFT)
-#define	pfn_to_page(pfn)	(PHYS_TO_VM_PAGE((pfn) << PAGE_SHIFT))
+#define	page_to_pfn(pp)		atop(VM_PAGE_TO_PHYS(pp))
+#define	pfn_to_page(pfn)	PHYS_TO_VM_PAGE(ptoa(pfn))
 #define	nth_page(page,n)	pfn_to_page(page_to_pfn(page) + (n))
 #define	page_to_phys(page)	VM_PAGE_TO_PHYS(page)
 


home | help

Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?6a63be67.253cb.5154dc76>