Skip to content

Commit 99c09e7

Browse files
danvetairlied
authored andcommitted
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>
1 parent 5952fba commit 99c09e7

4 files changed

Lines changed: 7 additions & 9 deletions

File tree

‎drivers/gpu/drm/drm_fops.c‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -391,8 +391,6 @@ static void drm_legacy_dev_reinit(struct drm_device *dev)
391391
if (drm_core_check_feature(dev, DRIVER_MODESET))
392392
return;
393393

394-
atomic_set(&dev->vma_count, 0);
395-
396394
dev->sigdata.lock = NULL;
397395

398396
dev->context_flag = 0;

‎drivers/gpu/drm/drm_info.c‎

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -234,14 +234,18 @@ int drm_vma_info(struct seq_file *m, void *data)
234234
struct drm_device *dev = node->minor->dev;
235235
struct drm_vma_entry *pt;
236236
struct vm_area_struct *vma;
237+
unsigned long vma_count = 0;
237238
#if defined(__i386__)
238239
unsigned int pgprot;
239240
#endif
240241

241242
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));
245249

246250
list_for_each_entry(pt, &dev->vmalist, head) {
247251
vma = pt->vma;

‎drivers/gpu/drm/drm_vm.c‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,6 @@ static void drm_vm_shm_close(struct vm_area_struct *vma)
220220

221221
DRM_DEBUG("0x%08lx,0x%08lx\n",
222222
vma->vm_start, vma->vm_end - vma->vm_start);
223-
atomic_dec(&dev->vma_count);
224223

225224
map = vma->vm_private_data;
226225

@@ -405,7 +404,6 @@ void drm_vm_open_locked(struct drm_device *dev,
405404

406405
DRM_DEBUG("0x%08lx,0x%08lx\n",
407406
vma->vm_start, vma->vm_end - vma->vm_start);
408-
atomic_inc(&dev->vma_count);
409407

410408
vma_entry = kmalloc(sizeof(*vma_entry), GFP_KERNEL);
411409
if (vma_entry) {
@@ -433,7 +431,6 @@ void drm_vm_close_locked(struct drm_device *dev,
433431

434432
DRM_DEBUG("0x%08lx,0x%08lx\n",
435433
vma->vm_start, vma->vm_end - vma->vm_start);
436-
atomic_dec(&dev->vma_count);
437434

438435
list_for_each_entry_safe(pt, temp, &dev->vmalist, head) {
439436
if (pt->vma == vma) {

‎include/drm/drmP.h‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1109,7 +1109,6 @@ struct drm_device {
11091109
/** \name Usage Counters */
11101110
/*@{ */
11111111
int open_count; /**< Outstanding files open */
1112-
atomic_t vma_count; /**< Outstanding vma areas open */
11131112
int buf_use; /**< Buffers in use -- cannot alloc */
11141113
atomic_t buf_alloc; /**< Buffer allocation in progress */
11151114
/*@} */

0 commit comments

Comments
 (0)