linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] staging: android: ion: fix sys heap pool's gfp_flags
@ 2019-02-01  6:59 Qing Xia
  2019-02-01  7:55 ` Chen Feng
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Qing Xia @ 2019-02-01  6:59 UTC (permalink / raw)
  To: labbott, sumit.semwal, gregkh, arve, tkjos, maco
  Cc: linaro-mm-sig, linux-kernel, dri-devel, devel, daniel.liuyi,
	yudongbin, kongfei, puck.chen

In the first loop, gfp_flags will be modified to high_order_gfp_flags,
and there will be no chance to change back to low_order_gfp_flags.

Fixes: e7f63771 ("ION: Sys_heap: Add cached pool to spead up cached buffer alloc")
Signed-off-by: Qing Xia <saberlily.xia@hisilicon.com>
---
 drivers/staging/android/ion/ion_system_heap.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/android/ion/ion_system_heap.c b/drivers/staging/android/ion/ion_system_heap.c
index 0383f75..20f2103 100644
--- a/drivers/staging/android/ion/ion_system_heap.c
+++ b/drivers/staging/android/ion/ion_system_heap.c
@@ -223,10 +223,10 @@ static void ion_system_heap_destroy_pools(struct ion_page_pool **pools)
 static int ion_system_heap_create_pools(struct ion_page_pool **pools)
 {
 	int i;
-	gfp_t gfp_flags = low_order_gfp_flags;
 
 	for (i = 0; i < NUM_ORDERS; i++) {
 		struct ion_page_pool *pool;
+		gfp_t gfp_flags = low_order_gfp_flags;
 
 		if (orders[i] > 4)
 			gfp_flags = high_order_gfp_flags;
-- 
2.7.3


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] staging: android: ion: fix sys heap pool's gfp_flags
  2019-02-01  6:59 [PATCH] staging: android: ion: fix sys heap pool's gfp_flags Qing Xia
@ 2019-02-01  7:55 ` Chen Feng
  2019-02-01  8:15 ` Dan Carpenter
  2019-02-19 21:18 ` Laura Abbott
  2 siblings, 0 replies; 5+ messages in thread
From: Chen Feng @ 2019-02-01  7:55 UTC (permalink / raw)
  To: Qing Xia, labbott, sumit.semwal, gregkh, arve, tkjos, maco
  Cc: linaro-mm-sig, linux-kernel, dri-devel, devel, daniel.liuyi,
	yudongbin, kongfei

Thanks.

On 2019/2/1 14:59, Qing Xia wrote:
> In the first loop, gfp_flags will be modified to high_order_gfp_flags,
> and there will be no chance to change back to low_order_gfp_flags.
> 
> Fixes: e7f63771 ("ION: Sys_heap: Add cached pool to spead up cached buffer alloc")
> Signed-off-by: Qing Xia <saberlily.xia@hisilicon.com>
> ---
>  drivers/staging/android/ion/ion_system_heap.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/staging/android/ion/ion_system_heap.c b/drivers/staging/android/ion/ion_system_heap.c
> index 0383f75..20f2103 100644
> --- a/drivers/staging/android/ion/ion_system_heap.c
> +++ b/drivers/staging/android/ion/ion_system_heap.c
> @@ -223,10 +223,10 @@ static void ion_system_heap_destroy_pools(struct ion_page_pool **pools)
>  static int ion_system_heap_create_pools(struct ion_page_pool **pools)
>  {
>  	int i;
> -	gfp_t gfp_flags = low_order_gfp_flags;
>  
>  	for (i = 0; i < NUM_ORDERS; i++) {
>  		struct ion_page_pool *pool;
> +		gfp_t gfp_flags = low_order_gfp_flags;
>  
>  		if (orders[i] > 4)
>  			gfp_flags = high_order_gfp_flags;
> 

-- 
Cheers,
- Feng


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] staging: android: ion: fix sys heap pool's gfp_flags
  2019-02-01  6:59 [PATCH] staging: android: ion: fix sys heap pool's gfp_flags Qing Xia
  2019-02-01  7:55 ` Chen Feng
@ 2019-02-01  8:15 ` Dan Carpenter
  2019-02-01  8:30   ` Xiaqing (A)
  2019-02-19 21:18 ` Laura Abbott
  2 siblings, 1 reply; 5+ messages in thread
From: Dan Carpenter @ 2019-02-01  8:15 UTC (permalink / raw)
  To: Qing Xia
  Cc: labbott, sumit.semwal, gregkh, arve, tkjos, maco, devel,
	puck.chen, linux-kernel, dri-devel, kongfei, linaro-mm-sig,
	daniel.liuyi, yudongbin

On Fri, Feb 01, 2019 at 02:59:46PM +0800, Qing Xia wrote:
> In the first loop, gfp_flags will be modified to high_order_gfp_flags,
> and there will be no chance to change back to low_order_gfp_flags.
> 
> Fixes: e7f63771 ("ION: Sys_heap: Add cached pool to spead up cached buffer alloc")

Huh...  Presumably you found this bug just by reading the code.  I
wonder how it affects runtime?

regards,
dan carpenter


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] staging: android: ion: fix sys heap pool's gfp_flags
  2019-02-01  8:15 ` Dan Carpenter
@ 2019-02-01  8:30   ` Xiaqing (A)
  0 siblings, 0 replies; 5+ messages in thread
