From: Roger He <Hongbo.He-5C7GfCeVMHo@public.gmane.org>
To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org,
dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org
Cc: Roger He <Hongbo.He-5C7GfCeVMHo@public.gmane.org>,
Christian.Koenig-5C7GfCeVMHo@public.gmane.org
Subject: [PATCH 4/4] drm/ttm: free one in huge pool even shrink request less than one element
Date: Wed, 22 Nov 2017 13:36:56 +0800 [thread overview]
Message-ID: <1511329016-552-4-git-send-email-Hongbo.He@amd.com> (raw)
In-Reply-To: <1511329016-552-1-git-send-email-Hongbo.He-5C7GfCeVMHo@public.gmane.org>
Change-Id: Id8bd4d1ecff9f3ab14355e2dbd1c59b9fe824e01
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 37c2f2f..f80fc5b 100644
--- a/drivers/gpu/drm/ttm/ttm_page_alloc.c
+++ b/drivers/gpu/drm/ttm/ttm_page_alloc.c
@@ -463,11 +463,13 @@ ttm_pool_shrink_scan(struct shrinker *shrink, struct shrink_control *sc)
pool = &_manager->pools[(i + pool_offset)%NUM_POOLS];
/* OK to use static buffer since global mutex is held. */
nr_free_pool = (nr_free >> pool->order);
- if (nr_free_pool == 0)
- continue;
+ if (!nr_free_pool && pool->order)
+ nr_free_pool = 1;
shrink_pages = ttm_page_pool_free(pool, nr_free_pool, true);
freed += ((nr_free_pool - shrink_pages) << pool->order);
+ if (freed >= sc->nr_to_scan)
+ break;
}
mutex_unlock(&lock);
return freed;
--
2.7.4
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
next prev parent reply other threads:[~2017-11-22 5:36 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-11-22 5:36 [PATCH 1/4] drm/ttm: add page order in page pool Roger He
2017-11-22 5:36 ` [PATCH 2/4] drm/ttm: add page order support in ttm_pages_put Roger He
2017-11-22 6:01 ` Chunming Zhou
2017-11-22 7:40 ` He, Roger
[not found] ` <1511329016-552-2-git-send-email-Hongbo.He-5C7GfCeVMHo@public.gmane.org>
2017-11-22 9:29 ` Christian König
[not found] ` <b6c683f7-0fda-e6cd-f1d4-6037c889eca6-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-11-22 9:48 ` He, Roger
[not found] ` <1511329016-552-1-git-send-email-Hongbo.He-5C7GfCeVMHo@public.gmane.org>
2017-11-22 5:36 ` [PATCH 3/4] drm/ttm: add static buffer for ttm_pages_put to support pool shrink Roger He
2017-11-22 5:36 ` Roger He [this message]
2017-11-22 7:47 ` [PATCH 1/4] drm/ttm: add page order in page pool Christian König
[not found] ` <6c134a88-2322-b131-d79f-0e5e3b74cd17-5C7GfCeVMHo@public.gmane.org>
2017-11-22 8:10 ` He, Roger
-- strict thread matches above, loose matches on Subject: below --
2017-11-21 9:32 [PATCH 0/4] *** fix memory leak for HUGE PAGE *** Roger He
[not found] ` <1511256742-5601-1-git-send-email-Hongbo.He-5C7GfCeVMHo@public.gmane.org>
2017-11-21 9:32 ` [PATCH 4/4] drm/ttm: free one in huge pool even shrink request less than one element Roger He
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=1511329016-552-4-git-send-email-Hongbo.He@amd.com \
--to=hongbo.he-5c7gfcevmho@public.gmane.org \
--cc=Christian.Koenig-5C7GfCeVMHo@public.gmane.org \
--cc=amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
--cc=dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.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