Commit a899b7d
arm64: hugetlb: Use __set_ptes_anysz() and __ptep_get_and_clear_anysz()
Refactor the huge_pte helpers to use the new common __set_ptes_anysz()
and __ptep_get_and_clear_anysz() APIs.
This provides 2 benefits; First, when page_table_check=on, hugetlb is
now properly/fully checked. Previously only the first page of a hugetlb
folio was checked. Second, instead of having to call __set_ptes(nr=1)
for each pte in a loop, the whole contiguous batch can now be set in one
go, which enables some efficiencies and cleans up the code.
One detail to note is that huge_ptep_clear_flush() was previously
calling ptep_clear_flush() for a non-contiguous pte (i.e. a pud or pmd
block mapping). This has a couple of disadvantages; first
ptep_clear_flush() calls ptep_get_and_clear() which transparently
handles contpte. Given we only call for non-contiguous ptes, it would be
safe, but a waste of effort. It's preferable to go straight to the layer
below. However, more problematic is that ptep_get_and_clear() is for
PAGE_SIZE entries so it calls page_table_check_pte_clear() and would not
clear the whole hugetlb folio. So let's stop special-casing the non-cont
case and just rely on get_clear_contig_flush() to do the right thing for
non-cont entries.
Reviewed-by: Catalin Marinas <[email protected]>
Signed-off-by: Ryan Roberts <[email protected]>
Reviewed-by: Anshuman Khandual <[email protected]>
Tested-by: Luiz Capitulino <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Will Deacon <[email protected]>1 parent ef493d2 commit a899b7d
1 file changed
+10
-43
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
159 | 159 | | |
160 | 160 | | |
161 | 161 | | |
162 | | - | |
| 162 | + | |
163 | 163 | | |
164 | 164 | | |
165 | 165 | | |
166 | | - | |
167 | | - | |
| 166 | + | |
168 | 167 | | |
169 | 168 | | |
170 | 169 | | |
| |||
208 | 207 | | |
209 | 208 | | |
210 | 209 | | |
211 | | - | |
| 210 | + | |
212 | 211 | | |
213 | 212 | | |
214 | 213 | | |
| |||
219 | 218 | | |
220 | 219 | | |
221 | 220 | | |
222 | | - | |
223 | | - | |
224 | 221 | | |
225 | 222 | | |
226 | 223 | | |
227 | 224 | | |
228 | 225 | | |
229 | | - | |
| 226 | + | |
230 | 227 | | |
231 | 228 | | |
232 | 229 | | |
233 | | - | |
234 | | - | |
235 | | - | |
236 | | - | |
237 | | - | |
238 | | - | |
239 | | - | |
240 | | - | |
241 | | - | |
242 | 230 | | |
243 | | - | |
| 231 | + | |
244 | 232 | | |
245 | 233 | | |
246 | | - | |
247 | | - | |
| 234 | + | |
248 | 235 | | |
249 | 236 | | |
250 | 237 | | |
| |||
434 | 421 | | |
435 | 422 | | |
436 | 423 | | |
437 | | - | |
| 424 | + | |
438 | 425 | | |
439 | | - | |
440 | 426 | | |
441 | | - | |
442 | 427 | | |
443 | 428 | | |
444 | 429 | | |
| |||
447 | 432 | | |
448 | 433 | | |
449 | 434 | | |
450 | | - | |
451 | 435 | | |
452 | 436 | | |
453 | 437 | | |
| |||
462 | 446 | | |
463 | 447 | | |
464 | 448 | | |
465 | | - | |
466 | | - | |
467 | | - | |
468 | | - | |
| 449 | + | |
469 | 450 | | |
470 | 451 | | |
471 | 452 | | |
472 | 453 | | |
473 | 454 | | |
474 | 455 | | |
475 | | - | |
476 | | - | |
477 | | - | |
| 456 | + | |
478 | 457 | | |
479 | 458 | | |
480 | 459 | | |
| |||
487 | 466 | | |
488 | 467 | | |
489 | 468 | | |
490 | | - | |
491 | 469 | | |
492 | 470 | | |
493 | 471 | | |
494 | 472 | | |
495 | | - | |
496 | | - | |
497 | | - | |
498 | | - | |
499 | | - | |
| 473 | + | |
500 | 474 | | |
501 | 475 | | |
502 | 476 | | |
| |||
505 | 479 | | |
506 | 480 | | |
507 | 481 | | |
508 | | - | |
509 | | - | |
510 | | - | |
511 | | - | |
512 | | - | |
513 | | - | |
514 | | - | |
515 | 482 | | |
516 | 483 | | |
517 | 484 | | |
| |||
0 commit comments