From: Xiaqing (A) @ 2019-02-01  8:30 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: labbott, sumit.semwal, gregkh, arve, tkjos, maco, devel,
	puck.chen, linux-kernel, dri-devel, kongfei, linaro-mm-sig,
	daniel.liuyi, yudongbin



On 2019/2/1 16:15, Dan Carpenter wrote:
> On Fri, Feb 01, 2019 at 02:59:46PM +0800, Qing Xia wrote:
>> In the first loop, gfp_flags will be modified to high_order_gfp_flags,
>> and there will be no chance to change back to low_order_gfp_flags.
>>
>> Fixes: e7f63771 ("ION: Sys_heap: Add cached pool to spead up cached buffer alloc")
> 
> Huh...  Presumably you found this bug just by reading the code.  I
> wonder how it affects runtime?
> 
The problem is that when I found that there was no page allocation failure warning
after the failure of the ion alloc in my test, and then I found the problem of gfp_flags.

regards,
Qing

> regards,
> dan carpenter
> 
> 
> .
> 


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] staging: android: ion: fix sys heap pool's gfp_flags
  2019-02-01  6:59 [PATCH] staging: android: ion: fix sys heap pool's gfp_flags Qing Xia
  2019-02-01  7:55 ` Chen Feng
  2019-02-01  8:15 ` Dan Carpenter
@ 2019-02-19 21:18 ` Laura Abbott
  2 siblings, 0 replies; 5+ messages in thread
From: Laura Abbott @ 2019-02-19 21:18 UTC (permalink / raw)
  To: Qing Xia, sumit.semwal, gregkh, arve, tkjos, maco
  Cc: linaro-mm-sig, linux-kernel, dri-devel, devel, daniel.liuyi,
	yudongbin, kongfei, puck.chen

On 1/31/19 10:59 PM, Qing Xia wrote:
> In the first loop, gfp_flags will be modified to high_order_gfp_flags,
> and there will be no chance to change back to low_order_gfp_flags.
> 
> Fixes: e7f63771 ("ION: Sys_heap: Add cached pool to spead up cached buffer alloc")
> Signed-off-by: Qing Xia <saberlily.xia@hisilicon.com>
> ---
>   drivers/staging/android/ion/ion_system_heap.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/staging/android/ion/ion_system_heap.c b/drivers/staging/android/ion/ion_system_heap.c
> index 0383f75..20f2103 100644
> --- a/drivers/staging/android/ion/ion_system_heap.c
> +++ b/drivers/staging/android/ion/ion_system_heap.c
> @@ -223,10 +223,10 @@ static void ion_system_heap_destroy_pools(struct ion_page_pool **pools)
>   static int ion_system_heap_create_pools(struct ion_page_pool **pools)
>   {
>   	int i;
> -	gfp_t gfp_flags = low_order_gfp_flags;
>   
>   	for (i = 0; i < NUM_ORDERS; i++) {
>   		struct ion_page_pool *pool;
> +		gfp_t gfp_flags = low_order_gfp_flags;
>   
>   		if (orders[i] > 4)
>   			gfp_flags = high_order_gfp_flags;
> 

Acked-by: Laura Abbott <labbott@redhat.com>

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2019-02-19 21:18 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-02-01  6:59 [PATCH] staging: android: ion: fix sys heap pool's gfp_flags Qing Xia
2019-02-01  7:55 ` Chen Feng
2019-02-01  8:15 ` Dan Carpenter
2019-02-01  8:30   ` Xiaqing (A)
2019-02-19 21:18 ` Laura Abbott

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).