From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933451Ab1FBKiZ (ORCPT ); Thu, 2 Jun 2011 06:38:25 -0400 Received: from cantor2.suse.de ([195.135.220.15]:58375 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933354Ab1FBKiY (ORCPT ); Thu, 2 Jun 2011 06:38:24 -0400 Date: Thu, 2 Jun 2011 11:38:20 +0100 From: Mel Gorman To: Michal Hocko Cc: Andrew Morton , Minchan Kim , linux-mm@kvack.org, LKML Subject: Re: [PATCH v2] mm: compaction: fix special case -1 order checks Message-ID: <20110602103820.GE7306@suse.de> References: <20110530123831.GG20166@tiehlicka.suse.cz> <20110530151633.GB1505@barrios-laptop> <20110530152450.GH20166@tiehlicka.suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15 Content-Disposition: inline In-Reply-To: <20110530152450.GH20166@tiehlicka.suse.cz> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, May 30, 2011 at 05:24:50PM +0200, Michal Hocko wrote: > > mm: compaction: fix special case -1 order checks > > 56de7263 (mm: compaction: direct compact when a high-order allocation > fails) introduced a check for cc->order == -1 in compact_finished. We > should continue compacting in that case because the request came from > userspace and there is no particular order to compact for. > Similar check has been added by 82478fb7 (mm: compaction: > prevent division-by-zero during user-requested compaction) for > compaction_suitable. > > The check is, however, done after zone_watermark_ok which uses order as > a right hand argument for shifts. Not only watermark check is pointless > if we can break out without it but it also uses 1 << -1 which is not > well defined (at least from C standard). Let's move the -1 check above > zone_watermark_ok. > > [Minchan Kim - caught compaction_suitable] > Signed-off-by: Michal Hocko > Cc: Mel Gorman Acked-by: Mel Gorman -- Mel Gorman SUSE Labs