linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] mm,thp,shm: limit shmem THP alloc gfp_mask
@ 2020-11-05 19:15 Rik van Riel
  2020-11-05 19:15 ` [PATCH 1/2] mm,thp,shmem: " Rik van Riel
  2020-11-05 19:15 ` [PATCH 2/2] mm,thp,shm: limit gfp mask to no more than specified Rik van Riel
  0 siblings, 2 replies; 13+ messages in thread
From: Rik van Riel @ 2020-11-05 19:15 UTC (permalink / raw)
  To: hughd
  Cc: xuyu, akpm, mgorman, aarcange, willy, linux-kernel, kernel-team,
	linux-mm, vbabka, mhocko

The allocation flags of anonymous transparent huge pages can be controlled
through the files in /sys/kernel/mm/transparent_hugepage/defrag, which can
help the system from getting bogged down in the page reclaim and compaction
code when many THPs are getting allocated simultaneously.

However, the gfp_mask for shmem THP allocations were not limited by those
configuration settings, and some workloads ended up with all CPUs stuck
on the LRU lock in the page reclaim code, trying to allocate dozens of
THPs simultaneously.

This patch applies the same configurated limitation of THPs to shmem
hugepage allocations, to prevent that from happening.

This way a THP defrag setting of "never" or "defer+madvise" will result
in quick allocation failures without direct reclaim when no 2MB free
pages are available.

With this patch applied, THP allocations for tmpfs will be a little
more aggressive than today for files mmapped with MADV_HUGEPAGE,
and a little less aggressive for files that are not mmapped or
mapped without that flag.

v5: reduce gfp mask further if needed, to accomodate i915 (Matthew Wilcox)
v4: rename alloc_hugepage_direct_gfpmask to vma_thp_gfp_mask (Matthew Wilcox)
v3: fix NULL vma issue spotted by Hugh Dickins & tested
v2: move gfp calculation to shmem_getpage_gfp as suggested by Yu Xu




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

end of thread, other threads:[~2020-11-23 19:40 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-05 19:15 [PATCH 0/2] mm,thp,shm: limit shmem THP alloc gfp_mask Rik van Riel
2020-11-05 19:15 ` [PATCH 1/2] mm,thp,shmem: " Rik van Riel
2020-11-12 10:52   ` Michal Hocko
2020-11-14  3:44     ` Rik van Riel
2020-11-19  9:37       ` Michal Hocko
2020-11-05 19:15 ` [PATCH 2/2] mm,thp,shm: limit gfp mask to no more than specified Rik van Riel
2020-11-06  3:05   ` Hillf Danton
2020-11-06 17:53     ` Rik van Riel
2020-11-07  1:58       ` Hillf Danton
2020-11-12 11:22   ` Michal Hocko
2020-11-14  3:40     ` Rik van Riel
2020-11-19  9:38       ` Michal Hocko
2020-11-23 19:39         ` Rik van Riel

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