Re: [PATCH v9 07/10] mm: Device exclusive memory access

From: John Hubbard
Date: Thu Jun 03 2021 - 04:37:21 EST


On 6/2/21 1:50 AM, Balbir Singh wrote:
...
only impact the address space of programs using the GPU. Should the exclusively
marked range live in the unreclaimable list and recycled back to active/in-active
to account for the fact that

1. It is not reclaimable and reclaim will only hurt via page faults?
2. It ages the page correctly or at-least allows for that possibility when the
page is used by the GPU.

I'm not sure that that is *necessarily* something we can conclude. It depends upon
access patterns of each program. For example, a "reduction" parallel program sends
over lots of data to the GPU, and only a tiny bit of (reduced!) data comes back
to the CPU. In that case, freeing the physical page on the CPU is actually the
best decision for the OS to make (if the OS is sufficiently prescient).


With a shared device or a device exclusive range, it would be good to get the device
usage pattern and update the mm with that knowledge, so that the LRU can be better

Integrating a GPU (or "device") processor and it's mm behavior with the Linux kernel is
always an interesting concept. Certainly worth exploring, although it's probably
not a small project by any means.

maintained. With your comment you seem to suggest that a page used by the GPU might
be a good candidate for reclaim based on the CPU's understanding of the age of
the page should not account for use by the device
(are GPU workloads - access once and discard?)


Well, that's a little too narrow of an interpretation. The GPU is a fairly general
purpose processor, and so it has all kinds of workloads. I'm trying to discourage
any hopes that one can know, in advance, precisely how the GPU's pages need to be
managed. It's similar to the the CPU, in that regard. My example was just one, out
of a vast pool of possible behaviors.

thanks,
--
John Hubbard
NVIDIA