linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch 0/2 for-4.20] mm, thp: fix remote access and allocation regressions
@ 2018-12-03 23:50 David Rientjes
  2018-12-03 23:50 ` [patch 2/2 for-4.20] mm, thp: always fault memory with __GFP_NORETRY David Rientjes
                   ` (3 more replies)
  0 siblings, 4 replies; 24+ messages in thread
From: David Rientjes @ 2018-12-03 23:50 UTC (permalink / raw)
  To: Linus Torvalds, Andrea Arcangeli
  Cc: ying.huang, Michal Hocko, s.priebe, mgorman,
	Linux List Kernel Mailing, alex.williamson, lkp, kirill,
	Andrew Morton, zi.yan, Vlastimil Babka

This fixes a 13.9% of remote memory access regression and 40% remote
memory allocation regression on Haswell when the local node is fragmented
for hugepage sized pages and memory is being faulted with either the thp
defrag setting of "always" or has been madvised with MADV_HUGEPAGE.

The usecase that initially identified this issue were binaries that mremap
their .text segment to be backed by transparent hugepages on startup.
They do mmap(), madvise(MADV_HUGEPAGE), memcpy(), and mremap().

This requires a full revert and partial revert of commits merged during
the 4.20 rc cycle.  The full revert, of ac5b2c18911f ("mm: thp: relax
__GFP_THISNODE for MADV_HUGEPAGE mappings"), was anticipated to fix large
amounts of swap activity on the local zone when faulting hugepages by
falling back to remote memory.  This remote allocation causes the access
regression and, if fragmented, the allocation regression.

This patchset also fixes that issue by not attempting direct reclaim at
all when compaction fails to free a hugepage.  Note that if remote memory
was also low or fragmented that ac5b2c18911f ("mm: thp: relax
__GFP_THISNODE for MADV_HUGEPAGE mappings") would only have compounded the
problem it attempts to address by now thrashing all nodes instead of only
the local node.

The reverts for the stable trees will be different: just a straight revert
of commit ac5b2c18911f ("mm: thp: relax __GFP_THISNODE for MADV_HUGEPAGE
mappings") is likely needed.

Cross compiled for architectures with thp support and thp enabled:
arc (with ISA_ARCV2), arm (with ARM_LPAE), arm64, i386, mips64, powerpc, 
s390, sparc, x86_64.

Andrea, is this acceptable?
---
 drivers/gpu/drm/ttm/ttm_page_alloc.c     |    8 +++---
 drivers/gpu/drm/ttm/ttm_page_alloc_dma.c |    3 --
 include/linux/gfp.h                      |    3 +-
 include/linux/mempolicy.h                |    2 -
 mm/huge_memory.c                         |   41 +++++++++++--------------------
 mm/mempolicy.c                           |    7 +++--
 mm/page_alloc.c                          |   16 ++++++++++++
 7 files changed, 42 insertions(+), 38 deletions(-)

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

end of thread, other threads:[~2018-12-09 22:44 UTC | newest]

Thread overview: 24+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-12-03 23:50 [patch 0/2 for-4.20] mm, thp: fix remote access and allocation regressions David Rientjes
2018-12-03 23:50 ` [patch 2/2 for-4.20] mm, thp: always fault memory with __GFP_NORETRY David Rientjes
2018-12-03 23:50 ` [patch 1/2 for-4.20] mm, thp: restore node-local hugepage allocations David Rientjes
2018-12-04  7:35   ` Michal Hocko
2018-12-04 21:56     ` David Rientjes
2018-12-05  7:34       ` Michal Hocko
2018-12-05 19:24         ` David Rientjes
2018-12-05 20:15           ` Michal Hocko
2018-12-05 22:21             ` Andrea Arcangeli
2018-12-04  7:38 ` [patch 0/2 for-4.20] mm, thp: fix remote access and allocation regressions Michal Hocko
2018-12-04 22:25   ` David Rientjes
2018-12-05  7:40     ` Michal Hocko
2018-12-05 10:15     ` Mel Gorman
2018-12-05 19:41       ` David Rientjes
2018-12-04 10:10 ` Vlastimil Babka
2018-12-04 22:04   ` David Rientjes
2018-12-05  9:05     ` Michal Hocko
2018-12-05 19:49       ` David Rientjes
2018-12-05 20:32         ` Michal Hocko
2018-12-05 21:14           ` David Rientjes
2018-12-05 21:45         ` Andrea Arcangeli
2018-12-05 22:10           ` David Rientjes
2018-12-06  0:31             ` Andrea Arcangeli
2018-12-09 22:44               ` David Rientjes

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).