Module Name: src Committed By: mrg Date: Tue May 31 20:53:35 UTC 2022
Modified Files: src/sys/external/bsd/drm2/dist/drm/nouveau/nvkm/subdev/mmu: nouveau_nvkm_subdev_mmu_mem.c Log Message: reorganise most of the NetBSD portion of nvkm_mem_dtor(). when nvkm_mem_new_host() is called via the in-kernel ioctl method, we copy the supplied dmamap, use it's dm_nsegs value for allocation of "mem->dma", and assume it remains valid until we're done. when this path is taken "mem->mem" remains NULL so all the code in nvkm_mem_dtor() is ignored, and the "mem->dma" is leaked. this is one leak seen in PR#56826. as "dmamap->dm_nsegs" can become invalid before the dtor call, store the value in "mem->nseg" for use in the dtor, and convert the dtor to free "mem->dma" if "mem->dma" is set. additionally, "mem->pages" should end up being the same value as "nseg" here, ASSERT() this. while here properly mark NetBSD specific code in nvkm_mem_new_host(). additionally, destroy the dmamap created in the non-ioctl path of nvkm_mem_new_host(). this is another leak seen in PR#56826. with both of these fixes my "kmem-04096" pool does not grow rapidly while using "mpv -vo gpu". infact, once i loaded the relevant file into memory, this pool remains stable after at least one minute of video playback. ok riastradh@ To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.8 \ src/sys/external/bsd/drm2/dist/drm/nouveau/nvkm/subdev/mmu/nouveau_nvkm_subdev_mmu_mem.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.