Messages in this thread | | | Subject | Re: [PATCH 1/2] mm: thp: relax __GFP_THISNODE for MADV_HUGEPAGE mappings | From | Vlastimil Babka <> | Date | Wed, 10 Oct 2018 09:54:32 +0200 |
| |
On 10/10/18 12:51 AM, Andrea Arcangeli wrote: > Yes there's one case where reclaim is "pointless", but it happens once > and then COMPACT_DEFERRED is returned and __GFP_NORETRY will skip > reclaim then. > > So you're right when we hit fragmentation there's one and only one > "pointless" reclaim invocation. And immediately after we also > exponentially backoff on the compaction invocations with the > compaction deferred logic. > > We could try optimize away such "pointless" reclaim event for sure, > but it's probably an optimization that may just get lost in the noise > and may not be measurable, because it only happens once when the first > full fragmentation is encountered.
Note there's a small catch in the above. defer_compaction() has always only been called after a failure on higher priority than COMPACT_PRIO_ASYNC, where it's assumed that async compaction can terminate prematurely due to a number of reasons, so it doesn't mean that the zone itself cannot be compacted. And, for __GFP_NORETRY, if the initial compaction fails, we keep using async compaction also for the second, after-reclaim attempt (which would otherwise use SYNC_LIGHT):
/* * Looks like reclaim/compaction is worth trying, but * sync compaction could be very expensive, so keep * using async compaction. */ compact_priority = INIT_COMPACT_PRIORITY;
This doesn't affect current madvised THP allocation which doesn't use __GFP_NORETRY, but could explain why you saw no benefit from changing it to __GFP_NORETRY.
| |