2018-01-09 02:42:41

by Zengtao (B)

[permalink] [raw]
Subject: [PATCH] ION: Sys_heap: fix the incorrect pool->gfp_mask setting

This issue is introduced by the commit <e7f63771b60e> ("ION: Sys_heap:
Add cached pool to spead up cached buffer alloc"), the gfp_mask low
order pool is overlapped by the high order inside the loop, so the
gfp_mask of all pools are set to high_order_gfp_flags.

Signed-off-by: Zeng Tao <[email protected]>
---
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 4dc5d7a..b6386be 100644
--- a/drivers/staging/android/ion/ion_system_heap.c
+++ b/drivers/staging/android/ion/ion_system_heap.c
@@ -298,10 +298,10 @@ static int ion_system_heap_create_pools(struct ion_page_pool **pools,
bool cached)
{
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.4


2018-01-09 03:30:32

by Chen Feng

[permalink] [raw]
Subject: Re: [PATCH] ION: Sys_heap: fix the incorrect pool->gfp_mask setting



On 2018/1/9 18:43, Zeng Tao wrote:
> This issue is introduced by the commit <e7f63771b60e> ("ION: Sys_heap:
> Add cached pool to spead up cached buffer alloc"), the gfp_mask low
> order pool is overlapped by the high order inside the loop, so the
> gfp_mask of all pools are set to high_order_gfp_flags.
>

Thanks
> Signed-off-by: Zeng Tao <[email protected]>
> ---
> 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 4dc5d7a..b6386be 100644
> --- a/drivers/staging/android/ion/ion_system_heap.c
> +++ b/drivers/staging/android/ion/ion_system_heap.c
> @@ -298,10 +298,10 @@ static int ion_system_heap_create_pools(struct ion_page_pool **pools,
> bool cached)
> {
> 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;

Not define here. Better "gfp_flags = low_order_gfp_flags"
>
> if (orders[i] > 4)
> gfp_flags = high_order_gfp_flags;
>

2018-01-09 09:15:01

by Dan Carpenter

[permalink] [raw]
Subject: Re: [PATCH] ION: Sys_heap: fix the incorrect pool->gfp_mask setting

On Tue, Jan 09, 2018 at 11:30:09AM +0800, Chen Feng wrote:
>
>
> On 2018/1/9 18:43, Zeng Tao wrote:
> > This issue is introduced by the commit <e7f63771b60e> ("ION: Sys_heap:
> > Add cached pool to spead up cached buffer alloc"),

Use the Fixes tag.

Fixes: e7f63771b60e ("ION: Sys_heap: Add cached pool to spead up cached buffer alloc")

> the gfp_mask low
> > order pool is overlapped by the high order inside the loop, so the
> > gfp_mask of all pools are set to high_order_gfp_flags.
> >
>
> Thanks
> > Signed-off-by: Zeng Tao <[email protected]>
> > ---
> > 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 4dc5d7a..b6386be 100644
> > --- a/drivers/staging/android/ion/ion_system_heap.c
> > +++ b/drivers/staging/android/ion/ion_system_heap.c
> > @@ -298,10 +298,10 @@ static int ion_system_heap_create_pools(struct ion_page_pool **pools,
> > bool cached)
> > {
> > 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;
>
> Not define here. Better "gfp_flags = low_order_gfp_flags"

Either way is fine...

regards,
dan carpenter