OSDN Git Service

drm/amdgpu: support userptr cross VMAs case with HMM
authorPhilip Yang <Philip.Yang@amd.com>
Mon, 4 Mar 2019 19:41:03 +0000 (14:41 -0500)
committerAlex Deucher <alexander.deucher@amd.com>
Tue, 19 Mar 2019 20:36:58 +0000 (15:36 -0500)
commit5aeaccca30023c00d982dfa7bfd25b384523460a
treec1604b39aa6a529ea0b78ccf07214d86a88703bf
parent386a68e78620c793ed1ba9bc5789b90c18be262a
drm/amdgpu: support userptr cross VMAs case with HMM

userptr may cross two VMAs if the forked child process (not call exec
after fork) malloc buffer, then free it, and then malloc larger size
buf, kerenl will create new VMA adjacent to old VMA which was cloned
from parent process, some pages of userptr are in the first VMA, the
rest pages are in the second VMA.

HMM expects range only have one VMA, loop over all VMAs in the address
range, create multiple ranges to handle this case. See
is_mergeable_anon_vma in mm/mmap.c for details.

Signed-off-by: Philip Yang <Philip.Yang@amd.com>
Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c