Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753662Ab0GHHlo (ORCPT ); Thu, 8 Jul 2010 03:41:44 -0400 Received: from fgwmail6.fujitsu.co.jp ([192.51.44.36]:41870 "EHLO fgwmail6.fujitsu.co.jp" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751614Ab0GHHlm (ORCPT ); Thu, 8 Jul 2010 03:41:42 -0400 X-SecurityPolicyCheck-FJ: OK by FujitsuOutboundMailChecker v1.3.1 From: KOSAKI Motohiro To: Christoph Lameter Subject: Re: [PATCH v2 1/2] vmscan: don't subtraction of unsined Cc: kosaki.motohiro@jp.fujitsu.com, LKML , linux-mm , Andrew Morton , Mel Gorman , Rik van Riel , Minchan Kim , Johannes Weiner In-Reply-To: <20100708163401.CD34.A69D9226@jp.fujitsu.com> References: <20100708163401.CD34.A69D9226@jp.fujitsu.com> Message-Id: <20100708164050.CD3A.A69D9226@jp.fujitsu.com> MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit X-Mailer: Becky! ver. 2.50.07 [ja] Date: Thu, 8 Jul 2010 16:41:39 +0900 (JST) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2255 Lines: 71 Oops, sorry. I did forget cc Christoph. resend. > 'slab_reclaimable' and 'nr_pages' are unsigned. so, subtraction is > unsafe. > > Signed-off-by: KOSAKI Motohiro > Acked-by: Christoph Lameter > --- > mm/vmscan.c | 14 +++++++------- > 1 files changed, 7 insertions(+), 7 deletions(-) > > diff --git a/mm/vmscan.c b/mm/vmscan.c > index 9c7e57c..8715da1 100644 > --- a/mm/vmscan.c > +++ b/mm/vmscan.c > @@ -2588,7 +2588,7 @@ static int __zone_reclaim(struct zone *zone, gfp_t gfp_mask, unsigned int order) > .swappiness = vm_swappiness, > .order = order, > }; > - unsigned long slab_reclaimable; > + unsigned long n, m; > > disable_swap_token(); > cond_resched(); > @@ -2615,8 +2615,8 @@ static int __zone_reclaim(struct zone *zone, gfp_t gfp_mask, unsigned int order) > } while (priority >= 0 && sc.nr_reclaimed < nr_pages); > } > > - slab_reclaimable = zone_page_state(zone, NR_SLAB_RECLAIMABLE); > - if (slab_reclaimable > zone->min_slab_pages) { > + n = zone_page_state(zone, NR_SLAB_RECLAIMABLE); > + if (n > zone->min_slab_pages) { > /* > * shrink_slab() does not currently allow us to determine how > * many pages were freed in this zone. So we take the current > @@ -2628,16 +2628,16 @@ static int __zone_reclaim(struct zone *zone, gfp_t gfp_mask, unsigned int order) > * take a long time. > */ > while (shrink_slab(sc.nr_scanned, gfp_mask, order) && > - zone_page_state(zone, NR_SLAB_RECLAIMABLE) > > - slab_reclaimable - nr_pages) > + (zone_page_state(zone, NR_SLAB_RECLAIMABLE) + nr_pages > n)) > ; > > /* > * Update nr_reclaimed by the number of slab pages we > * reclaimed from this zone. > */ > - sc.nr_reclaimed += slab_reclaimable - > - zone_page_state(zone, NR_SLAB_RECLAIMABLE); > + m = zone_page_state(zone, NR_SLAB_RECLAIMABLE); > + if (m < n) > + sc.nr_reclaimed += n - m; > } > > p->reclaim_state = NULL; > -- > 1.6.5.2 > > > -- 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/