gpu: nvgpu: Smarter way to check vmalloc address

In the nvgpu_big_free() function the passed in address is checked
to see what type of address it is: kmalloc or vmalloc. This change
uses the is_vmalloc_addr() instead since this is a much clearer and
easier way to determine if a virtual address should be vfree()ed.
Anything not a vmalloc address is then assumed to be a kmalloc()
address.

rel-28: Note that this code is actually in <nvgpu/kmem.h> on rel-28
so this cherry-pick took that into account.

Bug 2049449

Change-Id: I2bd9441d3c5fc455f03ec2075d012c607280ad5f
Reviewed-on: https://git-master.nvidia.com/r/1644802
(cherry picked from commit a63e715117)
Signed-off-by: Alex Waterman <alexw@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1645512
Reviewed-by: Arun Kannan <akannan@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
Alex Waterman
2018-01-23 15:41:36 -08:00
committed by mobile promotions
parent c386221971
commit 85494f6428

View File

@@ -292,10 +292,10 @@ static inline void nvgpu_big_free(struct gk20a *g, void *p)
* nvgpu_big_[mz]alloc() will need to remember the size of the alloc * nvgpu_big_[mz]alloc() will need to remember the size of the alloc
* when freeing. * when freeing.
*/ */
if (virt_addr_valid(p)) if (is_vmalloc_addr(p))
nvgpu_kfree(g, p);
else
nvgpu_vfree(g, p); nvgpu_vfree(g, p);
else
nvgpu_kfree(g, p);
} }
#endif /* __NVGPU_KMEM_H__ */ #endif /* __NVGPU_KMEM_H__ */