drm/ttm: add set_pages_wb for handling page order more than zero
Subsystems (3)
PATCH 1/3 drm/ttm: add set_pages_wb for handling page order more than zero
--- drivers/gpu/drm/ttm/ttm_page_alloc.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
drivers/gpu/drm/ttm/ttm_page_alloc.c +11 -0
@@ -223,6 +223,17 @@ static struct kobj_type ttm_pool_kobj_type = {static struct ttm_pool_manager *_manager;#ifndef CONFIG_X86 +static int set_pages_wb (struct page *page,int numpages) +{ +#if IS_ENABLED (CONFIG_AGP ) +int i; + +for (i =0 ; i < numpages; i++) +unmap_page_from_agp (page++); +#endif +return 0 ; +} +static int set_pages_array_wb (struct page **pages,int addrinarray) {#if IS_ENABLED (CONFIG_AGP )
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): 1511351069-4757-1-git-send-email-Hongbo.He-5C7GfCeVMHo@public.gmane.org
PATCH 2/3 drm/ttm: add page order support in ttm_pages_put
--- drivers/gpu/drm/ttm/ttm_page_alloc.c | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-)
drivers/gpu/drm/ttm/ttm_page_alloc.c +18 -8
@@ -296,13 +296,23 @@ static struct ttm_page_pool *ttm_get_pool(int flags, bool huge, }/* set memory back to wb and free the pages. */ -static void ttm_pages_put (struct page *pages[],unsigned npages) +static void ttm_pages_put (struct page *pages[],unsigned npages, +unsigned int order) { -unsigned i; -if (set_pages_array_wb (pages, npages)) -pr_err ("Failed to set %d pages to wb!\n" , npages); -for (i =0 ; i < npages; ++i) -__free_page (pages[i]); +unsigned int i, pages_nr = (1 << order); + +if (order ==0 ) { +if (set_pages_array_wb (pages, npages)) +pr_err ("Failed to set %d pages to wb!\n" , npages); + } + +for (i =0 ; i < npages; ++i) { +if (order >0 ) { +if (set_pages_wb (pages[i], pages_nr)) +pr_err ("Failed to set %d pages to wb!\n" , pages_nr); + } +__free_pages (pages[i], order); + } } static void ttm_pool_update_free_locked(struct ttm_page_pool *pool,
@@ -365,7 +375,7 @@ static int ttm_page_pool_free(struct ttm_page_pool *pool, unsigned nr_free,*/ spin_unlock_irqrestore (&pool->lock, irq_flags); -ttm_pages_put (pages_to_free, freed_pages); +ttm_pages_put (pages_to_free, freed_pages, pool->order);if (likely (nr_free !=FREE_ALL_PAGES )) nr_free -= freed_pages;
@@ -400,7 +410,7 @@ static int ttm_page_pool_free(struct ttm_page_pool *pool, unsigned nr_free,spin_unlock_irqrestore (&pool->lock, irq_flags);if (freed_pages) -ttm_pages_put (pages_to_free, freed_pages); +ttm_pages_put (pages_to_free, freed_pages, pool->order); out:if (pages_to_free != static_buf)kfree (pages_to_free);
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Quoting Roger He (2017-11-22 11:44:27)
Quoted 16 lines
Change-Id Idf5ccb579d264b343199d8b8344bddeec2c0019fSigned-off-by Roger He <[email protected]>--- drivers/gpu/drm/ttm/ttm_page_alloc.c | 11 +++++++++++ 1 file changed, 11 insertions(+)drivers/gpu/drm/ttm/ttm_page_alloc.c +2
-0@@ -223,6 +223,17 @@ static struct kobj_type ttm_pool_kobj_type = {static struct ttm_pool_manager *_manager;#ifndef CONFIG_X86 +static int set_pages_wb (struct page *page,int numpages) +{
drivers/gpu/drm/ttm/ttm_page_alloc.c static struct kobj_type ttm_pool_kobj_type = { · line 237
Quoted 10 lines
drivers/gpu/drm/ttm/ttm_page_alloc.c +9
-0+#if IS_ENABLED (CONFIG_AGP ) +int i; + +for (i =0 ; i < numpages; i++) +unmap_page_from_agp (page++); +#endif +return 0 ; +} +static int set_pages_array_wb (struct page **pages,int addrinarray)
Both of these are shadowing exports from arch/x86, probably not the wisest choice of names.
-Chris
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Am 22.11.2017 um 12:50 schrieb Chris Wilson:
Quoted 14 lines
Quoting Roger He (2017-11-22 11:44:27)
Quoted 13 lines
Change-Id Idf5ccb579d264b343199d8b8344bddeec2c0019fSigned-off-by Roger He <[email protected]>--- drivers/gpu/drm/ttm/ttm_page_alloc.c | 11 +++++++++++ 1 file changed, 11 insertions(+)drivers/gpu/drm/ttm/ttm_page_alloc.c +0
-0@@ -223,6 +223,17 @@ static struct kobj_type ttm_pool_kobj_type = {static struct ttm_pool_manager *_manager;
Quoted 15 lines
drivers/gpu/drm/ttm/ttm_page_alloc.c static struct kobj_type ttm_pool_kobj_type = { · line 237
Quoted 13 lines
drivers/gpu/drm/ttm/ttm_page_alloc.c +11
-0#ifndef CONFIG_X86 +static int set_pages_wb (struct page *page,int numpages) +{ +#if IS_ENABLED (CONFIG_AGP ) +int i; + +for (i =0 ; i < numpages; i++) +unmap_page_from_agp (page++); +#endif +return 0 ; +} +static int set_pages_array_wb (struct page **pages,int addrinarray)Both of these are shadowing exports from
arch/x86, probably not the wisest choice of names.
That is intended, please note the "#ifndef CONFIG_X86".
Basically TTM provides the same function for other architectures that we have for X86.
Christian.
Quoted 5 lines
-Chris
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 3/3 drm/ttm: roundup the shrink request to prevent skip huge pool
In reply to Roger Hee.g. shrink reqeust is less than 512, the logic will skip huge pool
--- drivers/gpu/drm/ttm/ttm_page_alloc.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-)
drivers/gpu/drm/ttm/ttm_page_alloc.c +7 -5
@@ -442,17 +442,19 @@ ttm_pool_shrink_scan(struct shrinker *shrink, struct shrink_control *sc)/* select start pool in round robin fashion */ for (i =0 ; i <NUM_POOLS ; ++i) {unsigned nr_free = shrink_pages; +unsigned page_nr; +if (shrink_pages ==0 )break ; pool = &_manager->pools[(i + pool_offset)%NUM_POOLS ]; + page_nr = (1 << pool->order);/* OK to use static buffer since global mutex is held. */ - nr_free_pool = (nr_free >> pool->order); -if (nr_free_pool ==0 ) -continue ; - + nr_free_pool =roundup (nr_free, page_nr) >> pool->order; shrink_pages =ttm_page_pool_free (pool, nr_free_pool, true); - freed += ((nr_free_pool - shrink_pages) << pool->order); + freed += (nr_free_pool - shrink_pages) << pool->order; +if (freed >= sc->nr_to_scan) +break ; }mutex_unlock (&lock);return freed;
Signature · 6 lines
2.7.4 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 3/3] drm/ttm: roundup the shrink request to prevent skip huge pool
Quoting Roger He (2017-11-22 11:44:29)
Quoted 1 line
e.g. shrink reqeust is less than 512, the logic will skip huge pool
You should also tell the shrinker that you skipped objects so that it knows to accumulate the request for the next pass. See shrinkctl->nr_scanned.
-Chris
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Am 22.11.2017 um 12:44 schrieb Roger He:
Quoted 2 lines
Change-Id Idf5ccb579d264b343199d8b8344bddeec2c0019fSigned-off-by Roger He <[email protected]>
Quoted 16 lines
--- drivers/gpu/drm/ttm/ttm_page_alloc.c | 11 +++++++++++ 1 file changed, 11 insertions(+)drivers/gpu/drm/ttm/ttm_page_alloc.c +4
-0@@ -223,6 +223,17 @@ static struct kobj_type ttm_pool_kobj_type = {static struct ttm_pool_manager *_manager;#ifndef CONFIG_X86 +static int set_pages_wb (struct page *page,int numpages) +{ +#if IS_ENABLED (CONFIG_AGP ) +int i;
drivers/gpu/drm/ttm/ttm_page_alloc.c static struct kobj_type ttm_pool_kobj_type = { · line 239
Quoted 10 lines
drivers/gpu/drm/ttm/ttm_page_alloc.c +7
-0+ +for (i =0 ; i < numpages; i++) +unmap_page_from_agp (page++); +#endif +return 0 ; +} +static int set_pages_array_wb (struct page **pages,int addrinarray) {#if IS_ENABLED (CONFIG_AGP )
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel