Re: [PATCH] drm/ttm: swap consecutive allocated pooled pages v4

2017-12-06 Thread kbuild test robot
Hi Christian,

I love your patch! Yet something to improve:

[auto build test ERROR on drm/drm-next]
[also build test ERROR on v4.15-rc2 next-20171206]
[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/Christian-K-nig/drm-ttm-swap-consecutive-allocated-pooled-pages-v4/20171206-191635
base:   git://people.freedesktop.org/~airlied/linux.git drm-next
config: i386-randconfig-x014-201749 (attached as .config)
compiler: gcc-7 (Debian 7.2.0-12) 7.2.1 20171025
reproduce:
# save the attached .config to linux build tree
make ARCH=i386 

All errors (new ones prefixed by >>):

   drivers/gpu//drm/ttm/ttm_page_alloc.c: In function 'ttm_get_pages':
>> drivers/gpu//drm/ttm/ttm_page_alloc.c:924:2: error: 'first' undeclared 
>> (first use in this function)
 first = count;
 ^
   drivers/gpu//drm/ttm/ttm_page_alloc.c:924:2: note: each undeclared 
identifier is reported only once for each function it appears in

vim +/first +924 drivers/gpu//drm/ttm/ttm_page_alloc.c

   919  
   920  INIT_LIST_HEAD();
   921  r = ttm_page_pool_get_pages(pool, , flags, cstate,
   922  npages - count, 0);
   923  
 > 924  first = count;
   925  list_for_each_entry(p, , lru) {
   926  struct page *tmp = p;
   927  
   928  /* Swap the pages if we detect consecutive order */
   929  if (count > first && pages[count - 1] == tmp - 1)
   930  swap(tmp, pages[count - 1]);
   931  pages[count++] = tmp;
   932  }
   933  
   934  if (r) {
   935  /* If there is any pages in the list put them back to
   936   * the pool.
   937   */
   938  pr_debug("Failed to allocate extra pages for large 
request\n");
   939  ttm_put_pages(pages, count, flags, cstate);
   940  return r;
   941  }
   942  
   943  return 0;
   944  }
   945  

---
0-DAY kernel test infrastructureOpen Source Technology Center
https://lists.01.org/pipermail/kbuild-all   Intel Corporation


.config.gz
Description: application/gzip
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH] drm/ttm: swap consecutive allocated pooled pages v4

2017-12-06 Thread Dieter Nützel

Tested-by: Dieter Nützel 

Dieter

Am 05.12.2017 13:54, schrieb Christian König:

When we detect consecutive allocation of pages swap them to avoid
accidentally freeing them as huge page.

v2: use swap
v3: check if it's really the first allocated page
v4: don't touch the loop variable

Signed-off-by: Christian König 
---
 drivers/gpu/drm/ttm/ttm_page_alloc.c | 11 +--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/ttm/ttm_page_alloc.c
b/drivers/gpu/drm/ttm/ttm_page_alloc.c
index b6f7ce286fb1..44343a2bf55c 100644
--- a/drivers/gpu/drm/ttm/ttm_page_alloc.c
+++ b/drivers/gpu/drm/ttm/ttm_page_alloc.c
@@ -958,8 +958,15 @@ static int ttm_get_pages(struct page **pages,
unsigned npages, int flags,
r = ttm_page_pool_get_pages(pool, , flags, cstate,
npages - count, 0);

-   list_for_each_entry(p, , lru)
-   pages[count++] = p;
+   first = count;
+   list_for_each_entry(p, , lru) {
+   struct page *tmp = p;
+
+   /* Swap the pages if we detect consecutive order */
+   if (count > first && pages[count - 1] == tmp - 1)
+   swap(tmp, pages[count - 1]);
+   pages[count++] = tmp;
+   }

if (r) {
/* If there is any pages in the list put them back to

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


RE: [PATCH] drm/ttm: swap consecutive allocated pooled pages v4

2017-12-05 Thread He, Roger
Reviewed-by: Roger He 

Thanks
Roger(Hongbo.He)
-Original Message-
From: Christian König [mailto:ckoenig.leichtzumer...@gmail.com] 
Sent: Tuesday, December 05, 2017 8:55 PM
To: dri-devel@lists.freedesktop.org; amd-...@lists.freedesktop.org; He, Roger 

Subject: [PATCH] drm/ttm: swap consecutive allocated pooled pages v4

When we detect consecutive allocation of pages swap them to avoid accidentally 
freeing them as huge page.

v2: use swap
v3: check if it's really the first allocated page
v4: don't touch the loop variable

Signed-off-by: Christian König 
---
 drivers/gpu/drm/ttm/ttm_page_alloc.c | 11 +--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/ttm/ttm_page_alloc.c 
b/drivers/gpu/drm/ttm/ttm_page_alloc.c
index b6f7ce286fb1..44343a2bf55c 100644
--- a/drivers/gpu/drm/ttm/ttm_page_alloc.c
+++ b/drivers/gpu/drm/ttm/ttm_page_alloc.c
@@ -958,8 +958,15 @@ static int ttm_get_pages(struct page **pages, unsigned 
npages, int flags,
r = ttm_page_pool_get_pages(pool, , flags, cstate,
npages - count, 0);
 
-   list_for_each_entry(p, , lru)
-   pages[count++] = p;
+   first = count;
+   list_for_each_entry(p, , lru) {
+   struct page *tmp = p;
+
+   /* Swap the pages if we detect consecutive order */
+   if (count > first && pages[count - 1] == tmp - 1)
+   swap(tmp, pages[count - 1]);
+   pages[count++] = tmp;
+   }
 
if (r) {
/* If there is any pages in the list put them back to
--
2.11.0

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


Re: [PATCH] drm/ttm: swap consecutive allocated pooled pages v4

2017-12-05 Thread Michel Dänzer
On 2017-12-05 01:54 PM, Christian König wrote:
> When we detect consecutive allocation of pages swap them to avoid
> accidentally freeing them as huge page.
> 
> v2: use swap
> v3: check if it's really the first allocated page
> v4: don't touch the loop variable
> 
> Signed-off-by: Christian König 
> ---
>  drivers/gpu/drm/ttm/ttm_page_alloc.c | 11 +--
>  1 file changed, 9 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/ttm/ttm_page_alloc.c 
> b/drivers/gpu/drm/ttm/ttm_page_alloc.c
> index b6f7ce286fb1..44343a2bf55c 100644
> --- a/drivers/gpu/drm/ttm/ttm_page_alloc.c
> +++ b/drivers/gpu/drm/ttm/ttm_page_alloc.c
> @@ -958,8 +958,15 @@ static int ttm_get_pages(struct page **pages, unsigned 
> npages, int flags,
>   r = ttm_page_pool_get_pages(pool, , flags, cstate,
>   npages - count, 0);
>  
> - list_for_each_entry(p, , lru)
> - pages[count++] = p;
> + first = count;
> + list_for_each_entry(p, , lru) {
> + struct page *tmp = p;
> +
> + /* Swap the pages if we detect consecutive order */
> + if (count > first && pages[count - 1] == tmp - 1)
> + swap(tmp, pages[count - 1]);
> + pages[count++] = tmp;
> + }
>  
>   if (r) {
>   /* If there is any pages in the list put them back to
> 

Reviewed-by: Michel Dänzer 


-- 
Earthling Michel Dänzer   |   http://www.amd.com
Libre software enthusiast | Mesa and X developer
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel