The patch titled
Subject: mm: mmu_gather: remove __tlb_reset_range() for force flush
has been added to the -mm tree. Its filename is
mm-mmu_gather-remove-__tlb_reset_range-for-force-flush.patch
This patch should soon appear at
http://ozlabs.org/~akpm/mmots/broken-out/mm-mmu_gather-remove-__tlb_reset_range-for-force-flush.patch
and later at
http://ozlabs.org/~akpm/mmotm/broken-out/mm-mmu_gather-remove-__tlb_reset_range-for-force-flush.patch
Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a
reply-to-all to that, adding suitable additional cc's
*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***
The -mm tree is included into linux-next and is updated
there every 3-4 working days
------------------------------------------------------
From: Yang Shi <redacted>
Subject: mm: mmu_gather: remove __tlb_reset_range() for force flush
A few new fields were added to mmu_gather to make TLB flush smarter for
huge page by telling what level of page table is changed.
__tlb_reset_range() is used to reset all these page table state to
unchanged, which is called by TLB flush for parallel mapping changes for
the same range under non-exclusive lock (i.e. read mmap_sem). Before
commit dd2283f2605e ("mm: mmap: zap pages with read mmap_sem in munmap"),
the syscalls (e.g. MADV_DONTNEED, MADV_FREE) which may update PTEs in
parallel don't remove page tables. But, the forementioned commit may do
munmap() under read mmap_sem and free page tables. This may result in
program hang on aarch64 reported by Jan Stancek. The problem could be
reproduced by his test program with slightly modified below.
---8<---
static int map_size = 4096;
static int num_iter = 500;
static long threads_total;
static void *distant_area;
void *map_write_unmap(void *ptr)
{
int *fd = ptr;
unsigned char *map_address;
int i, j = 0;
for (i = 0; i < num_iter; i++) {
map_address = mmap(distant_area, (size_t) map_size, PROT_WRITE | PROT_READ,
MAP_SHARED | MAP_ANONYMOUS, -1, 0);
if (map_address == MAP_FAILED) {
perror("mmap");
exit(1);
}
for (j = 0; j < map_size; j++)
map_address[j] = 'b';
if (munmap(map_address, map_size) == -1) {
perror("munmap");
exit(1);
}
}
return NULL;
}
void *dummy(void *ptr)
{
return NULL;
}
int main(void)
{
pthread_t thid[2];
/* hint for mmap in map_write_unmap() */
distant_area = mmap(0, DISTANT_MMAP_SIZE, PROT_WRITE | PROT_READ,
MAP_ANONYMOUS | MAP_PRIVATE, -1, 0);
munmap(distant_area, (size_t)DISTANT_MMAP_SIZE);
distant_area += DISTANT_MMAP_SIZE / 2;
while (1) {
pthread_create(&thid[0], NULL, map_write_unmap, NULL);
pthread_create(&thid[1], NULL, dummy, NULL);
pthread_join(thid[0], NULL);
pthread_join(thid[1], NULL);
}
}
---8<---
The program may bring in parallel execution like below:
t1 t2
munmap(map_address)
downgrade_write(&mm->mmap_sem);
unmap_region()
tlb_gather_mmu()
inc_tlb_flush_pending(tlb->mm);
free_pgtables()
tlb->freed_tables = 1
tlb->cleared_pmds = 1
pthread_exit()
madvise(thread_stack, 8M, MADV_DONTNEED)
zap_page_range()
tlb_gather_mmu()
inc_tlb_flush_pending(tlb->mm);
tlb_finish_mmu()
if (mm_tlb_flush_nested(tlb->mm))
__tlb_reset_range()
__tlb_reset_range() would reset freed_tables and cleared_* bits, but this
may cause inconsistency for munmap() which do free page tables. Then it
may result in some architectures, e.g. aarch64, may not flush TLB
completely as expected to have stale TLB entries remained.
Use fullmm flush since it yields much better performance on aarch64 and
non-fullmm doesn't yields significant difference on x86.
The original proposed fix came from Jan Stancek who mainly debugged this
issue, I just wrapped up everything together.
Link: http://lkml.kernel.org/r/1558322252-113575-1-git-send-email-yang.shi@linux.alibaba.com
Fixes: dd2283f2605e ("mm: mmap: zap pages with read mmap_sem in munmap")
Signed-off-by: Yang Shi <redacted>
Signed-off-by: Jan Stancek <jstancek@redhat.com>
Reported-by: Jan Stancek <jstancek@redhat.com>
Tested-by: Jan Stancek <jstancek@redhat.com>
Suggested-by: Will Deacon <redacted>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Nick Piggin <npiggin@gmail.com>
Cc: "Aneesh Kumar K.V" <redacted>
Cc: Nadav Amit <redacted>
Cc: Minchan Kim <minchan@kernel.org>
Cc: Mel Gorman <mgorman@suse.de>
Cc: <redacted> [4.20+]
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---
mm/mmu_gather.c | 24 +++++++++++++++++++-----
1 file changed, 19 insertions(+), 5 deletions(-)
I guess we can revert most of the commit
02390f66bd2362df114a0a0770d80ec33061f6d1. That is the only place we flush multiple page sizes? . But should we evaluate the performance impact of that fullmm flush on ppc64?
-aneesh
I guess we can revert most of the commit
02390f66bd2362df114a0a0770d80ec33061f6d1. That is the only place we flush
multiple page sizes? . But should we evaluate the performance impact of that
fullmm flush on ppc64?
Maybe, but given the patch that went into -mm, PPC will never hit that
branch I killed anymore -- and that really shouldn't be in architecture
code anyway.
Also; as I noted last time: __radix___flush_tlb_range() and
__radix__flush_tlb_range_psize() look similar enough that they might
want to be a single function (and instead of @flush_all_sizes, have it
take @gflush, @hflush, @flush and @pwc).
I guess we can revert most of the commit
02390f66bd2362df114a0a0770d80ec33061f6d1. That is the only place we flush
multiple page sizes? . But should we evaluate the performance impact of
that
fullmm flush on ppc64?
Maybe, but given the patch that went into -mm, PPC will never hit that
branch I killed anymore -- and that really shouldn't be in architecture
code anyway.
Also; as I noted last time: __radix___flush_tlb_range() and
__radix__flush_tlb_range_psize() look similar enough that they might
want to be a single function (and instead of @flush_all_sizes, have it
take @gflush, @hflush, @flush and @pwc).
I guess we can revert most of the commit
02390f66bd2362df114a0a0770d80ec33061f6d1. That is the only place we flush
multiple page sizes? . But should we evaluate the performance impact of that
fullmm flush on ppc64?
Maybe, but given the patch that went into -mm, PPC will never hit that
branch I killed anymore -- and that really shouldn't be in architecture
code anyway.
Yeah well if mm/ does this then sure it's dead and can go.
I don't think it's very nice to set fullmm and freed_tables for this
case though. Is this concurrent zapping an important fast path? It
must have been, in order to justify all this complexity to the mm, so
we don't want to tie this boat anchor to it AFAIKS?
Is the problem just that the freed page tables flags get cleared by
__tlb_reset_range()? Why not just remove that then, so the bits are
set properly for the munmap?
Also; as I noted last time: __radix___flush_tlb_range() and
__radix__flush_tlb_range_psize() look similar enough that they might
want to be a single function (and instead of @flush_all_sizes, have it
take @gflush, @hflush, @flush and @pwc).
Yeah, it could possibly use a cleanup pass. I have a few patches
sitting around to make a few more optimisations around the place,
was going to look at some refactoring after that.
Thanks,
Nick
Maybe, but given the patch that went into -mm, PPC will never hit that
branch I killed anymore -- and that really shouldn't be in architecture
code anyway.
Yeah well if mm/ does this then sure it's dead and can go.
I don't think it's very nice to set fullmm and freed_tables for this
case though. Is this concurrent zapping an important fast path? It
must have been, in order to justify all this complexity to the mm, so
we don't want to tie this boat anchor to it AFAIKS?
I'm not convinced its an important fast path, afaict it is an
unfortunate correctness issue caused by allowing concurrenct frees.
Is the problem just that the freed page tables flags get cleared by
__tlb_reset_range()? Why not just remove that then, so the bits are
set properly for the munmap?
That's insufficient; as argued in my initial suggestion:
https://lkml.kernel.org/r/20190509103813.GP2589@hirez.programming.kicks-ass.net
Since we don't know what was flushed by the concorrent flushes, we must
flush all state (page sizes, tables etc..).
But it looks like benchmarks (for the one test-case we have) seem to
favour flushing the world over flushing a smaller range.
Maybe, but given the patch that went into -mm, PPC will never hit that
branch I killed anymore -- and that really shouldn't be in architecture
code anyway.
Yeah well if mm/ does this then sure it's dead and can go.
I don't think it's very nice to set fullmm and freed_tables for this
case though. Is this concurrent zapping an important fast path? It
must have been, in order to justify all this complexity to the mm, so
we don't want to tie this boat anchor to it AFAIKS?
I'm not convinced its an important fast path, afaict it is an
unfortunate correctness issue caused by allowing concurrenct frees.
I mean -- concurrent freeing was an important fastpath, right?
And concurrent freeing means that you hit this case. So this
case itself should be important too.
quoted
Is the problem just that the freed page tables flags get cleared by
__tlb_reset_range()? Why not just remove that then, so the bits are
set properly for the munmap?
Page tables should not be concurrently freed I think. Just don't clear
those page table free flags and it should be okay. Page sizes yes,
but we accommodated for that in the arch code. I could see reason to
add a flag to the gather struct like "concurrent_free" and set that
from the generic code, which the arch has to take care of.
But it looks like benchmarks (for the one test-case we have) seem to
favour flushing the world over flushing a smaller range.
Testing on 16MB unmap is possibly not a good benchmark, I didn't run
it exactly but it looks likely to go beyond the range flush threshold
and flush the entire PID anyway.
Thanks,
Nick
From: Will Deacon <hidden> Date: 2019-06-03 10:30:15
Hi Nick,
On Mon, Jun 03, 2019 at 12:11:38PM +1000, Nicholas Piggin wrote:
Peter Zijlstra's on May 31, 2019 7:49 pm:
quoted
On Fri, May 31, 2019 at 12:46:56PM +1000, Nicholas Piggin wrote:
quoted
I don't think it's very nice to set fullmm and freed_tables for this
case though. Is this concurrent zapping an important fast path? It
must have been, in order to justify all this complexity to the mm, so
we don't want to tie this boat anchor to it AFAIKS?
I'm not convinced its an important fast path, afaict it is an
unfortunate correctness issue caused by allowing concurrenct frees.
I mean -- concurrent freeing was an important fastpath, right?
And concurrent freeing means that you hit this case. So this
case itself should be important too.
I honestly don't think we (Peter and I) know. Our first involvement with
this was because TLBs were found to contain stale user entries:
https://lore.kernel.org/linux-arm-kernel/1817839533.20996552.1557065445233.JavaMail.zimbra@redhat.com/
so the initial work to support the concurrent freeing was done separately
and, I assume, motivated by some real workloads. I would also very much
like to know more about that, since nothing remotely realistic has surfaced
in this discussion, other than some historical glibc thing which has long
since been fixed.
quoted
quoted
Is the problem just that the freed page tables flags get cleared by
__tlb_reset_range()? Why not just remove that then, so the bits are
set properly for the munmap?
Page tables should not be concurrently freed I think. Just don't clear
those page table free flags and it should be okay. Page sizes yes,
but we accommodated for that in the arch code. I could see reason to
add a flag to the gather struct like "concurrent_free" and set that
from the generic code, which the arch has to take care of.
I think you're correct that two CPUs cannot free the page tables
concurrently (I misunderstood this initially), although I also think
there may be some subtle issues if tlb->freed_tables is not set,
depending on the architecture. Roughly speaking, if one CPU is clearing
a PMD as part of munmap() and another CPU in madvise() does only last-level
TLB invalidation, then I think there's the potential for the invalidation
to be ineffective if observing a cleared PMD doesn't imply that the last
level has been unmapped from the perspective of the page-table walker.
quoted
But it looks like benchmarks (for the one test-case we have) seem to
favour flushing the world over flushing a smaller range.
Testing on 16MB unmap is possibly not a good benchmark, I didn't run
it exactly but it looks likely to go beyond the range flush threshold
and flush the entire PID anyway.
If we can get a better idea of what a "good benchmark" might look like (i.e.
something that is representative of the cases in which real workloads are
likely to trigger this path) then we can definitely try to optimise around
that.
In the meantime, I would really like to see this patch land in mainline
since it fixes a regression.
Will
From: Nicholas Piggin <npiggin@gmail.com> Date: 2019-06-03 14:10:50
Will Deacon's on June 3, 2019 8:30 pm:
Hi Nick,
On Mon, Jun 03, 2019 at 12:11:38PM +1000, Nicholas Piggin wrote:
quoted
Peter Zijlstra's on May 31, 2019 7:49 pm:
quoted
On Fri, May 31, 2019 at 12:46:56PM +1000, Nicholas Piggin wrote:
quoted
I don't think it's very nice to set fullmm and freed_tables for this
case though. Is this concurrent zapping an important fast path? It
must have been, in order to justify all this complexity to the mm, so
we don't want to tie this boat anchor to it AFAIKS?
I'm not convinced its an important fast path, afaict it is an
unfortunate correctness issue caused by allowing concurrenct frees.
I mean -- concurrent freeing was an important fastpath, right?
And concurrent freeing means that you hit this case. So this
case itself should be important too.
I honestly don't think we (Peter and I) know. Our first involvement with
this was because TLBs were found to contain stale user entries:
https://lore.kernel.org/linux-arm-kernel/1817839533.20996552.1557065445233.JavaMail.zimbra@redhat.com/
so the initial work to support the concurrent freeing was done separately
and, I assume, motivated by some real workloads. I would also very much
like to know more about that, since nothing remotely realistic has surfaced
in this discussion, other than some historical glibc thing which has long
since been fixed.
Well, it seems like it is important. While the complexity is carried
in the mm, we should not skimp on this last small piece.
quoted
quoted
quoted
Is the problem just that the freed page tables flags get cleared by
__tlb_reset_range()? Why not just remove that then, so the bits are
set properly for the munmap?
Page tables should not be concurrently freed I think. Just don't clear
those page table free flags and it should be okay. Page sizes yes,
but we accommodated for that in the arch code. I could see reason to
add a flag to the gather struct like "concurrent_free" and set that
from the generic code, which the arch has to take care of.
I think you're correct that two CPUs cannot free the page tables
concurrently (I misunderstood this initially), although I also think
there may be some subtle issues if tlb->freed_tables is not set,
depending on the architecture. Roughly speaking, if one CPU is clearing
a PMD as part of munmap() and another CPU in madvise() does only last-level
TLB invalidation, then I think there's the potential for the invalidation
to be ineffective if observing a cleared PMD doesn't imply that the last
level has been unmapped from the perspective of the page-table walker.
That should not be the case because the last level table should have
had all entries cleared before the pointer to it has been cleared.
So the page table walker could begin from the now-freed page table,
but it would never instantiate a valid TLB entry from there. So a
TLB invalidation would behave properly despite not flushing page
tables.
Powerpc at least would want to avoid over flushing here, AFAIKS.
quoted
quoted
But it looks like benchmarks (for the one test-case we have) seem to
favour flushing the world over flushing a smaller range.
Testing on 16MB unmap is possibly not a good benchmark, I didn't run
it exactly but it looks likely to go beyond the range flush threshold
and flush the entire PID anyway.
If we can get a better idea of what a "good benchmark" might look like (i.e.
something that is representative of the cases in which real workloads are
likely to trigger this path) then we can definitely try to optimise around
that.
Hard to say unfortunately. A smaller unmap range to start with, but
even then when you have a TLB over-flushing case, then an unmap micro
benchmark is not a great test because you'd like to see more impact of
other useful entries being flushed (e.g., you need an actual working
set).
In the meantime, I would really like to see this patch land in mainline
since it fixes a regression.
Sorry I didn't provide input earlier. I would like to improve the fix or
at least make an option for archs to provide an optimised way to flush
this case, so it would be nice not to fix archs this way and then have
to change the fix significantly right away.
But the bug does need to be fixed of course, if there needs to be more
thought about it maybe it's best to take this fix for next release.
Thanks,
Nick
From: Will Deacon <hidden> Date: 2019-06-03 17:57:29
Hi Nick,
On Tue, Jun 04, 2019 at 12:10:37AM +1000, Nicholas Piggin wrote:
Will Deacon's on June 3, 2019 8:30 pm:
quoted
On Mon, Jun 03, 2019 at 12:11:38PM +1000, Nicholas Piggin wrote:
quoted
Peter Zijlstra's on May 31, 2019 7:49 pm:
quoted
On Fri, May 31, 2019 at 12:46:56PM +1000, Nicholas Piggin wrote:
quoted
I don't think it's very nice to set fullmm and freed_tables for this
case though. Is this concurrent zapping an important fast path? It
must have been, in order to justify all this complexity to the mm, so
we don't want to tie this boat anchor to it AFAIKS?
I'm not convinced its an important fast path, afaict it is an
unfortunate correctness issue caused by allowing concurrenct frees.
I mean -- concurrent freeing was an important fastpath, right?
And concurrent freeing means that you hit this case. So this
case itself should be important too.
I honestly don't think we (Peter and I) know. Our first involvement with
this was because TLBs were found to contain stale user entries:
https://lore.kernel.org/linux-arm-kernel/1817839533.20996552.1557065445233.JavaMail.zimbra@redhat.com/
so the initial work to support the concurrent freeing was done separately
and, I assume, motivated by some real workloads. I would also very much
like to know more about that, since nothing remotely realistic has surfaced
in this discussion, other than some historical glibc thing which has long
since been fixed.
Well, it seems like it is important. While the complexity is carried
in the mm, we should not skimp on this last small piece.
As I say, I really don't know. But yes, if we can do something better we
should.
quoted
quoted
quoted
quoted
Is the problem just that the freed page tables flags get cleared by
__tlb_reset_range()? Why not just remove that then, so the bits are
set properly for the munmap?
Page tables should not be concurrently freed I think. Just don't clear
those page table free flags and it should be okay. Page sizes yes,
but we accommodated for that in the arch code. I could see reason to
add a flag to the gather struct like "concurrent_free" and set that
from the generic code, which the arch has to take care of.
I think you're correct that two CPUs cannot free the page tables
concurrently (I misunderstood this initially), although I also think
there may be some subtle issues if tlb->freed_tables is not set,
depending on the architecture. Roughly speaking, if one CPU is clearing
a PMD as part of munmap() and another CPU in madvise() does only last-level
TLB invalidation, then I think there's the potential for the invalidation
to be ineffective if observing a cleared PMD doesn't imply that the last
level has been unmapped from the perspective of the page-table walker.
That should not be the case because the last level table should have
had all entries cleared before the pointer to it has been cleared.
The devil is in the detail here, and I think specifically it depends
what you mean by "before". Does that mean memory barrier, or special
page-table walker barrier, or TLB invalidation or ...?
So the page table walker could begin from the now-freed page table,
but it would never instantiate a valid TLB entry from there. So a
TLB invalidation would behave properly despite not flushing page
tables.
Powerpc at least would want to avoid over flushing here, AFAIKS.
For arm64 it really depends how often this hits. Simply not setting
tlb->freed_tables would also break things for us, because we have an
optimisation where we elide invalidation in the fullmm && !freed_tables
case, since this is indicative of the mm going away and so we simply
avoid reallocating its ASID.
quoted
quoted
quoted
But it looks like benchmarks (for the one test-case we have) seem to
favour flushing the world over flushing a smaller range.
Testing on 16MB unmap is possibly not a good benchmark, I didn't run
it exactly but it looks likely to go beyond the range flush threshold
and flush the entire PID anyway.
If we can get a better idea of what a "good benchmark" might look like (i.e.
something that is representative of the cases in which real workloads are
likely to trigger this path) then we can definitely try to optimise around
that.
Hard to say unfortunately. A smaller unmap range to start with, but
even then when you have a TLB over-flushing case, then an unmap micro
benchmark is not a great test because you'd like to see more impact of
other useful entries being flushed (e.g., you need an actual working
set).
Right, sounds like somebody needs to do some better analysis than what's
been done so far.
quoted
In the meantime, I would really like to see this patch land in mainline
since it fixes a regression.
Sorry I didn't provide input earlier. I would like to improve the fix or
at least make an option for archs to provide an optimised way to flush
this case, so it would be nice not to fix archs this way and then have
to change the fix significantly right away.
Please send patches ;)
But the bug does need to be fixed of course, if there needs to be more
thought about it maybe it's best to take this fix for next release.
From: Nicholas Piggin <npiggin@gmail.com> Date: 2019-06-04 08:18:46
Will Deacon's on June 4, 2019 3:57 am:
Hi Nick,
On Tue, Jun 04, 2019 at 12:10:37AM +1000, Nicholas Piggin wrote:
quoted
Will Deacon's on June 3, 2019 8:30 pm:
quoted
On Mon, Jun 03, 2019 at 12:11:38PM +1000, Nicholas Piggin wrote:
quoted
Peter Zijlstra's on May 31, 2019 7:49 pm:
quoted
On Fri, May 31, 2019 at 12:46:56PM +1000, Nicholas Piggin wrote:
quoted
I don't think it's very nice to set fullmm and freed_tables for this
case though. Is this concurrent zapping an important fast path? It
must have been, in order to justify all this complexity to the mm, so
we don't want to tie this boat anchor to it AFAIKS?
I'm not convinced its an important fast path, afaict it is an
unfortunate correctness issue caused by allowing concurrenct frees.
I mean -- concurrent freeing was an important fastpath, right?
And concurrent freeing means that you hit this case. So this
case itself should be important too.
I honestly don't think we (Peter and I) know. Our first involvement with
this was because TLBs were found to contain stale user entries:
https://lore.kernel.org/linux-arm-kernel/1817839533.20996552.1557065445233.JavaMail.zimbra@redhat.com/
so the initial work to support the concurrent freeing was done separately
and, I assume, motivated by some real workloads. I would also very much
like to know more about that, since nothing remotely realistic has surfaced
in this discussion, other than some historical glibc thing which has long
since been fixed.
Well, it seems like it is important. While the complexity is carried
in the mm, we should not skimp on this last small piece.
As I say, I really don't know. But yes, if we can do something better we
should.
quoted
quoted
quoted
quoted
quoted
Is the problem just that the freed page tables flags get cleared by
__tlb_reset_range()? Why not just remove that then, so the bits are
set properly for the munmap?
Page tables should not be concurrently freed I think. Just don't clear
those page table free flags and it should be okay. Page sizes yes,
but we accommodated for that in the arch code. I could see reason to
add a flag to the gather struct like "concurrent_free" and set that
from the generic code, which the arch has to take care of.
I think you're correct that two CPUs cannot free the page tables
concurrently (I misunderstood this initially), although I also think
there may be some subtle issues if tlb->freed_tables is not set,
depending on the architecture. Roughly speaking, if one CPU is clearing
a PMD as part of munmap() and another CPU in madvise() does only last-level
TLB invalidation, then I think there's the potential for the invalidation
to be ineffective if observing a cleared PMD doesn't imply that the last
level has been unmapped from the perspective of the page-table walker.
That should not be the case because the last level table should have
had all entries cleared before the pointer to it has been cleared.
The devil is in the detail here, and I think specifically it depends
what you mean by "before". Does that mean memory barrier, or special
page-table walker barrier, or TLB invalidation or ...?
I don't know that matters. It is a complicating factor, but would
not be a new one to page table freeing. The issue really is the
TLB entries (not page walk entry) which need to be flushed by the
concurrent unmaps. Even without any page table freeing activity (so you
would still have the page table connected), the ordering and flushing
needs to be right such that it can not re-instantiate a new TLB from the
page table with the old PTEs.
If that is solved, then the subsequent step of freeing the page table
page doesn't introduce a new window where old PTEs could be read
from the same table via page walk cache after it is disconnected.
quoted
So the page table walker could begin from the now-freed page table,
but it would never instantiate a valid TLB entry from there. So a
TLB invalidation would behave properly despite not flushing page
tables.
Powerpc at least would want to avoid over flushing here, AFAIKS.
For arm64 it really depends how often this hits. Simply not setting
tlb->freed_tables would also break things for us, because we have an
optimisation where we elide invalidation in the fullmm && !freed_tables
case, since this is indicative of the mm going away and so we simply
avoid reallocating its ASID.
It wouldn't be not setting it, but rather not clearing it.
Not sure you have to worry about concurrent unmaps in the fullmm case
either.
quoted
quoted
quoted
quoted
But it looks like benchmarks (for the one test-case we have) seem to
favour flushing the world over flushing a smaller range.
Testing on 16MB unmap is possibly not a good benchmark, I didn't run
it exactly but it looks likely to go beyond the range flush threshold
and flush the entire PID anyway.
If we can get a better idea of what a "good benchmark" might look like (i.e.
something that is representative of the cases in which real workloads are
likely to trigger this path) then we can definitely try to optimise around
that.
Hard to say unfortunately. A smaller unmap range to start with, but
even then when you have a TLB over-flushing case, then an unmap micro
benchmark is not a great test because you'd like to see more impact of
other useful entries being flushed (e.g., you need an actual working
set).
Right, sounds like somebody needs to do some better analysis than what's
been done so far.
quoted
quoted
In the meantime, I would really like to see this patch land in mainline
since it fixes a regression.
Sorry I didn't provide input earlier. I would like to improve the fix or
at least make an option for archs to provide an optimised way to flush
this case, so it would be nice not to fix archs this way and then have
to change the fix significantly right away.
Please send patches ;)
I have a few things lying around I put on hold until after all the
recent nice refactoring and improvements. I will rebase and try to
look at this issue as well and see if there is any ways to improve.
Likely to need help with arch code and analysis of races.
quoted
But the bug does need to be fixed of course, if there needs to be more
thought about it maybe it's best to take this fix for next release.
Agreed.
Well I can't argue against in anymore then.
Thanks,
Nick