mbox series

[0/7] Record the mm_struct in the page table pages

Message ID 20200428194449.22615-1-willy@infradead.org (mailing list archive)
Headers show
Series Record the mm_struct in the page table pages | expand

Message

Matthew Wilcox (Oracle) April 28, 2020, 7:44 p.m. UTC
From: "Matthew Wilcox (Oracle)" <willy@infradead.org>

Pages which are in use as page tables have some space unused in struct
page.  It would be handy to have a pointer to the struct mm_struct that
they belong to so that we can handle uncorrectable errors in page tables
more gracefully.  There are a few other things we could use it for too,
such as checking that the page table entry actually belongs to the task
we think it ought to.  This patch series does none of that, but does
lay the groundwork for it.

Matthew Wilcox (Oracle) (7):
  mm: Document x86 uses a linked list of pgds
  mm: Move pt_mm within struct page
  arm: Thread mm_struct throughout page table allocation
  arm64: Thread mm_struct throughout page table allocation
  m68k: Thread mm_struct throughout page table allocation
  mm: Set pt_mm in PTE constructor
  mm: Set pt_mm in PMD constructor

 arch/arc/include/asm/pgalloc.h           |  2 +-
 arch/arm/mm/mmu.c                        | 66 ++++++++---------
 arch/arm64/include/asm/pgalloc.h         |  2 +-
 arch/arm64/mm/mmu.c                      | 93 ++++++++++++------------
 arch/m68k/include/asm/mcf_pgalloc.h      |  2 +-
 arch/m68k/include/asm/motorola_pgalloc.h | 10 +--
 arch/m68k/mm/motorola.c                  |  4 +-
 arch/openrisc/include/asm/pgalloc.h      |  2 +-
 arch/powerpc/mm/book3s64/pgtable.c       |  2 +-
 arch/powerpc/mm/pgtable-frag.c           |  2 +-
 arch/s390/include/asm/pgalloc.h          |  2 +-
 arch/s390/mm/pgalloc.c                   |  2 +-
 arch/sparc/mm/init_64.c                  |  2 +-
 arch/sparc/mm/srmmu.c                    |  2 +-
 arch/x86/include/asm/pgalloc.h           |  2 +-
 arch/x86/mm/pgtable.c                    |  3 +-
 arch/xtensa/include/asm/pgalloc.h        |  2 +-
 include/asm-generic/pgalloc.h            |  2 +-
 include/linux/mm.h                       | 18 ++++-
 include/linux/mm_types.h                 | 12 +--
 20 files changed, 122 insertions(+), 110 deletions(-)


base-commit: 6a8b55ed4056ea5559ebe4f6a4b247f627870d4c

Comments

Kirill A. Shutemov April 29, 2020, 12:26 a.m. UTC | #1
On Tue, Apr 28, 2020 at 12:44:42PM -0700, Matthew Wilcox wrote:
> From: "Matthew Wilcox (Oracle)" <willy@infradead.org>
> 
> Pages which are in use as page tables have some space unused in struct
> page.  It would be handy to have a pointer to the struct mm_struct that
> they belong to so that we can handle uncorrectable errors in page tables
> more gracefully.  There are a few other things we could use it for too,
> such as checking that the page table entry actually belongs to the task
> we think it ought to.  This patch series does none of that, but does
> lay the groundwork for it.
> 
> Matthew Wilcox (Oracle) (7):

How does it work for kernel side of virtual address space?

And your employer may be interested in semantics around
CONFIG_ARCH_WANT_HUGE_PMD_SHARE :P
Matthew Wilcox (Oracle) April 29, 2020, 1:51 a.m. UTC | #2
On Wed, Apr 29, 2020 at 03:26:24AM +0300, Kirill A. Shutemov wrote:
> On Tue, Apr 28, 2020 at 12:44:42PM -0700, Matthew Wilcox wrote:
> > From: "Matthew Wilcox (Oracle)" <willy@infradead.org>
> > 
> > Pages which are in use as page tables have some space unused in struct
> > page.  It would be handy to have a pointer to the struct mm_struct that
> > they belong to so that we can handle uncorrectable errors in page tables
> > more gracefully.  There are a few other things we could use it for too,
> > such as checking that the page table entry actually belongs to the task
> > we think it ought to.  This patch series does none of that, but does
> > lay the groundwork for it.
> > 
> > Matthew Wilcox (Oracle) (7):
> 
> How does it work for kernel side of virtual address space?

init_mm

> And your employer may be interested in semantics around
> CONFIG_ARCH_WANT_HUGE_PMD_SHARE :P

I was thinking about that.  Right now, it's only useful for debugging
purposes (as you point out in a later email).  I think it's OK if shared
PMDs aren't supported as well as regular PTEs, just because there are
so few of them that uncorrectable errors are less likely to strike in
those pages.
Mike Rapoport May 24, 2020, 7:42 a.m. UTC | #3
On Tue, Apr 28, 2020 at 06:51:26PM -0700, Matthew Wilcox wrote:
> On Wed, Apr 29, 2020 at 03:26:24AM +0300, Kirill A. Shutemov wrote:
> > On Tue, Apr 28, 2020 at 12:44:42PM -0700, Matthew Wilcox wrote:
> > > From: "Matthew Wilcox (Oracle)" <willy@infradead.org>
> > > 
> > > Pages which are in use as page tables have some space unused in struct
> > > page.  It would be handy to have a pointer to the struct mm_struct that
> > > they belong to so that we can handle uncorrectable errors in page tables
> > > more gracefully.  There are a few other things we could use it for too,
> > > such as checking that the page table entry actually belongs to the task
> > > we think it ought to.  This patch series does none of that, but does
> > > lay the groundwork for it.
> > > 
> > > Matthew Wilcox (Oracle) (7):
> > 
> > How does it work for kernel side of virtual address space?
> 
> init_mm

A note to keep in mind is that most of the kernel page tables are seen
as PG_reserved rather than PageTable().

> > And your employer may be interested in semantics around
> > CONFIG_ARCH_WANT_HUGE_PMD_SHARE :P
> 
> I was thinking about that.  Right now, it's only useful for debugging
> purposes (as you point out in a later email).  I think it's OK if shared
> PMDs aren't supported as well as regular PTEs, just because there are
> so few of them that uncorrectable errors are less likely to strike in
> those pages.
>