Re: [PATCH] mremap: Avoid TLB flushing anonymous pages that are not in swap cache

2018-06-06 Thread Michal Hocko
On Tue 05-06-18 20:51:40, Mel Gorman wrote: [...] > mremap: Avoid excessive TLB flushing for anonymous pages that are not in swap > cache > > Commit 5d1904204c99 ("mremap: fix race between mremap() and page cleanning") > fixed races between mremap and other operations for both file-backed and > a

Re: [PATCH] mremap: Avoid TLB flushing anonymous pages that are not in swap cache

2018-06-05 Thread Nadav Amit
Mel Gorman wrote: > On Tue, Jun 05, 2018 at 12:53:57PM -0700, Nadav Amit wrote: >> While I do not have a specific reservation regarding the logic, I find the >> current TLB invalidation scheme hard to follow and inconsistent. I guess >> should_force_flush() can be extended and used more commonly

Re: [PATCH] mremap: Avoid TLB flushing anonymous pages that are not in swap cache

2018-06-05 Thread Mel Gorman
On Tue, Jun 05, 2018 at 12:53:57PM -0700, Nadav Amit wrote: > While I do not have a specific reservation regarding the logic, I find the > current TLB invalidation scheme hard to follow and inconsistent. I guess > should_force_flush() can be extended and used more commonly to make things > clearer.

Re: [PATCH] mremap: Avoid TLB flushing anonymous pages that are not in swap cache

2018-06-05 Thread Mel Gorman
On Tue, Jun 05, 2018 at 12:54:27PM -0700, Dave Hansen wrote: > On 06/05/2018 12:51 PM, Mel Gorman wrote: > > Using another testcase that simply calls mremap heavily with varying number > > of threads, it was found that very broadly speaking that TLB shootdowns > > were reduced by 31% on average thr

Re: [PATCH] mremap: Avoid TLB flushing anonymous pages that are not in swap cache

2018-06-05 Thread Dave Hansen
On 06/05/2018 12:51 PM, Mel Gorman wrote: > Using another testcase that simply calls mremap heavily with varying number > of threads, it was found that very broadly speaking that TLB shootdowns > were reduced by 31% on average throughout the entire test case but your > milage will vary. Looks good

Re: [PATCH] mremap: Avoid TLB flushing anonymous pages that are not in swap cache

2018-06-05 Thread Nadav Amit
Mel Gorman wrote: > Commit 5d1904204c99 ("mremap: fix race between mremap() and page cleanning") > fixed races between mremap and other operations for both file-backed and > anonymous mappings. The file-backed was the most critical as it allowed the > possibility that data could be changed on a p

Re: [PATCH] mremap: Avoid TLB flushing anonymous pages that are not in swap cache

2018-06-05 Thread Mel Gorman
On Tue, Jun 05, 2018 at 12:49:18PM -0700, Dave Hansen wrote: > >> I usually try to make the non-pte-modifying functions take a pte_t > >> instead of 'pte_t *' to make it obvious that there no modification going > >> on. Any reason not to do that here? > > > > No, it was just a minor saving on sta

Re: [PATCH] mremap: Avoid TLB flushing anonymous pages that are not in swap cache

2018-06-05 Thread Dave Hansen
On 06/05/2018 12:12 PM, Mel Gorman wrote: > That's fair enough. I updated part of the changelog to read > > This patch special cases anonymous pages to only flush ranges under the > page table lock if the page is in swap cache and can be potentially queued > for IO. Note that the full flush of the

Re: [PATCH] mremap: Avoid TLB flushing anonymous pages that are not in swap cache

2018-06-05 Thread Mel Gorman
On Tue, Jun 05, 2018 at 11:18:18AM -0700, Dave Hansen wrote: > On 06/05/2018 10:13 AM, Mel Gorman wrote: > > The anonymous page race fix is overkill for two reasons. Pages that are not > > in the swap cache are not going to be issued for IO and if a stale TLB entry > > is used, the write still occu

Re: [PATCH] mremap: Avoid TLB flushing anonymous pages that are not in swap cache

2018-06-05 Thread Dave Hansen
On 06/05/2018 10:13 AM, Mel Gorman wrote: > The anonymous page race fix is overkill for two reasons. Pages that are not > in the swap cache are not going to be issued for IO and if a stale TLB entry > is used, the write still occurs on the same physical page. Any race with > mmap replacing the addr

[PATCH] mremap: Avoid TLB flushing anonymous pages that are not in swap cache

2018-06-05 Thread Mel Gorman
Commit 5d1904204c99 ("mremap: fix race between mremap() and page cleanning") fixed races between mremap and other operations for both file-backed and anonymous mappings. The file-backed was the most critical as it allowed the possibility that data could be changed on a physical page after page_mkcl