Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Revert "mm: avoid waking kswapd for THP allocations when compaction is deferred or contended"

This reverts commit 782fd30406ecb9d9b082816abe0c6008fc72a7b0.

We are going to reinstate the __GFP_NO_KSWAPD flag that has been
removed, the removal reverted, and then removed again. Making this
commit a pointless fixup for a problem that was caused by the removal of
__GFP_NO_KSWAPD flag.

The thing is, we really don't want to wake up kswapd for THP allocations
(because they fail quite commonly under any kind of memory pressure,
including when there is tons of memory free), and these patches were
just trying to fix up the underlying bug: the original removal of
__GFP_NO_KSWAPD in commit c654345924f7 ("mm: remove __GFP_NO_KSWAPD")
was simply bogus.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

+10 -27
+10 -27
mm/page_alloc.c
··· 2378 2378 return !!(gfp_to_alloc_flags(gfp_mask) & ALLOC_NO_WATERMARKS); 2379 2379 } 2380 2380 2381 - /* Returns true if the allocation is likely for THP */ 2382 - static bool is_thp_alloc(gfp_t gfp_mask, unsigned int order) 2383 - { 2384 - if (order == pageblock_order && 2385 - (gfp_mask & (__GFP_MOVABLE|__GFP_REPEAT)) == __GFP_MOVABLE) 2386 - return true; 2387 - return false; 2388 - } 2389 - 2390 2381 static inline struct page * 2391 2382 __alloc_pages_slowpath(gfp_t gfp_mask, unsigned int order, 2392 2383 struct zonelist *zonelist, enum zone_type high_zoneidx, ··· 2416 2425 goto nopage; 2417 2426 2418 2427 restart: 2419 - /* The decision whether to wake kswapd for THP is made later */ 2420 - if (!is_thp_alloc(gfp_mask, order)) 2421 - wake_all_kswapd(order, zonelist, high_zoneidx, 2428 + wake_all_kswapd(order, zonelist, high_zoneidx, 2422 2429 zone_idx(preferred_zone)); 2423 2430 2424 2431 /* ··· 2487 2498 goto got_pg; 2488 2499 sync_migration = true; 2489 2500 2490 - if (is_thp_alloc(gfp_mask, order)) { 2491 - /* 2492 - * If compaction is deferred for high-order allocations, it is 2493 - * because sync compaction recently failed. If this is the case 2494 - * and the caller requested a movable allocation that does not 2495 - * heavily disrupt the system then fail the allocation instead 2496 - * of entering direct reclaim. 2497 - */ 2498 - if (deferred_compaction || contended_compaction) 2499 - goto nopage; 2500 - 2501 - /* If process is willing to reclaim/compact then wake kswapd */ 2502 - wake_all_kswapd(order, zonelist, high_zoneidx, 2503 - zone_idx(preferred_zone)); 2504 - } 2501 + /* 2502 + * If compaction is deferred for high-order allocations, it is because 2503 + * sync compaction recently failed. In this is the case and the caller 2504 + * requested a movable allocation that does not heavily disrupt the 2505 + * system then fail the allocation instead of entering direct reclaim. 2506 + */ 2507 + if ((deferred_compaction || contended_compaction) && 2508 + (gfp_mask & (__GFP_MOVABLE|__GFP_REPEAT)) == __GFP_MOVABLE) 2509 + goto nopage; 2505 2510 2506 2511 /* Try direct reclaim and then allocating */ 2507 2512 page = __alloc_pages_direct_reclaim(gfp_mask, order,