Message ID | 20240917073117.1531207-1-anshuman.khandual@arm.com (mailing list archive) |
---|---|
Headers | show |
Series | mm: Use pxdp_get() for accessing page table entries | expand |
Le 17/09/2024 à 09:31, Anshuman Khandual a écrit : > This series converts all generic page table entries direct derefences via > pxdp_get() based helpers extending the changes brought in via the commit > c33c794828f2 ("mm: ptep_get() conversion"). First it does some platform > specific changes for m68k and x86 architecture. > > This series has been build tested on multiple architecture such as x86, > arm64, powerpc, powerpc64le, riscv, and m68k etc. Seems like this series imply sub-optimal code with unnecessary reads. Lets take a simple exemple : function mm_find_pmd() in mm/rmap.c On a PPC32 platform (2 level pagetables): Before the patch: 00001b54 <mm_find_pmd>: 1b54: 80 63 00 18 lwz r3,24(r3) 1b58: 54 84 65 3a rlwinm r4,r4,12,20,29 1b5c: 7c 63 22 14 add r3,r3,r4 1b60: 4e 80 00 20 blr Here, the function reads mm->pgd, then calculates and returns a pointer to the PMD entry corresponding to the address. After the patch: 00001b54 <mm_find_pmd>: 1b54: 81 23 00 18 lwz r9,24(r3) 1b58: 54 84 65 3a rlwinm r4,r4,12,20,29 1b5c: 7d 49 20 2e lwzx r10,r9,r4 <= useless read 1b60: 7c 69 22 14 add r3,r9,r4 1b64: 7d 49 20 2e lwzx r10,r9,r4 <= useless read 1b68: 7d 29 20 2e lwzx r9,r9,r4 <= useless read 1b6c: 4e 80 00 20 blr Here, the function also reads mm->pgd and still calculates and returns a pointer to the PMD entry corresponding to the address. But in addition to that it reads three times that entry while doing nothing at all with the value read. On PPC32, PMD/PUD/P4D are single entry tables folded into the corresponding PGD entry, it is therefore pointless to read the intermediate entries. Christophe