History

mm/hmm: a few more C style and comment clean ups

A few more comments and minor programming style clean ups. There should be no functional changes.

Ralph Campbell committed 7 years ago

Commit d2e8d551 parent 1f961801 file · +17 −22Browse files

Unified · Split

mm/hmm.c+17−22
@@ -32,7 +32,7 @@ static const struct mmu_notifier_ops hmm_mmu_notifier_ops; · 31 unmodified lines
3232 * hmm_get_or_create - register HMM against an mm (HMM internal)
3333 *
3434 * @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
3636 * (per-process) object, or by creating a new one.
3737 *
3838 * 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
325325 }
326326
327327 /*
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)
330330 * @end: range virtual end address (exclusive)
331331 * @fault: should we fault or not ?
332332 * @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
376376 /*
377377 * So we not only consider the individual per page request we also
378378 * 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-
382382 * fault a range with specific flags. For the latter one it is a
383383 * waste to have the user pre-fill the pfn arrays with a default
384384 * flags value.
@@ -388,7 +388,7 @@ static inline void hmm_pte_need_fault(const struct hmm_vma_walk *hmm_vma_walk, · 3 unmodified lines
388388 /* We aren't ask to do anything ... */
389389 if (!(pfns & range->flags[HMM_PFN_VALID]))
390390 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 */
392392 if ((cpu_flags & range->flags[HMM_PFN_DEVICE_PRIVATE])) {
393393 /* Do we fault on device memory ? */
394394 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
502502 hmm_vma_walk->last = end;
503503 return 0;
504504 #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 ! */
506506 return -EINVAL;
507507 #endif
508508 }
@@ -522,7 +522,6 @@ static int hmm_vma_handle_pte(struct mm_walk *walk, unsigned long addr, · 13 unmodified lines
522522 {
523523 struct hmm_vma_walk *hmm_vma_walk = walk->private;
524524 struct hmm_range *range = hmm_vma_walk->range;
525− struct vm_area_struct *vma = walk->vma;
526525 bool fault, write_fault;
527526 uint64_t cpu_flags;
528527 pte_t pte = *ptep;
@@ -571,8 +570,7 @@ static int hmm_vma_handle_pte(struct mm_walk *walk, unsigned long addr, · 42 unmodified lines
571570 if (fault || write_fault) {
572571 pte_unmap(ptep);
573572 hmm_vma_walk->last = addr;
574− migration_entry_wait(vma->vm_mm,
575− pmdp, addr);
573+ migration_entry_wait(walk->mm, pmdp, addr);
576574 return -EBUSY;
577575 }
578576 return 0;
@@ -620,13 +618,11 @@ static int hmm_vma_walk_pmd(pmd_t *pmdp, · 41 unmodified lines
620618 {
621619 struct hmm_vma_walk *hmm_vma_walk = walk->private;
622620 struct hmm_range *range = hmm_vma_walk->range;
623− struct vm_area_struct *vma = walk->vma;
624621 uint64_t *pfns = range->pfns;
625622 unsigned long addr = start, i;
626623 pte_t *ptep;
627624 pmd_t pmd;
628625
629−
630626 again:
631627 pmd = READ_ONCE(*pmdp);
632628 if (pmd_none(pmd))
@@ -648,7 +644,7 @@ again: · 15 unmodified lines
648644 0, &fault, &write_fault);
649645 if (fault || write_fault) {
650646 hmm_vma_walk->last = addr;
651− pmd_migration_entry_wait(vma->vm_mm, pmdp);
647+ pmd_migration_entry_wait(walk->mm, pmdp);
652648 return -EBUSY;
653649 }
654650 return 0;
@@ -657,11 +653,11 @@ again: · 2 unmodified lines
657653
658654 if (pmd_devmap(pmd) || pmd_trans_huge(pmd)) {
659655 /*
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
661657 * is splitting the huge pmd we will get that event through
662658 * mmu_notifier callback.
663659 *
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
665661 * huge or device mapping one and compute corresponding pfn
666662 * values.
667663 */
@@ -675,7 +671,7 @@ again: · 7 unmodified lines
675671 }
676672
677673 /*
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,
679675 * huge or transparent huge. At this point either it is a valid pmd
680676 * entry pointing to pte directory or it is a bad pmd that will not
681677 * recover.
@@ -795,10 +791,10 @@ static int hmm_vma_walk_hugetlb_entry(pte_t *pte, unsigned long hmask, · 113 unmodified lines
795791 pte_t entry;
796792 int ret = 0;
797793
798− size = 1UL << huge_page_shift(h);
794+ size = huge_page_size(h);
799795 mask = size - 1;
800796 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. */
802798 if (start & mask)
803799 return -EINVAL;
804800 if (end < (start + size))
@@ -809,8 +805,7 @@ static int hmm_vma_walk_hugetlb_entry(pte_t *pte, unsigned long hmask, · 4 unmodified lines
809805 size = PAGE_SIZE;
810806 }
811807
812−
813− ptl = huge_pte_lock(hstate_vma(walk->vma), walk->mm, pte);
808+ ptl = huge_pte_lock(hstate_vma(vma), walk->mm, pte);
814809 entry = huge_ptep_get(pte);
815810
816811 i = (start - range->start) >> range->page_shift;
@@ -859,7 +854,7 @@ static void hmm_pfns_clear(struct hmm_range *range, · 42 unmodified lines
859854 * @start: start virtual address (inclusive)
860855 * @end: end virtual address (exclusive)
861856 * @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
863858 *
864859 * Track updates to the CPU page table see include/linux/hmm.h
865860 */

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t