All of lore.kernel.org
 help / color / mirror / Atom feed
* [HELP-NEEDED, PATCHv2 0/3] Do not loose dirty bit on THP pages
@ 2017-06-15 14:52 ` Kirill A. Shutemov
  0 siblings, 0 replies; 88+ messages in thread
From: Kirill A. Shutemov @ 2017-06-15 14:52 UTC (permalink / raw)
  To: Andrew Morton, Vlastimil Babka, Vineet Gupta, Russell King,
	Will Deacon, Catalin Marinas, Ralf Baechle, David S. Miller,
	Aneesh Kumar K . V, Martin Schwidefsky, Heiko Carstens,
	Andrea Arcangeli
  Cc: linux-arch, linux-mm, linux-kernel, Kirill A. Shutemov

Hi,

Vlastimil noted that pmdp_invalidate() is not atomic and we can loose
dirty and access bits if CPU sets them after pmdp dereference, but
before set_pmd_at().

The bug doesn't lead to user-visible misbehaviour in current kernel, but
fixing this would be critical for future work on THP: both huge-ext4 and THP
swap out rely on proper dirty tracking.

Unfortunately, there's no way to address the issue in a generic way. We need to
fix all architectures that support THP one-by-one.

All architectures that have THP supported have to provide atomic
pmdp_invalidate() that returns previous value.

If generic implementation of pmdp_invalidate() is used, architecture needs to
provide atomic pmdp_estabish().

pmdp_estabish() is not used out-side generic implementation of
pmdp_invalidate() so far, but I think this can change in the future.

I've fixed the issue for x86, but I need help with the rest.

So far THP is supported on 7 architectures, beyond x86:

 - arc;
 - arm;
 - arm64;
 - mips;
 - power;
 - s390;
 - sparc;

Please, help me with them.

v2:
 - Introduce pmdp_estabish(), instead of pmdp_mknonpresent();
 - Change pmdp_invalidate() to return previous value of the pmd;

 arch/x86/include/asm/pgtable-3level.h | 18 ++++++++++++++++++
 arch/x86/include/asm/pgtable.h        | 14 ++++++++++++++
 fs/proc/task_mmu.c                    |  8 ++++----
 include/asm-generic/pgtable.h         |  2 +-
 mm/huge_memory.c                      | 29 ++++++++++++-----------------
 mm/pgtable-generic.c                  |  9 +++++----
 6 files changed, 54 insertions(+), 26 deletions(-)

-- 
2.11.0

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

end of thread, other threads:[~2017-06-21 17:52 UTC | newest]

Thread overview: 88+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-06-15 14:52 [HELP-NEEDED, PATCHv2 0/3] Do not loose dirty bit on THP pages Kirill A. Shutemov
2017-06-15 14:52 ` Kirill A. Shutemov
2017-06-15 14:52 ` [PATCHv2 1/3] x86/mm: Provide pmdp_establish() helper Kirill A. Shutemov
2017-06-15 14:52   ` Kirill A. Shutemov
2017-06-16 13:36   ` Andrea Arcangeli
2017-06-16 13:36     ` Andrea Arcangeli
2017-06-19 12:46     ` Kirill A. Shutemov
2017-06-19 12:46       ` Kirill A. Shutemov
2017-06-19  5:48   ` Martin Schwidefsky
2017-06-19  5:48     ` Martin Schwidefsky
2017-06-19  5:48     ` Martin Schwidefsky
2017-06-19  5:48     ` Martin Schwidefsky
2017-06-19 12:48     ` Kirill A. Shutemov
2017-06-19 12:48       ` Kirill A. Shutemov
2017-06-19 13:04       ` Martin Schwidefsky
2017-06-19 13:04         ` Martin Schwidefsky
2017-06-19 15:22   ` Catalin Marinas
2017-06-19 15:22     ` Catalin Marinas
2017-06-19 16:00     ` Kirill A. Shutemov
2017-06-19 16:00       ` Kirill A. Shutemov
2017-06-19 17:09       ` Catalin Marinas
2017-06-19 17:09         ` Catalin Marinas
2017-06-19 21:52         ` Kirill A. Shutemov
2017-06-19 21:52           ` Kirill A. Shutemov
2017-06-20 15:54           ` Catalin Marinas
2017-06-20 15:54             ` Catalin Marinas
2017-06-21  9:53             ` Kirill A. Shutemov
2017-06-21  9:53               ` Kirill A. Shutemov
2017-06-21 10:40               ` Catalin Marinas
2017-06-21 10:40                 ` Catalin Marinas
2017-06-21 11:27               ` Catalin Marinas
2017-06-21 11:27                 ` Catalin Marinas
2017-06-21 12:04                 ` Kirill A. Shutemov
2017-06-21 12:04                   ` Kirill A. Shutemov
2017-06-21 15:49                 ` Vineet Gupta
2017-06-21 15:49                   ` Vineet Gupta
2017-06-21 17:15                   ` Kirill A. Shutemov
2017-06-21 17:15                     ` Kirill A. Shutemov
2017-06-21 17:20                     ` Vineet Gupta
2017-06-21 17:20                       ` Vineet Gupta
2017-06-21 17:52                       ` Kirill A. Shutemov
2017-06-21 17:52                         ` Kirill A. Shutemov
2017-06-21 17:52                         ` Kirill A. Shutemov
2017-06-19 17:11   ` Nadav Amit
2017-06-19 17:11     ` Nadav Amit
2017-06-19 21:57     ` Kirill A. Shutemov
2017-06-19 21:57       ` Kirill A. Shutemov
2017-06-15 14:52 ` [PATCHv2 2/3] mm: Do not loose dirty and access bits in pmdp_invalidate() Kirill A. Shutemov
2017-06-15 14:52   ` Kirill A. Shutemov
2017-06-15 22:44   ` kbuild test robot
2017-06-15 22:44     ` kbuild test robot
2017-06-15 22:44     ` kbuild test robot
2017-06-16 13:40   ` Andrea Arcangeli
2017-06-16 13:40     ` Andrea Arcangeli
2017-06-19 13:29     ` Kirill A. Shutemov
2017-06-19 13:29       ` Kirill A. Shutemov
2017-06-15 14:52 ` [PATCHv2 3/3] mm: Use updated pmdp_invalidate() inteface to track dirty/accessed bits Kirill A. Shutemov
2017-06-15 14:52   ` Kirill A. Shutemov
2017-06-15 21:54   ` kbuild test robot
2017-06-15 21:54     ` kbuild test robot
2017-06-15 21:54     ` kbuild test robot
2017-06-15 23:02   ` kbuild test robot
2017-06-15 23:02     ` kbuild test robot
2017-06-15 23:02     ` kbuild test robot
2017-06-16  3:02   ` Minchan Kim
2017-06-16  3:02     ` Minchan Kim
2017-06-16 13:19     ` Kirill A. Shutemov
2017-06-16 13:19       ` Kirill A. Shutemov
2017-06-16 13:52       ` Minchan Kim
2017-06-16 13:52         ` Minchan Kim
2017-06-16 14:27         ` Andrea Arcangeli
2017-06-16 14:27           ` Andrea Arcangeli
2017-06-16 14:53           ` Minchan Kim
2017-06-16 14:53             ` Minchan Kim
2017-06-19 14:03             ` Kirill A. Shutemov
2017-06-19 14:03               ` Kirill A. Shutemov
2017-06-20  2:52               ` Minchan Kim
2017-06-20  2:52                 ` Minchan Kim
2017-06-20  9:57                 ` Minchan Kim
2017-06-20  9:57                   ` Minchan Kim
2017-06-16 11:31   ` Aneesh Kumar K.V
2017-06-16 11:31     ` Aneesh Kumar K.V
2017-06-16 11:31     ` Aneesh Kumar K.V
2017-06-16 11:31     ` Aneesh Kumar K.V
2017-06-16 13:21     ` Kirill A. Shutemov
2017-06-16 13:21       ` Kirill A. Shutemov
2017-06-16 15:57       ` Aneesh Kumar K.V
2017-06-16 15:57         ` Aneesh Kumar K.V

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.