Re: [PATCH 01/26] mm: Do page fault accounting in handle_mm_fault

From: Gerald Schaefer
Date: Wed Jun 24 2020 - 14:49:20 EST


On Fri, 19 Jun 2020 12:05:13 -0400
Peter Xu <peterx@xxxxxxxxxx> wrote:

[...]

> @@ -4393,6 +4425,38 @@ vm_fault_t handle_mm_fault(struct vm_area_struct *vma, unsigned long address,
> mem_cgroup_oom_synchronize(false);
> }
>
> + if (ret & VM_FAULT_RETRY)
> + return ret;

I'm wondering if this also needs a check and exit for VM_FAULT_ERROR.
In arch code (s390 and all others I briefly checked), the accounting
was skipped for VM_FAULT_ERROR case.

> +
> + /*
> + * Do accounting in the common code, to avoid unnecessary
> + * architecture differences or duplicated code.
> + *
> + * We arbitrarily make the rules be:
> + *
> + * - faults that never even got here (because the address
> + * wasn't valid). That includes arch_vma_access_permitted()

Missing "do not count" at the end of the first sentence?

> + * failing above.
> + *
> + * So this is expressly not a "this many hardware page
> + * faults" counter. Use the hw profiling for that.
> + *
> + * - incomplete faults (ie RETRY) do not count (see above).
> + * They will only count once completed.
> + *
> + * - the fault counts as a "major" fault when the final
> + * successful fault is VM_FAULT_MAJOR, or if it was a
> + * retry (which implies that we couldn't handle it
> + * immediately previously).
> + *
> + * - if the fault is done for GUP, regs wil be NULL and

wil -> will

Regards,
Gerald