*** fix memory leak for HUGE PAGE ***
Subsystems (3)
cover *** fix memory leak for HUGE PAGE ***
1. add page order into pool to support gtt huge page
2. add page order support when ttm pages put
3. update memory shrinker with order handling
Roger He (4):
drm/ttm: add page order in page pool
drm/ttm: use NUM_PAGES_TO_ALLOC always
drm/ttm: add page order support in ttm_pages_put drm/ttm: free one in huge pool even shrink request less than one
element
drivers/gpu/drm/ttm/ttm_page_alloc.c | 80 ++++++++++++++++++++++++++---------- 1 file changed, 59 insertions(+), 21 deletions(-)
Signature · 6 lines
2.7.4 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 1/4 drm/ttm: add page order in page pool
to indicate page order for each element in the pool
--- drivers/gpu/drm/ttm/ttm_page_alloc.c | 33 ++++++++++++++++++++++----------- 1 file changed, 22 insertions(+), 11 deletions(-)
drivers/gpu/drm/ttm/ttm_page_alloc.c +22 -11
@@ -81,6 +81,7 @@ struct ttm_page_pool {char *name;unsigned long nfrees;unsigned long nrefills; +unsigned int order; };/**
@@ -412,6 +413,7 @@ ttm_pool_shrink_scan(struct shrinker *shrink, struct shrink_control *sc)struct ttm_page_pool *pool;int shrink_pages = sc->nr_to_scan;unsigned long freed =0 ; +unsigned int nr_free_pool;if (!mutex_trylock (&lock))return SHRINK_STOP ;
@@ -421,10 +423,15 @@ ttm_pool_shrink_scan(struct shrinker *shrink, struct shrink_control *sc)unsigned nr_free = shrink_pages;if (shrink_pages ==0 )break ; + pool = &_manager->pools[(i + pool_offset)%NUM_POOLS ];/* OK to use static buffer since global mutex is held. */ - shrink_pages =ttm_page_pool_free (pool, nr_free, true); - freed += nr_free - shrink_pages; + nr_free_pool = (nr_free >> pool->order); +if (nr_free_pool ==0 ) +continue ; + + shrink_pages =ttm_page_pool_free (pool, nr_free_pool, true); + freed += ((nr_free_pool - shrink_pages) << pool->order); }mutex_unlock (&lock);return freed;
@@ -436,9 +443,12 @@ ttm_pool_shrink_count(struct shrinker *shrink, struct shrink_control *sc) {unsigned i;unsigned long count =0 ; +struct ttm_page_pool *pool; -for (i =0 ; i <NUM_POOLS ; ++i) - count += _manager->pools[i].npages; +for (i =0 ; i <NUM_POOLS ; ++i) { + pool = &_manager->pools[i]; + count += (pool->npages << pool->order); + }return count; }
@@ -933,7 +943,7 @@ static int ttm_get_pages(struct page **pages, unsigned npages, int flags, }static void ttm_page_pool_init_locked (struct ttm_page_pool *pool,gfp_t flags, -char *name) +char *name,unsigned int order) {spin_lock_init (&pool->lock); pool->fill_lock = false;
@@ -941,6 +951,7 @@ static void ttm_page_pool_init_locked(struct ttm_page_pool *pool, gfp_t flags, pool->npages = pool->nfrees =0 ; pool->gfp_flags = flags; pool->name = name; + pool->order = order; }int ttm_page_alloc_init (struct ttm_mem_global *glob,unsigned max_pages)
@@ -953,23 +964,23 @@ int ttm_page_alloc_init(struct ttm_mem_global *glob, unsigned max_pages) _manager =kzalloc (sizeof (*_manager),GFP_KERNEL ); -ttm_page_pool_init_locked (&_manager->wc_pool,GFP_HIGHUSER ,"wc" ); +ttm_page_pool_init_locked (&_manager->wc_pool,GFP_HIGHUSER ,"wc" ,0 ); -ttm_page_pool_init_locked (&_manager->uc_pool,GFP_HIGHUSER ,"uc" ); +ttm_page_pool_init_locked (&_manager->uc_pool,GFP_HIGHUSER ,"uc" ,0 );ttm_page_pool_init_locked (&_manager->wc_pool_dma32, -GFP_USER |GFP_DMA32 ,"wc dma" ); +GFP_USER |GFP_DMA32 ,"wc dma" ,0 );ttm_page_pool_init_locked (&_manager->uc_pool_dma32, -GFP_USER |GFP_DMA32 ,"uc dma" ); +GFP_USER |GFP_DMA32 ,"uc dma" ,0 );ttm_page_pool_init_locked (&_manager->wc_pool_huge,GFP_TRANSHUGE & ~(__GFP_MOVABLE | __GFP_COMP), -"wc huge" ); +"wc huge" ,HPAGE_PMD_ORDER );ttm_page_pool_init_locked (&_manager->uc_pool_huge,GFP_TRANSHUGE & ~(__GFP_MOVABLE | __GFP_COMP) - ,"uc huge" ); + ,"uc huge" ,HPAGE_PMD_ORDER ); _manager->options.max_size = max_pages; _manager->options.small =SMALL_ALLOCATION ;
Signature · 6 lines
2.7.4 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 2/4 drm/ttm: use NUM_PAGES_TO_ALLOC always
In reply to Roger He--- drivers/gpu/drm/ttm/ttm_page_alloc.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/gpu/drm/ttm/ttm_page_alloc.c +1 -2
@@ -520,8 +520,7 @@ static int ttm_alloc_new_pages(struct list_head *pages, gfp_t gfp_flags,int r =0 ;unsigned i, j, cpages;unsigned npages =1 << order; -unsigned max_cpages =min (count, - (unsigned )(PAGE_SIZE /sizeof (struct page *))); +unsigned max_cpages =min (count, (unsigned )NUM_PAGES_TO_ALLOC );/* allocate array for page caching change */ caching_array =kmalloc (max_cpages*sizeof (struct page *),GFP_KERNEL );
Signature · 6 lines
2.7.4 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 3/4 drm/ttm: add page order support in ttm_pages_put
In reply to Roger He--- drivers/gpu/drm/ttm/ttm_page_alloc.c | 42 +++++++++++++++++++++++++++++------- 1 file changed, 34 insertions(+), 8 deletions(-)
drivers/gpu/drm/ttm/ttm_page_alloc.c +34 -8
@@ -285,13 +285,39 @@ 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]); +struct page **pages_to_free =NULL ; +struct page **pages_array =NULL ; +struct page *p =NULL ; +unsigned int i, j, pages_nr =1 << order; + +if (order >0 ) { + pages_to_free =kmalloc_array (pages_nr,sizeof (struct page *), +GFP_KERNEL ); +if (!pages_to_free) { +pr_err ("Failed to allocate memory for ttm pages put operation\n" ); +return ; + } + } + +for (i =0 ; i < npages; ++i) { +if (order) { + p = pages[i]; +for (j =0 ; j < pages_nr; ++j) + pages_to_free[j] = p++; + + pages_array = pages_to_free; + }else + pages_array = pages; + +if (set_pages_array_wb (pages_array, pages_nr)) +pr_err ("Failed to set %d pages to wb!\n" , pages_nr); +__free_pages (pages[i], order); + } + +kfree (pages_to_free); } static void ttm_pool_update_free_locked(struct ttm_page_pool *pool,
@@ -354,7 +380,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;
@@ -389,7 +415,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 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 4/4 drm/ttm: free one in huge pool even shrink request less than one element
In reply to a message not in the archive--- drivers/gpu/drm/ttm/ttm_page_alloc.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/gpu/drm/ttm/ttm_page_alloc.c +4 -2
@@ -453,11 +453,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;
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Christian König
Reviewed-byRe: [PATCH 2/4] drm/ttm: use NUM_PAGES_TO_ALLOC always
In reply to a message not in the archiveAm 21.11.2017 um 10:32 schrieb Roger He:
Quoted 2 lines
Change-Id Ide96a1ccad9bb44b0bb0d80e123c2d810ba618edSigned-off-by Roger He <[email protected]>
Quoted 9 lines
--- drivers/gpu/drm/ttm/ttm_page_alloc.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)drivers/gpu/drm/ttm/ttm_page_alloc.c +0
-0
drivers/gpu/drm/ttm/ttm_page_alloc.c static int ttm_alloc_new_pages(struct list_head *pages, gfp_t gfp_flags, · line 526
Quoted 9 lines
drivers/gpu/drm/ttm/ttm_page_alloc.c +1
-2@@ -520,8 +520,7 @@ static int ttm_alloc_new_pages(struct list_head *pages, gfp_t gfp_flags,int r =0 ;unsigned i, j, cpages;unsigned npages =1 << order; -unsigned max_cpages =min (count, - (unsigned )(PAGE_SIZE /sizeof (struct page *))); +unsigned max_cpages =min (count, (unsigned )NUM_PAGES_TO_ALLOC );/* allocate array for page caching change */ caching_array =kmalloc (max_cpages*sizeof (struct page *),GFP_KERNEL );
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Re: [PATCH 3/4] drm/ttm: add page order support in ttm_pages_put
In reply to a message not in the archiveAm 21.11.2017 um 10:32 schrieb Roger He:
Quoted 21 lines
Change-Id Ia55b206d95812c5afcfd6cec29f580758d1f50f0Signed-off-by Roger He <[email protected]>--- drivers/gpu/drm/ttm/ttm_page_alloc.c | 42 +++++++++++++++++++++++++++++------- 1 file changed, 34 insertions(+), 8 deletions(-)drivers/gpu/drm/ttm/ttm_page_alloc.c +2
-4@@ -285,13 +285,39 @@ 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);
drivers/gpu/drm/ttm/ttm_page_alloc.c static struct ttm_page_pool *ttm_get_pool(int flags, bool huge, · line 298
Quoted 10 lines
drivers/gpu/drm/ttm/ttm_page_alloc.c +8
-2-for (i =0 ; i < npages; ++i) -__free_page (pages[i]); +struct page **pages_to_free =NULL ; +struct page **pages_array =NULL ; +struct page *p =NULL ; +unsigned int i, j, pages_nr =1 << order; + +if (order >0 ) { + pages_to_free =kmalloc_array (pages_nr,sizeof (struct page *), +GFP_KERNEL );
We can't call kmalloc here, when this function is called by the shrinker we are tight on memory anyway.
That's also the reason we have this static buffer dance in ttm_page_pool_free() as well.
Christian.
Quoted 35 lines
drivers/gpu/drm/ttm/ttm_page_alloc.c +23
-1+if (!pages_to_free) { +pr_err ("Failed to allocate memory for ttm pages put operation\n" ); +return ; + } + } + +for (i =0 ; i < npages; ++i) { +if (order) { + p = pages[i]; +for (j =0 ; j < pages_nr; ++j) + pages_to_free[j] = p++; + + pages_array = pages_to_free; + }else + pages_array = pages; + +if (set_pages_array_wb (pages_array, pages_nr)) +pr_err ("Failed to set %d pages to wb!\n" , pages_nr); +__free_pages (pages[i], order); + } + +kfree (pages_to_free); } static void ttm_pool_update_free_locked(struct ttm_page_pool *pool,@@ -354,7 +380,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;
drivers/gpu/drm/ttm/ttm_page_alloc.c static int ttm_page_pool_free(struct ttm_page_pool *pool, unsigned nr_free, · line 421
Quoted 8 lines
drivers/gpu/drm/ttm/ttm_page_alloc.c +1
-1@@ -389,7 +415,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);
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Re: [PATCH 1/4] drm/ttm: add page order in page pool
In reply to Roger HeAm 21.11.2017 um 10:32 schrieb Roger He:
Quoted 95 lines
to indicate page order for each element in the pool
Change-Id Ic609925ca5d2a5d4ad49d6becf505388ce3624cfSigned-off-by Roger He <[email protected]>--- drivers/gpu/drm/ttm/ttm_page_alloc.c | 33 ++++++++++++++++++++++----------- 1 file changed, 22 insertions(+), 11 deletions(-)drivers/gpu/drm/ttm/ttm_page_alloc.c +20
-9@@ -81,6 +81,7 @@ struct ttm_page_pool {char *name;unsigned long nfrees;unsigned long nrefills; +unsigned int order; };/** @@ -412,6 +413,7 @@ ttm_pool_shrink_scan(struct shrinker *shrink, struct shrink_control *sc)struct ttm_page_pool *pool;int shrink_pages = sc->nr_to_scan;unsigned long freed =0 ; +unsigned int nr_free_pool;if (!mutex_trylock (&lock))return SHRINK_STOP ;@@ -421,10 +423,15 @@ ttm_pool_shrink_scan(struct shrinker *shrink, struct shrink_control *sc)unsigned nr_free = shrink_pages;if (shrink_pages ==0 )break ; + pool = &_manager->pools[(i + pool_offset)%NUM_POOLS ];/* OK to use static buffer since global mutex is held. */ - shrink_pages =ttm_page_pool_free (pool, nr_free, true); - freed += nr_free - shrink_pages; + nr_free_pool = (nr_free >> pool->order); +if (nr_free_pool ==0 ) +continue ; + + shrink_pages =ttm_page_pool_free (pool, nr_free_pool, true); + freed += ((nr_free_pool - shrink_pages) << pool->order); }mutex_unlock (&lock);return freed;@@ -436,9 +443,12 @@ ttm_pool_shrink_count(struct shrinker *shrink, struct shrink_control *sc) {unsigned i;unsigned long count =0 ; +struct ttm_page_pool *pool; -for (i =0 ; i <NUM_POOLS ; ++i) - count += _manager->pools[i].npages; +for (i =0 ; i <NUM_POOLS ; ++i) { + pool = &_manager->pools[i]; + count += (pool->npages << pool->order); + }return count; }@@ -933,7 +943,7 @@ static int ttm_get_pages(struct page **pages, unsigned npages, int flags, }static void ttm_page_pool_init_locked (struct ttm_page_pool *pool,gfp_t flags, -char *name) +char *name,unsigned int order) {spin_lock_init (&pool->lock); pool->fill_lock = false;@@ -941,6 +951,7 @@ static void ttm_page_pool_init_locked(struct ttm_page_pool *pool, gfp_t flags, pool->npages = pool->nfrees =0 ; pool->gfp_flags = flags; pool->name = name; + pool->order = order; }int ttm_page_alloc_init (struct ttm_mem_global *glob,unsigned max_pages)@@ -953,23 +964,23 @@ int ttm_page_alloc_init(struct ttm_mem_global *glob, unsigned max_pages) _manager =kzalloc (sizeof (*_manager),GFP_KERNEL ); -ttm_page_pool_init_locked (&_manager->wc_pool,GFP_HIGHUSER ,"wc" ); +ttm_page_pool_init_locked (&_manager->wc_pool,GFP_HIGHUSER ,"wc" ,0 ); -ttm_page_pool_init_locked (&_manager->uc_pool,GFP_HIGHUSER ,"uc" ); +ttm_page_pool_init_locked (&_manager->uc_pool,GFP_HIGHUSER ,"uc" ,0 );ttm_page_pool_init_locked (&_manager->wc_pool_dma32, -GFP_USER |GFP_DMA32 ,"wc dma" ); +GFP_USER |GFP_DMA32 ,"wc dma" ,0 );ttm_page_pool_init_locked (&_manager->uc_pool_dma32, -GFP_USER |GFP_DMA32 ,"uc dma" ); +GFP_USER |GFP_DMA32 ,"uc dma" ,0 );
drivers/gpu/drm/ttm/ttm_page_alloc.c int ttm_page_alloc_init(struct ttm_mem_global *glob, unsigned max_pages) · line 983
Quoted 10 lines
drivers/gpu/drm/ttm/ttm_page_alloc.c +2
-2ttm_page_pool_init_locked (&_manager->wc_pool_huge,GFP_TRANSHUGE & ~(__GFP_MOVABLE | __GFP_COMP), -"wc huge" ); +"wc huge" ,HPAGE_PMD_ORDER );ttm_page_pool_init_locked (&_manager->uc_pool_huge,GFP_TRANSHUGE & ~(__GFP_MOVABLE | __GFP_COMP) - ,"uc huge" ); + ,"uc huge" ,HPAGE_PMD_ORDER );
HPAGE_PMD_ORDER isn't defined when huge page support isn't enabled.
That's why I avoided using this here.
Christian.
drivers/gpu/drm/ttm/ttm_page_alloc.c int ttm_page_alloc_init(struct ttm_mem_global *glob, unsigned max_pages) · line 986
Quoted 3 lines
drivers/gpu/drm/ttm/ttm_page_alloc.c +0
-0_manager->options.max_size = max_pages; _manager->options.small =SMALL_ALLOCATION ;
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
kbuild test robot
build botRe: [PATCH 1/4] drm/ttm: add page order in page pool
In reply to a message not in the archiveThank you for the patch! Yet something to improve:
Hi Roger,
Thank you for the patch! Yet something to improve:
[auto build test ERROR on drm/drm-next]
[also build test ERROR on next-20171122]
[cannot apply to v4.14]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
url: https://github.com/0day-ci/linux/commits/Roger-He/drm-ttm-add-page-order-in-page-pool/20171124-032341 base: git://people.freedesktop.org/~airlied/linux.git drm-next config: x86_64-randconfig-x007-201747 (attached as .config) compiler: gcc-6 (Debian 6.4.0-9) 6.4.0 20171026 reproduce: # save the attached .config to linux build tree make ARCH=x86_64
All error/warnings (new ones prefixed by >>):
In file included from include/uapi/linux/stddef.h:1:0,
from include/linux/stddef.h:4,
from include/uapi/linux/posix_types.h:4, from include/uapi/linux/types.h:13,
from include/linux/types.h:5,
from include/linux/list.h:4,
from drivers/gpu/drm/ttm/ttm_page_alloc.c:36:
drivers/gpu/drm/ttm/ttm_page_alloc.c: In function 'ttm_page_alloc_init':
>> include/linux/compiler.h:576:38: error: call to '__compiletime_assert_979' declared with attribute error: BUILD_BUG failed
_compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
^
include/linux/compiler.h:556:4: note: in definition of macro '__compiletime_assert'
prefix ## suffix(); \
^~~~~~
include/linux/compiler.h:576:2: note: in expansion of macro '_compiletime_assert'
_compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
^~~~~~~~~~~~~~~~~~~
include/linux/build_bug.h:46:37: note: in expansion of macro 'compiletime_assert'
#define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
^~~~~~~~~~~~~~~~~~
include/linux/build_bug.h:80:21: note: in expansion of macro 'BUILD_BUG_ON_MSG'
#define BUILD_BUG() BUILD_BUG_ON_MSG(1, "BUILD_BUG failed")
^~~~~~~~~~~~~~~~
include/linux/huge_mm.h:248:28: note: in expansion of macro 'BUILD_BUG'
#define HPAGE_PMD_SHIFT ({ BUILD_BUG(); 0; })
^~~~~~~~~
include/linux/huge_mm.h:78:26: note: in expansion of macro 'HPAGE_PMD_SHIFT'
#define HPAGE_PMD_ORDER (HPAGE_PMD_SHIFT-PAGE_SHIFT)
^~~~~~~~~~~~~~~
>> drivers/gpu/drm/ttm/ttm_page_alloc.c:979:18: note: in expansion of macro 'HPAGE_PMD_ORDER'
"wc huge", HPAGE_PMD_ORDER);
^~~~~~~~~~~~~~~
include/linux/compiler.h:576:38: error: call to '__compiletime_assert_983' declared with attribute error: BUILD_BUG failed
_compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
^
include/linux/compiler.h:556:4: note: in definition of macro '__compiletime_assert'
prefix ## suffix(); \
^~~~~~
include/linux/compiler.h:576:2: note: in expansion of macro '_compiletime_assert'
_compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
^~~~~~~~~~~~~~~~~~~
include/linux/build_bug.h:46:37: note: in expansion of macro 'compiletime_assert'
#define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
^~~~~~~~~~~~~~~~~~
include/linux/build_bug.h:80:21: note: in expansion of macro 'BUILD_BUG_ON_MSG'
#define BUILD_BUG() BUILD_BUG_ON_MSG(1, "BUILD_BUG failed")
^~~~~~~~~~~~~~~~
include/linux/huge_mm.h:248:28: note: in expansion of macro 'BUILD_BUG'
#define HPAGE_PMD_SHIFT ({ BUILD_BUG(); 0; })
^~~~~~~~~
include/linux/huge_mm.h:78:26: note: in expansion of macro 'HPAGE_PMD_SHIFT'
#define HPAGE_PMD_ORDER (HPAGE_PMD_SHIFT-PAGE_SHIFT)
^~~~~~~~~~~~~~~
drivers/gpu/drm/ttm/ttm_page_alloc.c:983:20: note: in expansion of macro 'HPAGE_PMD_ORDER'
, "uc huge", HPAGE_PMD_ORDER);
^~~~~~~~~~~~~~~
--
In file included from include/uapi/linux/stddef.h:1:0,
from include/linux/stddef.h:4,
from include/uapi/linux/posix_types.h:4,
from include/uapi/linux/types.h:13,
from include/linux/types.h:5,
from include/linux/list.h:4,
from drivers/gpu//drm/ttm/ttm_page_alloc.c:36:
drivers/gpu//drm/ttm/ttm_page_alloc.c: In function 'ttm_page_alloc_init':
>> include/linux/compiler.h:576:38: error: call to '__compiletime_assert_979' declared with attribute error: BUILD_BUG failed
_compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
^
include/linux/compiler.h:556:4: note: in definition of macro '__compiletime_assert'
prefix ## suffix(); \
^~~~~~
include/linux/compiler.h:576:2: note: in expansion of macro '_compiletime_assert'
_compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
^~~~~~~~~~~~~~~~~~~
include/linux/build_bug.h:46:37: note: in expansion of macro 'compiletime_assert'
#define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
^~~~~~~~~~~~~~~~~~
include/linux/build_bug.h:80:21: note: in expansion of macro 'BUILD_BUG_ON_MSG'
#define BUILD_BUG() BUILD_BUG_ON_MSG(1, "BUILD_BUG failed")
^~~~~~~~~~~~~~~~
include/linux/huge_mm.h:248:28: note: in expansion of macro 'BUILD_BUG'
#define HPAGE_PMD_SHIFT ({ BUILD_BUG(); 0; })
^~~~~~~~~
include/linux/huge_mm.h:78:26: note: in expansion of macro 'HPAGE_PMD_SHIFT'
#define HPAGE_PMD_ORDER (HPAGE_PMD_SHIFT-PAGE_SHIFT)
^~~~~~~~~~~~~~~
drivers/gpu//drm/ttm/ttm_page_alloc.c:979:18: note: in expansion of macro 'HPAGE_PMD_ORDER'
"wc huge", HPAGE_PMD_ORDER);
^~~~~~~~~~~~~~~
include/linux/compiler.h:576:38: error: call to '__compiletime_assert_983' declared with attribute error: BUILD_BUG failed
_compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
^
include/linux/compiler.h:556:4: note: in definition of macro '__compiletime_assert'
prefix ## suffix(); \
^~~~~~
include/linux/compiler.h:576:2: note: in expansion of macro '_compiletime_assert'
_compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
^~~~~~~~~~~~~~~~~~~
include/linux/build_bug.h:46:37: note: in expansion of macro 'compiletime_assert'
#define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
^~~~~~~~~~~~~~~~~~
include/linux/build_bug.h:80:21: note: in expansion of macro 'BUILD_BUG_ON_MSG'
#define BUILD_BUG() BUILD_BUG_ON_MSG(1, "BUILD_BUG failed")
^~~~~~~~~~~~~~~~
include/linux/huge_mm.h:248:28: note: in expansion of macro 'BUILD_BUG'
#define HPAGE_PMD_SHIFT ({ BUILD_BUG(); 0; })
^~~~~~~~~
include/linux/huge_mm.h:78:26: note: in expansion of macro 'HPAGE_PMD_SHIFT'
#define HPAGE_PMD_ORDER (HPAGE_PMD_SHIFT-PAGE_SHIFT)
^~~~~~~~~~~~~~~
drivers/gpu//drm/ttm/ttm_page_alloc.c:983:20: note: in expansion of macro 'HPAGE_PMD_ORDER'
, "uc huge", HPAGE_PMD_ORDER);
^~~~~~~~~~~~~~~vim +/HPAGE_PMD_ORDER +979 drivers/gpu/drm/ttm/ttm_page_alloc.c
956
957 int ttm_page_alloc_init(struct ttm_mem_global *glob, unsigned max_pages)
958 {
959 int ret;
960
961 WARN_ON(_manager);
962
963 pr_info("Initializing pool allocator\n");
964
965 _manager = kzalloc(sizeof(*_manager), GFP_KERNEL);
966
967 ttm_page_pool_init_locked(&_manager->wc_pool, GFP_HIGHUSER, "wc", 0);
968
969 ttm_page_pool_init_locked(&_manager->uc_pool, GFP_HIGHUSER, "uc", 0);
970
971 ttm_page_pool_init_locked(&_manager->wc_pool_dma32,
972 GFP_USER | GFP_DMA32, "wc dma", 0);
973
974 ttm_page_pool_init_locked(&_manager->uc_pool_dma32,
975 GFP_USER | GFP_DMA32, "uc dma", 0);
976
977 ttm_page_pool_init_locked(&_manager->wc_pool_huge,
978 GFP_TRANSHUGE & ~(__GFP_MOVABLE | __GFP_COMP),
> 979 "wc huge", HPAGE_PMD_ORDER);
980
981 ttm_page_pool_init_locked(&_manager->uc_pool_huge,
982 GFP_TRANSHUGE & ~(__GFP_MOVABLE | __GFP_COMP)
983 , "uc huge", HPAGE_PMD_ORDER);
984
985 _manager->options.max_size = max_pages;
986 _manager->options.small = SMALL_ALLOCATION;
987 _manager->options.alloc_size = NUM_PAGES_TO_ALLOC;
988
989 ret = kobject_init_and_add(&_manager->kobj, &ttm_pool_kobj_type,
990 &glob->kobj, "pool");
991 if (unlikely(ret != 0)) {
992 kobject_put(&_manager->kobj);
993 _manager = NULL;
994 return ret;
995 }
996
997 ttm_pool_mm_shrink_init(_manager);
998
999 return 0;
1000 }
1001
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
kbuild test robot
build botRe: [PATCH 1/4] drm/ttm: add page order in page pool
In reply to Roger HeThank you for the patch! Yet something to improve:
Hi Roger,
Thank you for the patch! Yet something to improve:
[auto build test ERROR on drm/drm-next]
[also build test ERROR on next-20171122]
[cannot apply to v4.14]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
url: https://github.com/0day-ci/linux/commits/Roger-He/drm-ttm-add-page-order-in-page-pool/20171124-032341 base: git://people.freedesktop.org/~airlied/linux.git drm-next config: tile-allmodconfig (attached as .config) compiler: tilegx-linux-gcc (GCC) 4.6.2
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=tile
All errors (new ones prefixed by >>):
drivers/gpu//drm/ttm/ttm_page_alloc.c: In function 'ttm_page_alloc_init':
>> drivers/gpu//drm/ttm/ttm_page_alloc.c:979:18: error: call to '__compiletime_assert_979' declared with attribute error: BUILD_BUG failed
drivers/gpu//drm/ttm/ttm_page_alloc.c:983:20: error: call to '__compiletime_assert_983' declared with attribute error: BUILD_BUG failed
vim +/__compiletime_assert_979 +979 drivers/gpu//drm/ttm/ttm_page_alloc.c
956
957 int ttm_page_alloc_init(struct ttm_mem_global *glob, unsigned max_pages)
958 {
959 int ret;
960
961 WARN_ON(_manager);
962
963 pr_info("Initializing pool allocator\n");
964
965 _manager = kzalloc(sizeof(*_manager), GFP_KERNEL);
966
967 ttm_page_pool_init_locked(&_manager->wc_pool, GFP_HIGHUSER, "wc", 0);
968
969 ttm_page_pool_init_locked(&_manager->uc_pool, GFP_HIGHUSER, "uc", 0);
970
971 ttm_page_pool_init_locked(&_manager->wc_pool_dma32,
972 GFP_USER | GFP_DMA32, "wc dma", 0);
973
974 ttm_page_pool_init_locked(&_manager->uc_pool_dma32,
975 GFP_USER | GFP_DMA32, "uc dma", 0);
976
977 ttm_page_pool_init_locked(&_manager->wc_pool_huge,
978 GFP_TRANSHUGE & ~(__GFP_MOVABLE | __GFP_COMP),
> 979 "wc huge", HPAGE_PMD_ORDER);
980
981 ttm_page_pool_init_locked(&_manager->uc_pool_huge,
982 GFP_TRANSHUGE & ~(__GFP_MOVABLE | __GFP_COMP)
983 , "uc huge", HPAGE_PMD_ORDER);
984
985 _manager->options.max_size = max_pages;
986 _manager->options.small = SMALL_ALLOCATION;
987 _manager->options.alloc_size = NUM_PAGES_TO_ALLOC;
988
989 ret = kobject_init_and_add(&_manager->kobj, &ttm_pool_kobj_type,
990 &glob->kobj, "pool");
991 if (unlikely(ret != 0)) {
992 kobject_put(&_manager->kobj);
993 _manager = NULL;
994 return ret;
995 }
996
997 ttm_pool_mm_shrink_init(_manager);
998
999 return 0;
1000 }
1001
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel