Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755452AbaJWUgT (ORCPT ); Thu, 23 Oct 2014 16:36:19 -0400 Received: from mail-yh0-f53.google.com ([209.85.213.53]:46805 "EHLO mail-yh0-f53.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753493AbaJWUgS (ORCPT ); Thu, 23 Oct 2014 16:36:18 -0400 MIME-Version: 1.0 In-Reply-To: <1414068740-9553-2-git-send-email-gioh.kim@lge.com> References: <1414068740-9553-1-git-send-email-gioh.kim@lge.com> <1414068740-9553-2-git-send-email-gioh.kim@lge.com> Date: Fri, 24 Oct 2014 02:06:17 +0530 Message-ID: Subject: Re: [RFC 1/2] staging: ion: shrink page-pool by page unit From: Devendra Naga To: Gioh Kim Cc: Greg Kroah-Hartman , John Stultz , Rebecca Schultz Zavin , devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org, gunho.lee@lge.com Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hello, On Thu, Oct 23, 2014 at 6:22 PM, Gioh Kim wrote: > This patch shrink page-pool by page unit. > > Signed-off-by: Gioh Kim > --- > drivers/staging/android/ion/ion_page_pool.c | 5 +++-- > drivers/staging/android/ion/ion_system_heap.c | 7 +++++-- > 2 files changed, 8 insertions(+), 4 deletions(-) > --- cut -- > diff --git a/drivers/staging/android/ion/ion_system_heap.c b/drivers/staging/android/ion/ion_system_heap.c > index da2a63c..36e73c3 100644 > --- a/drivers/staging/android/ion/ion_system_heap.c > +++ b/drivers/staging/android/ion/ion_system_heap.c > @@ -211,7 +211,7 @@ static int ion_system_heap_shrink(struct ion_heap *heap, gfp_t gfp_mask, > int nr_to_scan) > { > struct ion_system_heap *sys_heap; > - int nr_total = 0; > + int nr_total = 0, nr_freed; > int i; > > sys_heap = container_of(heap, struct ion_system_heap, heap); > @@ -219,7 +219,10 @@ static int ion_system_heap_shrink(struct ion_heap *heap, gfp_t gfp_mask, > for (i = 0; i < num_orders; i++) { > struct ion_page_pool *pool = sys_heap->pools[i]; > > - nr_total += ion_page_pool_shrink(pool, gfp_mask, nr_to_scan); > + nr_freed += ion_page_pool_shrink(pool, gfp_mask, nr_to_scan); nr_freed is not initialised to zero. This might result in updating of a garbage value stored initially after nr_freed is created. > + nr_total += nr_freed; > + /* nr_to_scan can be negative */ > + nr_to_scan -= nr_freed; > } > > return nr_total; > -- > 1.7.9.5 > > -- > To unsubscribe from this list: send the line "unsubscribe linux-kernel" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html > Please read the FAQ at http://www.tux.org/lkml/ -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/