Commit 9223cbec authored by Heesub Shin's avatar Heesub Shin Committed by Treehugger Robot
Browse files

ANDROID: cma: redirect page allocation to CMA

CMA pages are designed to be used as fallback for movable allocations
and cannot be used for non-movable allocations. If CMA pages are
utilized poorly, non-movable allocations may end up getting starved if
all regular movable pages are allocated and the only pages left are
CMA. Always using CMA pages first creates unacceptable performance
problems. As a midway alternative, use CMA pages for certain
userspace allocations. The userspace pages can be migrated or dropped
quickly which giving decent utilization.

Additionally, add a fall-backs for failed CMA allocations in rmqueue()
and __rmqueue_pcplist() (the latter addition being driven by a report
by the kernel test robot); these fallbacks were dealt with differently
in the original version of the patch as the rmqueue() call chain has
changed).

[ACK6.6 port notes]
    Add a command line option, 'restrict_cma_fallback` and redirect page
    allocation to CMA only if this option is specified.  If the option is
    not specified, there should be no change in behavior. When the option
    is specified, only allocations tagged with __GFP_CMA are redirected
    (as in ACK 6.1). We considered adding a vendor hook, but couldn't
    find a good place for the hook. We only need to initialize the flag
    once - unlike normal vendor hooks which operate on other variables
    in the context of the hook. But the vendor hook can't be too early
    in the boot since the trace infrastructure is not yet initialized.

Bug: 330201547
Change-Id: Iad46f0405b416e29ae788f82b79c9953513a9c9d
Link: https://lore.kernel.org/lkml/cover.1604282969.git.cgoldswo@codeaurora.org/


Reported-by: default avatarkernel test robot <rong.a.chen@intel.com>
Signed-off-by: default avatarKyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: default avatarHeesub Shin <heesub.shin@samsung.com>
Signed-off-by: default avatarVinayak Menon <vinmenon@codeaurora.org>
[cgoldswo@codeaurora.org: Place in bugfixes; remove cma_alloc zone flag]
Signed-off-by: default avatarChris Goldsworthy <cgoldswo@codeaurora.org>
[isaacm@codeaurora.org: Resolve merge conflicts to account for new mm
features]
Signed-off-by: default avatarIsaac J. Manjarres <isaacm@codeaurora.org>
[Port to ACK6.6 with input from Chris Goldsworthy and Patrick Daly]
Signed-off-by: default avatarSukadev Bhattiprolu <quic_sukadev@quicinc.com>
parent ba3f5569
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment