From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752718Ab1KUMg3 (ORCPT ); Mon, 21 Nov 2011 07:36:29 -0500 Received: from cantor2.suse.de ([195.135.220.15]:41626 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751044Ab1KUMg2 (ORCPT ); Mon, 21 Nov 2011 07:36:28 -0500 Date: Mon, 21 Nov 2011 12:36:24 +0000 From: Mel Gorman To: Andrea Arcangeli Cc: linux-mm@kvack.org, Minchan Kim , Jan Kara , Andy Isaacson , Johannes Weiner , linux-kernel@vger.kernel.org Subject: Re: [PATCH 4/8] mm: compaction: defer compaction only with sync_migration Message-ID: <20111121123624.GD19415@suse.de> References: <1321635524-8586-1-git-send-email-mgorman@suse.de> <1321732460-14155-5-git-send-email-aarcange@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15 Content-Disposition: inline In-Reply-To: <1321732460-14155-5-git-send-email-aarcange@redhat.com> 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 Sat, Nov 19, 2011 at 08:54:16PM +0100, Andrea Arcangeli wrote: > Let only sync migration drive the > compaction_deferred()/defer_compaction() logic. So sync migration > isn't prevented to run if async migration fails. Without sync > migration pages requiring migrate.c:writeout() or a ->migratepage > operation (that isn't migrate_page) can't me migrated, and that has > the effect of polluting the movable pageblock with pages that won't be > migrated by async migration, so it's fundamental to guarantee sync > compaction will be run too before failing. > > Signed-off-by: Andrea Arcangeli > --- > mm/page_alloc.c | 50 ++++++++++++++++++++++++++++++-------------------- > 1 files changed, 30 insertions(+), 20 deletions(-) > > diff --git a/mm/page_alloc.c b/mm/page_alloc.c > index 9dd443d..2229f7d 100644 > --- a/mm/page_alloc.c > +++ b/mm/page_alloc.c > @@ -1891,7 +1891,7 @@ __alloc_pages_direct_compact(gfp_t gfp_mask, unsigned int order, > { > struct page *page; > > - if (!order || compaction_deferred(preferred_zone)) > + if (!order) > return NULL; > What is the motivation for moving the compation_deferred() check to __alloc_pages_slowpath()? If compaction was deferred for async compaction, we try direct reclaim as the linear isolation might succeed where compaction failed and compaction will likely be skipped again the second time around. If anything, entering direct reclaim for THP when compaction is deferred is wrong as it also potentially stalls for a long period of time in reclaim