Commit fe3caa57 authored by Juan Yescas's avatar Juan Yescas
Browse files

ANDROID: mm: Set __GFP_CMA in do_swap_page() for folio allocations



In the do_swap_page() path, the memory allocations were failing
even if there were free CMA pages. The allocations were not fallbacking
to CMA bucket.

This was due the requested folios were not marked as __GFP_CMA and as
a consequence, the ALLOC_CMA was not set.

```
static inline unsigned int gfp_to_alloc_flags_cma(gfp_t gfp_mask,
						  unsigned int alloc_flags)
{
	/*
	 * If cma_redirect_restricted is true, set ALLOC_CMA only for
	 * movable allocations that have __GFP_CMA.
	 */
	if ((!cma_redirect_restricted() || gfp_mask & __GFP_CMA) &&
	    gfp_migratetype(gfp_mask) == MIGRATE_MOVABLE)
		alloc_flags |= ALLOC_CMA;
	trace_android_vh_alloc_flags_cma_adjust(gfp_mask, &alloc_flags);
	return alloc_flags;
}
```

This was introduced in the change I9d16a9cae1c6c0f6cdb03183038fab095843001e
("BACKPORT: mm: support large folios swap-in for sync io devices")

Bug: 427802573
Bug: 425779146
Bug: 422586344
Bug: 313807618
Test: Built and run kernel
Change-Id: Ied33777bb04198f1e4a69b91f002ae70d0471bb3
Fixes: 988dc02c ("BACKPORT: mm: support large folios swap-in for sync io devices")
Signed-off-by: default avatarJuan Yescas <jyescas@google.com>
parent 1c1f2b75
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment