Messages in this thread | | | Date | Tue, 16 Jun 2020 11:59:14 -0400 | From | Peter Xu <> | Subject | Re: [PATCH 06/25] mm/arm64: Use mm_fault_accounting() |
| |
Hi, Will,
On Tue, Jun 16, 2020 at 08:43:08AM +0100, Will Deacon wrote: > Please can you explain why it's ok to move the PERF_COUNT_SW_PAGE_FAULTS > update like this? Seems like a user-visible change to me, so some > justification would really help.
Indeed this could be a functional change for PERF_COUNT_SW_PAGE_FAULTS on some archs, e.g., for arm64, PERF_COUNT_SW_PAGE_FAULTS previously will also contain accounting of severe errors where we go into the "no_context" path. However if you see the other archs, it's not always true, for example, the xtensa arch only accounts the correctly handled faults (arch/xtensa/mm/fault.c).
After I thought about this, I don't think it's extremely useful (or please correct me if I missed something important) to use PERF_COUNT_SW_PAGE_FAULTS for fatal error accountings among all those correct ones. After all they are really extremely rare cases, and even if we got a sigbus for a process, we'll normally got something dumped in dmesg so if we really want to capture the error cases there should always be a better way (because by following things like dmesg we can not only know how many error faults triggered, but also on the details of the errors).
IOW, my understanding of users of PERF_COUNT_SW_PAGE_FAULTS is that they want to trap normal/correct page faults, not really care about rare errors.
Then when I went back to think PERF_COUNT_SW_PAGE_FAULTS, it's really about:
A=PERF_COUNT_SW_PAGE_FAULTS B=PERF_COUNT_SW_PAGE_FAULTS_MAJ C=PERF_COUNT_SW_PAGE_FAULTS_MIN
And:
A=B+C
If that's the case (which is simple and clear), it's really helpful too that we unify this definition across all the architectures, then it'll also be easier for us to provide some helper like mm_fault_accounting() so that the accounting can be managed in the general code rather than in arch-specific ways.
Thanks,
-- Peter Xu
| |