From patchwork Wed Dec 11 10:35:10 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Vetter X-Patchwork-Id: 3323981 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 3ED099F37A for ; Wed, 11 Dec 2013 10:35:57 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id E37D9200EA for ; Wed, 11 Dec 2013 10:35:55 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id DCBC02018E for ; Wed, 11 Dec 2013 10:35:53 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 01A58105777; Wed, 11 Dec 2013 02:35:42 -0800 (PST) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-ea0-f173.google.com (mail-ea0-f173.google.com [209.85.215.173]) by gabe.freedesktop.org (Postfix) with ESMTP id 8B124FB5AB for ; Wed, 11 Dec 2013 02:35:35 -0800 (PST) Received: by mail-ea0-f173.google.com with SMTP id o10so2818584eaj.4 for ; Wed, 11 Dec 2013 02:35:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=UJzncdPuwxmzKOb8ZVIr2VQUe8thkrVLC4zrnTlVcPQ=; b=cl8OCe8QRbcIO0iFzSriilrbDDCxqMNUqk/m1U72KlTKgPcUFuQykBmA8W2zD7sfcF XqHvYEMoT/OoUgim7yZ0anNegatyg8trUXAEziAQHHjfYkjccODjnVTHLizgVovvSJNT EYEMWLSR72/AKa7N4dWhkQexreheNQ9Gw+4LE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=UJzncdPuwxmzKOb8ZVIr2VQUe8thkrVLC4zrnTlVcPQ=; b=IyQCW8kOgPcbs4dklURVfTzRwWvqRSAMOjc6gLtfkWesut7oY8jkDUy6IwUMEN3gsU bogzq0Xu4FS/pRHz/5HnJW01ioViYMuothbxG0xQTsNiAww8RLInuaXKF3qMUnsaNlBg MvTPdgnKz2aMK2tO+KiCgZf03gsBCkRpczy3z9Oee+GcrrQXs1gVXeS/sA3qp5kjJSgU 50zhGVtMiBsTefHAZrMtvASNtEc+di8CDqs6nVSAjRwyrgIqqo6A273kYNRByEntrgVL TO9/gSAUnVzSSH2udAg5CwYXnfym69KHhekGvTDrTVoZlyx3bVfp+QSM1NjJx/poTv4Q ffpg== X-Gm-Message-State: ALoCoQlNp+NIv3YGzl0eDnLGPL4D9wUiip/77HlEqNQL7el7yM+i4s3EwCdCPaWPv0cDuIVcEUKu X-Received: by 10.15.76.6 with SMTP id m6mr909771eey.37.1386758134827; Wed, 11 Dec 2013 02:35:34 -0800 (PST) Received: from phenom.ffwll.local (178-83-130-250.dynamic.hispeed.ch. [178.83.130.250]) by mx.google.com with ESMTPSA id b41sm51932269eef.16.2013.12.11.02.35.33 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 11 Dec 2013 02:35:34 -0800 (PST) From: Daniel Vetter To: DRI Development Subject: [PATCH 49/50] drm: remove dev->vma_count Date: Wed, 11 Dec 2013 11:35:10 +0100 Message-Id: <1386758111-3446-50-git-send-email-daniel.vetter@ffwll.ch> X-Mailer: git-send-email 1.8.4.3 In-Reply-To: <1386758111-3446-1-git-send-email-daniel.vetter@ffwll.ch> References: <1386758111-3446-1-git-send-email-daniel.vetter@ffwll.ch> Cc: Daniel Vetter X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: dri-devel-bounces@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org X-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- drivers/gpu/drm/drm_fops.c | 2 -- drivers/gpu/drm/drm_info.c | 10 +++++++--- drivers/gpu/drm/drm_vm.c | 3 --- include/drm/drmP.h | 1 - 4 files changed, 7 insertions(+), 9 deletions(-) diff --git a/drivers/gpu/drm/drm_fops.c b/drivers/gpu/drm/drm_fops.c index 330f3dd8e9d0..7f2af9aca038 100644 --- a/drivers/gpu/drm/drm_fops.c +++ b/drivers/gpu/drm/drm_fops.c @@ -391,8 +391,6 @@ static void drm_legacy_dev_reinit(struct drm_device *dev) if (drm_core_check_feature(dev, DRIVER_MODESET)) return; - atomic_set(&dev->vma_count, 0); - dev->sigdata.lock = NULL; dev->context_flag = 0; diff --git a/drivers/gpu/drm/drm_info.c b/drivers/gpu/drm/drm_info.c index 9337f8e210f8..86feedd5e6f6 100644 --- a/drivers/gpu/drm/drm_info.c +++ b/drivers/gpu/drm/drm_info.c @@ -232,14 +232,18 @@ int drm_vma_info(struct seq_file *m, void *data) struct drm_device *dev = node->minor->dev; struct drm_vma_entry *pt; struct vm_area_struct *vma; + unsigned long vma_count = 0; #if defined(__i386__) unsigned int pgprot; #endif mutex_lock(&dev->struct_mutex); - seq_printf(m, "vma use count: %d, high_memory = %pK, 0x%pK\n", - atomic_read(&dev->vma_count), - high_memory, (void *)(unsigned long)virt_to_phys(high_memory)); + list_for_each_entry(pt, &dev->vmalist, head) + vma_count++; + + seq_printf(m, "vma use count: %lu, high_memory = %pK, 0x%pK\n", + vma_count, high_memory, + (void *)(unsigned long)virt_to_phys(high_memory)); list_for_each_entry(pt, &dev->vmalist, head) { vma = pt->vma; diff --git a/drivers/gpu/drm/drm_vm.c b/drivers/gpu/drm/drm_vm.c index ef5540b6b451..24e045c4f531 100644 --- a/drivers/gpu/drm/drm_vm.c +++ b/drivers/gpu/drm/drm_vm.c @@ -220,7 +220,6 @@ static void drm_vm_shm_close(struct vm_area_struct *vma) DRM_DEBUG("0x%08lx,0x%08lx\n", vma->vm_start, vma->vm_end - vma->vm_start); - atomic_dec(&dev->vma_count); map = vma->vm_private_data; @@ -405,7 +404,6 @@ void drm_vm_open_locked(struct drm_device *dev, DRM_DEBUG("0x%08lx,0x%08lx\n", vma->vm_start, vma->vm_end - vma->vm_start); - atomic_inc(&dev->vma_count); vma_entry = kmalloc(sizeof(*vma_entry), GFP_KERNEL); if (vma_entry) { @@ -433,7 +431,6 @@ void drm_vm_close_locked(struct drm_device *dev, DRM_DEBUG("0x%08lx,0x%08lx\n", vma->vm_start, vma->vm_end - vma->vm_start); - atomic_dec(&dev->vma_count); list_for_each_entry_safe(pt, temp, &dev->vmalist, head) { if (pt->vma == vma) { diff --git a/include/drm/drmP.h b/include/drm/drmP.h index a61d09b857a5..311d182c521d 100644 --- a/include/drm/drmP.h +++ b/include/drm/drmP.h @@ -1072,7 +1072,6 @@ struct drm_device { /** \name Usage Counters */ /*@{ */ int open_count; /**< Outstanding files open, protected by drm_global_lock. */ - atomic_t vma_count; /**< Outstanding vma areas open */ spinlock_t buf_lock; /**< For drm_device::buf_use and a few other things. */ int buf_use; /**< Buffers in use -- cannot alloc */ atomic_t buf_alloc; /**< Buffer allocation in progress */