On Tue, Apr 23, 2024 at 01:27:09PM +0200, Thomas Zimmermann wrote:
Am 23.04.24 um 11:55 schrieb Nam Cao:
...
The page-fault handler at [1] use vm_fault.pgoff to retrieve the page structure. Can we do the same here and avoid that computation?
Yes, thanks for the suggestion.
It will change things a bit: offset will not be the exact value anymore, but will be rounded down to multiple of PAGE_SIZE. But that doesn't matter, because it will only be used to calculate the page offset later on.
We can clean this up and rename this "offset" to "pg_offset". But that's for another day.
But can't we use struct vm_fault.pgoff directly? The page-fault handler has used it since forever. The look-up code for the pageref should probably do the same, because there's a 1:1 connection between the page and the pageref. The pageref structure only exists because we cannot store its data in struct page directly.
AFAICT pgoff is exactly the value want to compute. See [1] and the calculation at [2].
Completely agree. I just wanted to point out that the value inside the variable "offset" won't be the same as before, but it's still correct.
I just tested the patch on real hardware, will send it shortly.
Best regards, Nam