msm: kgsl: add support to reclaim pages of a process
To make kgsl pages reclaimable and to swap the pages, the already present
infrastructure of shmem is used. shmem provides the option of keeping
track of the swapped pages and getting the pages back when required.
At a given time, kgsl can make only those pages available for reclaim that
are not being used by GPU or by the user. The pages allowed to be reclaimed
should be chosen wisely, so that GPU or user do not use them immediately
after reclaim. Also, it is desirable that the swap out and swap in of pages
do not cause any performance impact on the active GPU use cases. Keeping
these in mind, making reclaimable all the pages of the processes that are
in background seems to be the best option. Here the pages are less likely
to be used any time soon and all the work is done while the process is
moving to foreground and no impact is seen when the process actually comes
to foreground and does something with the GPU. A sysfs node is exposed for
each process in /sys/class/kgsl/kgsl/proc/<pid>. The perf daemon that has
the knowledge about the process foreground and background communicates the
same to kgsl.
To make the pages reclaimable as part of PPR (Per Process Reclaim), kgsl
has to register to a notifier that would be called based on the system
wide memory pressure. The callback is necessary, as PPR works on the
process address space and all the pages that are not mapped to user space
will be left out, as PPR will never have the knowledge of the unmapped
kgsl pages. In the callback, kgsl decides if it can allow reclaim.
Allowing reclaim of too many pages will impact the next launch latency
of the application. So expose a node in /sys/class/kgsl/kgsl/ to set the
maximum limit that can be reclaimed per process. This is again set by
the perf daemon.
Expose a node /sys/class/kgsl/kgsl/proc/<pid>/gpumem_reclaimed to know
how much memory of the process has been reclaimed.
Change-Id: I94e8b6df0ace2ddc848c9d683c6b0d5314c7d309
Signed-off-by:
Puranam V G Tejaswi <pvgtejas@codeaurora.org>
Loading
Please register or sign in to comment