From: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
To: linux-kernel@vger.kernel.org, j.glisse@gmail.com,
dri-devel@lists.freedesktop.org
Cc: bskeggs@redhat.com, thellstrom@vmware.com,
Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Subject: [PATCH 1/3] drm/ttm/dma: Only call set_pages_array_wb when the page is not in WB pool.
Date: Mon, 12 Dec 2011 15:09:27 -0500 [thread overview]
Message-ID: <1323720569-15435-2-git-send-email-konrad.wilk@oracle.com> (raw)
In-Reply-To: <1323720569-15435-1-git-send-email-konrad.wilk@oracle.com>
Otherwise we are doing redundant work. Especially since the 'unbind'
and 'unpopulate' have been merged and nouveau driver ends up calling
it quite excessivly. On a GeForce 8600 GT with Gnome Shell (GNOME 3)
we end up spending about 54% CPU time in __change_page_attr_set_clr
checking the page flags when I move the mouse cursor all over the screen.
The callgraph (annotated) looks as so before this patch:
53.29% gnome-shell [kernel.kallsyms] [k] static_protections
|
--- static_protections
|
|--91.80%-- __change_page_attr_set_clr
| change_page_attr_set_clr
| set_pages_array_wb
| |
| |--96.55%-- ttm_dma_unpopulate
| | nouveau_ttm_tt_unpopulate
| | ttm_tt_destroy
| | ttm_bo_cleanup_memtype_use
| | ttm_bo_release
| | kref_put
| | ttm_bo_unref
| | nouveau_gem_object_del
| | drm_gem_object_free
| | kref_put
| | drm_gem_object_unreference_unlocked
| | drm_gem_object_handle_unreference_unlocked.part.1
| | drm_gem_handle_delete
| | drm_gem_close_ioctl
| | drm_ioctl
| | do_vfs_ioctl
| | sys_ioctl
| | system_call_fastpath
| | __GI___ioctl
| |
| --3.45%-- ttm_dma_pages_put
| ttm_dma_page_pool_free
| ttm_dma_unpopulate
| nouveau_ttm_tt_unpopulate
| ttm_tt_destroy
| ttm_bo_cleanup_memtype_use
| ttm_bo_release
| kref_put
| ttm_bo_unref
| nouveau_gem_object_del
| drm_gem_object_free
| kref_put
| drm_gem_object_unreference_unlocked
| drm_gem_object_handle_unreference_unlocked.part.1
| drm_gem_handle_delete
| drm_gem_close_ioctl
| drm_ioctl
| do_vfs_ioctl
| sys_ioctl
| system_call_fastpath
| __GI___ioctl
|
--8.20%-- change_page_attr_set_clr
set_pages_array_wb
|
|--93.76%-- ttm_dma_unpopulate
| nouveau_ttm_tt_unpopulate
| ttm_tt_destroy
| ttm_bo_cleanup_memtype_use
| ttm_bo_release
| kref_put
| ttm_bo_unref
| nouveau_gem_object_del
| drm_gem_object_free
| kref_put
| drm_gem_object_unreference_unlocked
| drm_gem_object_handle_unreference_unlocked.part.1
| drm_gem_handle_delete
| drm_gem_close_ioctl
| drm_ioctl
| do_vfs_ioctl
| sys_ioctl
| system_call_fastpath
| __GI___ioctl
|
--6.24%-- ttm_dma_pages_put
ttm_dma_page_pool_free
ttm_dma_unpopulate
nouveau_ttm_tt_unpopulate
ttm_tt_destroy
ttm_bo_cleanup_memtype_use
ttm_bo_release
kref_put
ttm_bo_unref
nouveau_gem_object_del
drm_gem_object_free
kref_put
drm_gem_object_unreference_unlocked
drm_gem_object_handle_unreference_unlocked.part.1
drm_gem_handle_delete
drm_gem_close_ioctl
drm_ioctl
do_vfs_ioctl
sys_ioctl
system_call_fastpath
__GI___ioctl
and after this patch all of that disappears.
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
---
drivers/gpu/drm/ttm/ttm_page_alloc_dma.c | 7 +++++--
1 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/ttm/ttm_page_alloc_dma.c b/drivers/gpu/drm/ttm/ttm_page_alloc_dma.c
index 6678abc..6c06d0b 100644
--- a/drivers/gpu/drm/ttm/ttm_page_alloc_dma.c
+++ b/drivers/gpu/drm/ttm/ttm_page_alloc_dma.c
@@ -384,7 +384,9 @@ static void ttm_dma_pages_put(struct dma_pool *pool, struct list_head *d_pages,
{
struct dma_page *d_page, *tmp;
- if (npages && set_pages_array_wb(pages, npages))
+ /* Don't set WB on WB page pool. */
+ if (npages && !(pool->type & IS_CACHED) &&
+ set_pages_array_wb(pages, npages))
pr_err(TTM_PFX "%s: Failed to set %d pages to wb!\n",
pool->dev_name, npages);
@@ -396,7 +398,8 @@ static void ttm_dma_pages_put(struct dma_pool *pool, struct list_head *d_pages,
static void ttm_dma_page_put(struct dma_pool *pool, struct dma_page *d_page)
{
- if (set_pages_array_wb(&d_page->p, 1))
+ /* Don't set WB on WB page pool. */
+ if (!(pool->type & IS_CACHED) && set_pages_array_wb(&d_page->p, 1))
pr_err(TTM_PFX "%s: Failed to set %d pages to wb!\n",
pool->dev_name, 1);
--
1.7.7.3
next prev parent reply other threads:[~2011-12-12 20:10 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-12-12 20:09 [PATCH] fixes to drm-next - TTM DMA code (v1) Konrad Rzeszutek Wilk
2011-12-12 20:09 ` Konrad Rzeszutek Wilk [this message]
2011-12-12 20:09 ` [PATCH 2/3] drm/ttm/dma: Fix accounting error when calling ttm_mem_global_free_page Konrad Rzeszutek Wilk
2011-12-21 15:17 ` Jerome Glisse
2011-12-21 15:30 ` Konrad Rzeszutek Wilk
2011-12-12 20:09 ` [PATCH 3/3] drm/ttm/dma: Optimize when free-ing the recycled page pool Konrad Rzeszutek Wilk
2011-12-21 15:22 ` Jerome Glisse
2011-12-13 16:07 ` [PATCH] fixes to drm-next - TTM DMA code (v1) Jerome Glisse
2011-12-13 16:23 ` Thomas Hellstrom
2011-12-13 16:40 ` Konrad Rzeszutek Wilk
2011-12-19 19:51 ` Thomas Hellstrom
2011-12-20 17:35 ` Konrad Rzeszutek Wilk
2012-01-05 19:37 ` Jerome Glisse
2011-12-13 22:09 ` James Simmons
2012-01-04 21:35 [PATCH] fixes to drm-next - ttm code (v2) found when using nouveau Konrad Rzeszutek Wilk
2012-01-04 21:35 ` [PATCH 1/3] drm/ttm/dma: Only call set_pages_array_wb when the page is not in WB pool Konrad Rzeszutek Wilk
2012-01-05 15:55 ` Jerome Glisse
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1323720569-15435-2-git-send-email-konrad.wilk@oracle.com \
--to=konrad.wilk@oracle.com \
--cc=bskeggs@redhat.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=j.glisse@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=thellstrom@vmware.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®