Allow userspace to disable anon reclaim and enable nomap
reclaim. Also, let userspace set the per task nomap reclaim
size.
Change-Id: I4b52376b02b3590206aaec68e3135ecb54ca0830
Signed-off-by: Vinayak Menon <vinmenon@codeaurora.org>
GPU drivers can allocate memory via shmem and these pages
may or may not be mapped to userspace at any moment. But
these pages are allocated on behalf of userspace tasks.
It is ideal to swapout the unmapped pages of a task during
process reclaim. But as process reclaims works on mappings
to derive pages, it misses the unmapped gpu pages. Add an
option to reclaim these pages. Drivers can register to the
reclaim notifier and call into the reclaim function with the
mapping that contains these mapped/unmapped pages.
Change-Id: Ia5de99d9830c0bdf0e9e56d860987f79f95df435
Signed-off-by: Vinayak Menon <vinmenon@codeaurora.org>
With this patch, anon pages of inactive tasks can be reclaimed,
depending on memory pressure. Memory pressure is detected
using vmpressure events. 'N' best tasks in terms of anon
size is selected and pages proportional to their tasksize
is reclaimed. The total number of pages reclaimed at each
run of the swap work, can be tuned from userspace, the
default being SWAP_CLUSTER_MAX * 32.
The patch also adds tracepoints to debug and tune the
feature.
echo 1 > /sys/module/process_reclaim/parameters/enable_process_reclaim
to enable the feature.
echo <pages> > /sys/module/process_reclaim/parameters/per_swap_size,
to set the number of pages reclaimed in each scan.
/sys/module/process_reclaim/parameters/reclaim_avg_efficiency, provides
the average efficiency (scan to reclaim ratio) of the algorithm.
/sys/module/process_reclaim/parameters/swap_eff_win, to set the window
period (in unit of number of times reclaim is triggered) to detect
low efficiency runs.
/sys/module/process_reclaim/parameters/swap_opt_eff, to set the optimal
efficiency threshold for low efficiency detection.
Change-Id: I895986f10c997d1715761eaaadc4bbbee60db9d2
Signed-off-by: Vinayak Menon <vinmenon@codeaurora.org>