A few more comments and minor programming style clean ups. There should be no functional changes.
Unified · Split
| @@ -32,7 +32,7 @@ static const struct mmu_notifier_ops hmm_mmu_notifier_ops; · 31 unmodified lines | ||
| 32 | 32 | * hmm_get_or_create - register HMM against an mm (HMM internal) |
| 33 | 33 | * |
| 34 | 34 | * @mm: mm struct to attach to |
| 35 | − * Returns: returns an HMM object, either by referencing the existing | |
| 35 | + * Return: an HMM object, either by referencing the existing | |
| 36 | 36 | * (per-process) object, or by creating a new one. |
| 37 | 37 | * |
| 38 | 38 | * This is not intended to be used directly by device drivers. If mm already |
| @@ -325,8 +325,8 @@ static int hmm_pfns_bad(unsigned long addr, · 286 unmodified lines | ||
| 325 | 325 | } |
| 326 | 326 | |
| 327 | 327 | /* |
| 328 | − * hmm_vma_walk_hole() - handle a range lacking valid pmd or pte(s) | |
| 329 | − * @start: range virtual start address (inclusive) | |
| 328 | + * hmm_vma_walk_hole_() - handle a range lacking valid pmd or pte(s) | |
| 329 | + * @addr: range virtual start address (inclusive) | |
| 330 | 330 | * @end: range virtual end address (exclusive) |
| 331 | 331 | * @fault: should we fault or not ? |
| 332 | 332 | * @write_fault: write fault ? |
| @@ -376,9 +376,9 @@ static inline void hmm_pte_need_fault(const struct hmm_vma_walk *hmm_vma_walk, · 43 unmodified lines | ||
| 376 | 376 | /* |
| 377 | 377 | * So we not only consider the individual per page request we also |
| 378 | 378 | * consider the default flags requested for the range. The API can |
| 379 | − * be use in 2 fashions. The first one where the HMM user coalesce | |
| 380 | − * multiple page fault into one request and set flags per pfns for | |
| 381 | − * of those faults. The second one where the HMM user want to pre- | |
| 379 | + * be used 2 ways. The first one where the HMM user coalesces | |
| 380 | + * multiple page faults into one request and sets flags per pfn for | |
| 381 | + * those faults. The second one where the HMM user wants to pre- | |
| 382 | 382 | * fault a range with specific flags. For the latter one it is a |
| 383 | 383 | * waste to have the user pre-fill the pfn arrays with a default |
| 384 | 384 | * flags value. |
| @@ -388,7 +388,7 @@ static inline void hmm_pte_need_fault(const struct hmm_vma_walk *hmm_vma_walk, · 3 unmodified lines | ||
| 388 | 388 | /* We aren't ask to do anything ... */ |
| 389 | 389 | if (!(pfns & range->flags[HMM_PFN_VALID])) |
| 390 | 390 | return; |
| 391 | − /* If this is device memory than only fault if explicitly requested */ | |
| 391 | + /* If this is device memory then only fault if explicitly requested */ | |
| 392 | 392 | if ((cpu_flags & range->flags[HMM_PFN_DEVICE_PRIVATE])) { |
| 393 | 393 | /* Do we fault on device memory ? */ |
| 394 | 394 | if (pfns & range->flags[HMM_PFN_DEVICE_PRIVATE]) { |
| @@ -502,7 +502,7 @@ static int hmm_vma_handle_pmd(struct mm_walk *walk, · 107 unmodified lines | ||
| 502 | 502 | hmm_vma_walk->last = end; |
| 503 | 503 | return 0; |
| 504 | 504 | #else |
| 505 | − /* If THP is not enabled then we should never reach that code ! */ | |
| 505 | + /* If THP is not enabled then we should never reach this code ! */ | |
| 506 | 506 | return -EINVAL; |
| 507 | 507 | #endif |
| 508 | 508 | } |
| @@ -522,7 +522,6 @@ static int hmm_vma_handle_pte(struct mm_walk *walk, unsigned long addr, · 13 unmodified lines | ||
| 522 | 522 | { |
| 523 | 523 | struct hmm_vma_walk *hmm_vma_walk = walk->private; |
| 524 | 524 | struct hmm_range *range = hmm_vma_walk->range; |
| 525 | − struct vm_area_struct *vma = walk->vma; | |
| 526 | 525 | bool fault, write_fault; |
| 527 | 526 | uint64_t cpu_flags; |
| 528 | 527 | pte_t pte = *ptep; |
| @@ -571,8 +570,7 @@ static int hmm_vma_handle_pte(struct mm_walk *walk, unsigned long addr, · 42 unmodified lines | ||
| 571 | 570 | if (fault || write_fault) { |
| 572 | 571 | pte_unmap(ptep); |
| 573 | 572 | hmm_vma_walk->last = addr; |
| 574 | − migration_entry_wait(vma->vm_mm, | |
| 575 | − pmdp, addr); | |
| 573 | + migration_entry_wait(walk->mm, pmdp, addr); | |
| 576 | 574 | return -EBUSY; |
| 577 | 575 | } |
| 578 | 576 | return 0; |
| @@ -620,13 +618,11 @@ static int hmm_vma_walk_pmd(pmd_t *pmdp, · 41 unmodified lines | ||
| 620 | 618 | { |
| 621 | 619 | struct hmm_vma_walk *hmm_vma_walk = walk->private; |
| 622 | 620 | struct hmm_range *range = hmm_vma_walk->range; |
| 623 | − struct vm_area_struct *vma = walk->vma; | |
| 624 | 621 | uint64_t *pfns = range->pfns; |
| 625 | 622 | unsigned long addr = start, i; |
| 626 | 623 | pte_t *ptep; |
| 627 | 624 | pmd_t pmd; |
| 628 | 625 | |
| 629 | − | |
| 630 | 626 | again: |
| 631 | 627 | pmd = READ_ONCE(*pmdp); |
| 632 | 628 | if (pmd_none(pmd)) |
| @@ -648,7 +644,7 @@ again: · 15 unmodified lines | ||
| 648 | 644 | 0, &fault, &write_fault); |
| 649 | 645 | if (fault || write_fault) { |
| 650 | 646 | hmm_vma_walk->last = addr; |
| 651 | − pmd_migration_entry_wait(vma->vm_mm, pmdp); | |
| 647 | + pmd_migration_entry_wait(walk->mm, pmdp); | |
| 652 | 648 | return -EBUSY; |
| 653 | 649 | } |
| 654 | 650 | return 0; |
| @@ -657,11 +653,11 @@ again: · 2 unmodified lines | ||
| 657 | 653 | |
| 658 | 654 | if (pmd_devmap(pmd) || pmd_trans_huge(pmd)) { |
| 659 | 655 | /* |
| 660 | − * No need to take pmd_lock here, even if some other threads | |
| 656 | + * No need to take pmd_lock here, even if some other thread | |
| 661 | 657 | * is splitting the huge pmd we will get that event through |
| 662 | 658 | * mmu_notifier callback. |
| 663 | 659 | * |
| 664 | − * So just read pmd value and check again its a transparent | |
| 660 | + * So just read pmd value and check again it's a transparent | |
| 665 | 661 | * huge or device mapping one and compute corresponding pfn |
| 666 | 662 | * values. |
| 667 | 663 | */ |
| @@ -675,7 +671,7 @@ again: · 7 unmodified lines | ||
| 675 | 671 | } |
| 676 | 672 | |
| 677 | 673 | /* |
| 678 | − * We have handled all the valid case above ie either none, migration, | |
| 674 | + * We have handled all the valid cases above ie either none, migration, | |
| 679 | 675 | * huge or transparent huge. At this point either it is a valid pmd |
| 680 | 676 | * entry pointing to pte directory or it is a bad pmd that will not |
| 681 | 677 | * recover. |
| @@ -795,10 +791,10 @@ static int hmm_vma_walk_hugetlb_entry(pte_t *pte, unsigned long hmask, · 113 unmodified lines | ||
| 795 | 791 | pte_t entry; |
| 796 | 792 | int ret = 0; |
| 797 | 793 | |
| 798 | − size = 1UL << huge_page_shift(h); | |
| 794 | + size = huge_page_size(h); | |
| 799 | 795 | mask = size - 1; |
| 800 | 796 | if (range->page_shift != PAGE_SHIFT) { |
| 801 | − /* Make sure we are looking at full page. */ | |
| 797 | + /* Make sure we are looking at a full page. */ | |
| 802 | 798 | if (start & mask) |
| 803 | 799 | return -EINVAL; |
| 804 | 800 | if (end < (start + size)) |
| @@ -809,8 +805,7 @@ static int hmm_vma_walk_hugetlb_entry(pte_t *pte, unsigned long hmask, · 4 unmodified lines | ||
| 809 | 805 | size = PAGE_SIZE; |
| 810 | 806 | } |
| 811 | 807 | |
| 812 | − | |
| 813 | − ptl = huge_pte_lock(hstate_vma(walk->vma), walk->mm, pte); | |
| 808 | + ptl = huge_pte_lock(hstate_vma(vma), walk->mm, pte); | |
| 814 | 809 | entry = huge_ptep_get(pte); |
| 815 | 810 | |
| 816 | 811 | i = (start - range->start) >> range->page_shift; |
| @@ -859,7 +854,7 @@ static void hmm_pfns_clear(struct hmm_range *range, · 42 unmodified lines | ||
| 859 | 854 | * @start: start virtual address (inclusive) |
| 860 | 855 | * @end: end virtual address (exclusive) |
| 861 | 856 | * @page_shift: expect page shift for the range |
| 862 | − * Returns 0 on success, -EFAULT if the address space is no longer valid | |
| 857 | + * Return: 0 on success, -EFAULT if the address space is no longer valid | |
| 863 | 858 | * |
| 864 | 859 | * Track updates to the CPU page table see include/linux/hmm.h |
| 865 | 860 | */ |