Re: [PATCH v4] mm: Avoid unnecessary page fault retires on shared memory types

2022-05-30 Thread Christian Borntraeger
Am 30.05.22 um 18:00 schrieb Peter Xu: On Mon, May 30, 2022 at 11:52:54AM -0400, Peter Xu wrote: On Mon, May 30, 2022 at 11:35:10AM +0200, Christian Borntraeger wrote: Am 29.05.22 um 22:33 schrieb Heiko Carstens: [...] Guess the patch below on top of your patch is what we want. Just for

Re: [PATCH v4] mm: Avoid unnecessary page fault retires on shared memory types

2022-05-30 Thread Peter Xu
On Mon, May 30, 2022 at 07:03:31PM +0200, Heiko Carstens wrote: > On Mon, May 30, 2022 at 12:00:52PM -0400, Peter Xu wrote: > > On Mon, May 30, 2022 at 11:52:54AM -0400, Peter Xu wrote: > > > On Mon, May 30, 2022 at 11:35:10AM +0200, Christian Borntraeger wrote: > > > > > diff --git

Re: [PATCH v4] mm: Avoid unnecessary page fault retires on shared memory types

2022-05-30 Thread Heiko Carstens
On Mon, May 30, 2022 at 12:00:52PM -0400, Peter Xu wrote: > On Mon, May 30, 2022 at 11:52:54AM -0400, Peter Xu wrote: > > On Mon, May 30, 2022 at 11:35:10AM +0200, Christian Borntraeger wrote: > > > > diff --git a/arch/s390/mm/fault.c b/arch/s390/mm/fault.c > > > > index 4608cc962ecf..e1d40ca341b7

Re: [PATCH v4] mm: Avoid unnecessary page fault retires on shared memory types

2022-05-30 Thread Peter Xu
On Mon, May 30, 2022 at 11:52:54AM -0400, Peter Xu wrote: > On Mon, May 30, 2022 at 11:35:10AM +0200, Christian Borntraeger wrote: > > > > > > Am 29.05.22 um 22:33 schrieb Heiko Carstens: > > [...] > > > > > > Guess the patch below on top of your patch is what we want. > > > Just for

Re: [PATCH v4] mm: Avoid unnecessary page fault retires on shared memory types

2022-05-30 Thread Peter Xu
On Mon, May 30, 2022 at 11:35:10AM +0200, Christian Borntraeger wrote: > > > Am 29.05.22 um 22:33 schrieb Heiko Carstens: > [...] > > > > Guess the patch below on top of your patch is what we want. > > Just for clarification: if gmap is not NULL then the process is a kvm > > process. So,

Re: [PATCH v4] mm: Avoid unnecessary page fault retires on shared memory types

2022-05-30 Thread Catalin Marinas
On Fri, May 27, 2022 at 03:39:36PM -0400, Peter Xu wrote: > diff --git a/arch/arm64/mm/fault.c b/arch/arm64/mm/fault.c > index 77341b160aca..e401d416bbd6 100644 > --- a/arch/arm64/mm/fault.c > +++ b/arch/arm64/mm/fault.c > @@ -607,6 +607,10 @@ static int __kprobes do_page_fault(unsigned long far,

Re: [PATCH v4] mm: Avoid unnecessary page fault retires on shared memory types

2022-05-30 Thread Christian Borntraeger
Am 29.05.22 um 22:33 schrieb Heiko Carstens: [...] Guess the patch below on top of your patch is what we want. Just for clarification: if gmap is not NULL then the process is a kvm process. So, depending on the workload, this optimization makes sense. diff --git a/arch/s390/mm/fault.c

Re: [PATCH v4] mm: Avoid unnecessary page fault retires on shared memory types

2022-05-29 Thread Heiko Carstens
On Fri, May 27, 2022 at 03:39:36PM -0400, Peter Xu wrote: > diff --git a/arch/s390/mm/fault.c b/arch/s390/mm/fault.c > index e173b6187ad5..4608cc962ecf 100644 > --- a/arch/s390/mm/fault.c > +++ b/arch/s390/mm/fault.c > @@ -433,6 +433,17 @@ static inline vm_fault_t do_exception(struct pt_regs >

[PATCH v4] mm: Avoid unnecessary page fault retires on shared memory types

2022-05-27 Thread Peter Xu
I observed that for each of the shared file-backed page faults, we're very likely to retry one more time for the 1st write fault upon no page. It's because we'll need to release the mmap lock for dirty rate limit purpose with balance_dirty_pages_ratelimited() (in fault_dirty_shared_page()). Then