Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm: remove dev->vma_count

This is just used for a debugfs file, and we can easily reconstruct
this number by just walking the list twice. Which isn't really bad for
a debugfs file anyway.

So let's rip this out.

There's the other issue that the dev->vmalist itself is a bit useless,
since that can be reconstructed with all the memory mapping
information from proc. But remove that is a different topic entirely.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Dave Airlie <airlied@redhat.com>

authored by

Daniel Vetter and committed by
Dave Airlie
99c09e74 5952fba5

+7 -9
-2
drivers/gpu/drm/drm_fops.c
··· 391 391 if (drm_core_check_feature(dev, DRIVER_MODESET)) 392 392 return; 393 393 394 - atomic_set(&dev->vma_count, 0); 395 - 396 394 dev->sigdata.lock = NULL; 397 395 398 396 dev->context_flag = 0;
+7 -3
drivers/gpu/drm/drm_info.c
··· 234 234 struct drm_device *dev = node->minor->dev; 235 235 struct drm_vma_entry *pt; 236 236 struct vm_area_struct *vma; 237 + unsigned long vma_count = 0; 237 238 #if defined(__i386__) 238 239 unsigned int pgprot; 239 240 #endif 240 241 241 242 mutex_lock(&dev->struct_mutex); 242 - seq_printf(m, "vma use count: %d, high_memory = %pK, 0x%pK\n", 243 - atomic_read(&dev->vma_count), 244 - high_memory, (void *)(unsigned long)virt_to_phys(high_memory)); 243 + list_for_each_entry(pt, &dev->vmalist, head) 244 + vma_count++; 245 + 246 + seq_printf(m, "vma use count: %lu, high_memory = %pK, 0x%pK\n", 247 + vma_count, high_memory, 248 + (void *)(unsigned long)virt_to_phys(high_memory)); 245 249 246 250 list_for_each_entry(pt, &dev->vmalist, head) { 247 251 vma = pt->vma;
-3
drivers/gpu/drm/drm_vm.c
··· 220 220 221 221 DRM_DEBUG("0x%08lx,0x%08lx\n", 222 222 vma->vm_start, vma->vm_end - vma->vm_start); 223 - atomic_dec(&dev->vma_count); 224 223 225 224 map = vma->vm_private_data; 226 225 ··· 404 405 405 406 DRM_DEBUG("0x%08lx,0x%08lx\n", 406 407 vma->vm_start, vma->vm_end - vma->vm_start); 407 - atomic_inc(&dev->vma_count); 408 408 409 409 vma_entry = kmalloc(sizeof(*vma_entry), GFP_KERNEL); 410 410 if (vma_entry) { ··· 431 433 432 434 DRM_DEBUG("0x%08lx,0x%08lx\n", 433 435 vma->vm_start, vma->vm_end - vma->vm_start); 434 - atomic_dec(&dev->vma_count); 435 436 436 437 list_for_each_entry_safe(pt, temp, &dev->vmalist, head) { 437 438 if (pt->vma == vma) {
-1
include/drm/drmP.h
··· 1109 1109 /** \name Usage Counters */ 1110 1110 /*@{ */ 1111 1111 int open_count; /**< Outstanding files open */ 1112 - atomic_t vma_count; /**< Outstanding vma areas open */ 1113 1112 int buf_use; /**< Buffers in use -- cannot alloc */ 1114 1113 atomic_t buf_alloc; /**< Buffer allocation in progress */ 1115 1114 /*@} */