On Mon, 31 Mar 2025 18:30:33 -0700 Linus Torvalds <torva...@linux-foundation.org> wrote:
> On Mon, 31 Mar 2025 at 18:01, Steven Rostedt <rost...@goodmis.org> wrote: > > > > Note, I believe that Linus brought up the issue that because this physical > > memory is not currently part of the memory allocator (it's not aware of it > > yet), that the getting struct page or a "pfn" for it may not be reliable. > > 'pfn' is always reliable. > > The pfn ('page frame number') is literally just the physical address > expressed in 'page units', ie just shifted down by the page shift. Ah, for some reason I thought the pfn mapped directly to struct pages. > > So pfn and phys_addr_t are interchangeable when it comes to mapping > pages. The pfn is in fact often the preferred form, because on 32-bit > architectures a pfn is 32-bit, but a phys_addr_t is often 64-bit and > generates extra code. > > I think 'pfn' was introduced as a name ong long ago because it was > what the alpha architecture used in the VM documentation. It probably > predates that too, but it's where I got it from, iirc. > It is old, as I remember using it when I first started Linux kernel development back in 1998. But my memory of it was it was also used as an index into a struct page array. Which is why I was thinking it was somewhat interchangeable with struct page. But that was a long time ago when I was an embedded developer, but I've only been using struct page for my needs in the last couple of decades. -- Steve