On 2019-06-11 6:54 p.m., StDenis, Tom wrote: > (v2): Return 0 and set mem->mm_node to NULL. > > Signed-off-by: Tom St Denis <tom.stde...@amd.com> > --- > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c | 18 +++++++++++++----- > 1 file changed, 13 insertions(+), 5 deletions(-) > > [...] > > @@ -284,6 +284,14 @@ static int amdgpu_vram_mgr_new(struct > ttm_mem_type_manager *man, > if (!lpfn) > lpfn = man->size; > > + /* bail out quickly if there's likely not enough VRAM for this BO */ > + atomic64_add(mem->num_pages << PAGE_SHIFT, &mgr->usage); > + if (atomic64_read(&mgr->usage) > adev->gmc.mc_vram_size) {
Should probably use atomic64_add_return instead of atomic64_add + atomic64_read. Also, AFAICT this doesn't allow any VRAM overcommit, which seems a bit conservative? -- Earthling Michel Dänzer | https://www.amd.com Libre software enthusiast | Mesa and X developer _______________________________________________ amd-gfx mailing list amd-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/amd-gfx