dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Roger He <Hongbo.He@amd.com>
To: dri-devel@lists.freedesktop.org
Cc: Roger He <Hongbo.He@amd.com>, Christian.Koenig@amd.com
Subject: [PATCH 2/2] drm/ttm: only free pages rather than update global memory count together
Date: Fri, 12 Jan 2018 14:14:17 +0800	[thread overview]
Message-ID: <1515737657-2983-2-git-send-email-Hongbo.He@amd.com> (raw)
In-Reply-To: <1515737657-2983-1-git-send-email-Hongbo.He@amd.com>

if ttm_get_pages or ttm_mem_global_alloc_page fail, should not update
global memory count.

Signed-off-by: Roger He <Hongbo.He@amd.com>
---
 drivers/gpu/drm/ttm/ttm_page_alloc.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/ttm/ttm_page_alloc.c b/drivers/gpu/drm/ttm/ttm_page_alloc.c
index 0eab24e..aebabf1 100644
--- a/drivers/gpu/drm/ttm/ttm_page_alloc.c
+++ b/drivers/gpu/drm/ttm/ttm_page_alloc.c
@@ -1075,7 +1075,8 @@ int ttm_pool_populate(struct ttm_tt *ttm, struct ttm_operation_ctx *ctx)
 	ret = ttm_get_pages(ttm->pages, ttm->num_pages, ttm->page_flags,
 			    ttm->caching_state);
 	if (unlikely(ret != 0)) {
-		ttm_pool_unpopulate(ttm);
+		ttm_put_pages(ttm->pages, ttm->num_pages, ttm->page_flags,
+			ttm->caching_state);
 		return ret;
 	}
 
@@ -1083,7 +1084,8 @@ int ttm_pool_populate(struct ttm_tt *ttm, struct ttm_operation_ctx *ctx)
 		ret = ttm_mem_global_alloc_page(mem_glob, ttm->pages[i],
 						PAGE_SIZE, ctx);
 		if (unlikely(ret != 0)) {
-			ttm_pool_unpopulate(ttm);
+			ttm_put_pages(ttm->pages, ttm->num_pages,
+				ttm->page_flags, ttm->caching_state);
 			return -ENOMEM;
 		}
 	}
-- 
2.7.4

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

  reply	other threads:[~2018-01-12  6:14 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-12  6:14 [PATCH 1/2] drm/ttm: don't update global memory count for some special cases Roger He
2018-01-12  6:14 ` Roger He [this message]
2018-01-12  6:55   ` [PATCH 2/2] drm/ttm: only free pages rather than update global memory count together Andrey Grodzovsky
2018-01-12  7:58   ` Christian König
2018-01-12  6:45 ` [PATCH 1/2] drm/ttm: don't update global memory count for some special cases Chunming Zhou
2018-01-12  6:52   ` He, Roger
2018-01-12  7:54 ` Christian König

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=1515737657-2983-2-git-send-email-Hongbo.He@amd.com \
    --to=hongbo.he@amd.com \
    --cc=Christian.Koenig@amd.com \
    --cc=dri-devel@lists.freedesktop.org \
    /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