linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2][RFC] mm callback for batched pte updates
@ 2016-07-05 12:00 Martin Schwidefsky
  2016-07-05 12:00 ` [PATCH 2/2] s390/mm: use ipte range to invalidate multiple page table entries Martin Schwidefsky
  0 siblings, 1 reply; 7+ messages in thread
From: Martin Schwidefsky @ 2016-07-05 12:00 UTC (permalink / raw)
  To: linux-mm; +Cc: Martin Schwidefsky

Hello,

there is another peculiarity on s390 I would like to exploit, the
range option of the IPTE instruction. This is an extension that allows
to set the invalid bit and clear the associated TLB entry for multiple
page table entries with a single instruction instead of doing an IPTE
for each pte. Each IPTE or IPTE-range is a quiescing operation, basically
an IPI to all other CPUs to coordinate the pte invalidation.

The IPTE-range is useful in mulit-threaded programs for a fork or a
mprotect/munmap/mremap affecting large memory areas where s390 may not
just do the pte update and clear the TLBs later.

In order to add the IPTE range optimization another mm callback is
needed in copy_page_range, unmap_page_range, move_page_tables, and
change_protection_range. The name is 'ptep_prepare_range', suggestions
for a better name are welcome.

With the two patches the update for the ptes inside a single page table
is done in two steps. First the prep_prepare_range invalidates all ptes,
this makes the address range inaccessible for all CPUs. The pages are
still marked as present and could be revalidated again if the page table
lock is released, but this does not happen with the current code.
The second step is the usual update loop over all single ptes.

Given a multi-threaded program a fork or a mprotect/munmap/mremap of a
large address range now needs fewer IPTEs / IPIs by a factor up to 256.
My mprotect stress test runs faster by an order of magnitude.

Martin Schwidefsky (2):
  mm: add callback to prepare the update of multiple page table entries
  s390/mm: use ipte range to invalidate multiple page table entries

 arch/s390/include/asm/pgtable.h | 25 +++++++++++++++++++++++++
 arch/s390/include/asm/setup.h   |  2 ++
 arch/s390/kernel/early.c        |  2 ++
 arch/s390/mm/pageattr.c         |  2 +-
 arch/s390/mm/pgtable.c          | 17 +++++++++++++++++
 include/asm-generic/pgtable.h   |  4 ++++
 mm/memory.c                     |  2 ++
 mm/mprotect.c                   |  1 +
 mm/mremap.c                     |  1 +
 9 files changed, 55 insertions(+), 1 deletion(-)

-- 
2.6.6

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2016-07-06 10:51 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <014201d1d738$744c8f90$5ce5aeb0$@alibaba-inc.com>
2016-07-06  4:03 ` [PATCH 2/2] s390/mm: use ipte range to invalidate multiple page table entries Hillf Danton
2016-07-06  6:23   ` Martin Schwidefsky
2016-07-06  6:42     ` Hillf Danton
2016-07-06  8:47       ` Martin Schwidefsky
2016-07-06  9:26         ` Hillf Danton
2016-07-06 10:51           ` Martin Schwidefsky
2016-07-05 12:00 [PATCH 0/2][RFC] mm callback for batched pte updates Martin Schwidefsky
2016-07-05 12:00 ` [PATCH 2/2] s390/mm: use ipte range to invalidate multiple page table entries Martin Schwidefsky

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).