Commit Graph

5 Commits

Author SHA1 Message Date
Konsta Holtta
4d07572c82 gpu: nvgpu: add space query in page and buddy allocs
Amount of free space in the buddy allocator is computed from the
complete capacity minus currently used bytes.

The page allocator just queries its underlying allocator.

Bug 1787771
Bug 200233138

Change-Id: I9b6f5ef90119236a13de14e14cd0a3ee72144a11
Signed-off-by: Konsta Holtta <kholtta@nvidia.com>
Reviewed-on: http://git-master/r/1223761
(cherry picked from commit 0b324a60ebdf67e793ade869c252a8ddd56c04f8)
Reviewed-on: http://git-master/r/1235979
GVS: Gerrit_Virtual_Submit
Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
2016-10-14 08:12:27 -07:00
Alex Waterman
aa14efa2b4 gpu: nvgpu: Carveout support for the page allocator
Implement carveout support by just calling through to the buddy
allocator's carveout support.

Jira DNVGPU-84

Change-Id: I1940873394a4cbff0152f1b6c9c4fd659e0076e1
Signed-off-by: Alex Waterman <alexw@nvidia.com>
Reviewed-on: http://git-master/r/1203392
(cherry picked from commit 499ee0407bf525e161a14cfb8bbbc101ac934329)
Reviewed-on: http://git-master/r/1223454
GVS: Gerrit_Virtual_Submit
Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
2016-09-20 14:56:42 -07:00
Konsta Holtta
6029684eb0 gpu: nvgpu: fix chunk size mismatch in page allocator
When allocating discontiguous memory composed of several chunks,
update also the number of pages used by the current chunk, if a large
chunk was not available and a retry is performed with a smaller one.
Failing to do this would result in too few chunks reserved for a large
enough allocation in certain conditions.

Bug 1805067

Change-Id: I9d14864724d228b42c47eb4669fbe0f789334397
Signed-off-by: Konsta Holtta <kholtta@nvidia.com>
Reviewed-on: http://git-master/r/1214914
(cherry picked from commit 9bece931b13e4dad808622462d4d98d421cfb383)
Reviewed-on: http://git-master/r/1220546
GVS: Gerrit_Virtual_Submit
Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
Tested-by: Terje Bergstrom <tbergstrom@nvidia.com>
2016-09-14 14:13:40 -07:00
Deepak Nibade
50fec50bff gpu: nvgpu: fix memory leak in case of failure
In __gk20a_alloc_pages(), if we fail to allocate a chunk
we free previously allocated chunks in error path
But we do not free up the memory reserved in those chunks
which could lead to OOM situations

Fix this by calling gk20a_free() for each chunk in error
path

Jira DNVGPU-96

Change-Id: I68aa18d68a5282405016e688c790ccbc0c2a0d69
Signed-off-by: Deepak Nibade <dnibade@nvidia.com>
Reviewed-on: http://git-master/r/1203098
(cherry picked from commit f096bd1675600f4e2fc2d686f2911bb945fbbf0b)
Reviewed-on: http://git-master/r/1210952
GVS: Gerrit_Virtual_Submit
Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
2016-09-01 09:10:45 -07:00
Alex Waterman
448df6ed27 gpu: nvgpu: Implement a vidmem allocator
Implement an allocator suitable for managing the video memory on dGPUs.
It works by allocating chunks from an underlying buddy allocator and
collating the chunks together (similar to what an sgt does in the
wider Linux kernel). This handles the ability to get large buffers in
potentially fragmented memory. The GMMU can then obviously map the
physical vidmem into contiguous GVA spaces.

Jira DNVGPU-96

Change-Id: Ic1d7800b033a170b77790aa23fad6858443d0e89
Signed-off-by: Alex Waterman <alexw@nvidia.com>
Reviewed-on: http://git-master/r/1197203
(cherry picked from commit fa44684a843956ae384fef6d7a79b9cbbd04f73e)
Reviewed-on: http://git-master/r/1185231
GVS: Gerrit_Virtual_Submit
Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
2016-08-30 10:04:10 -07:00