From patchwork Tue Sep 25 21:39:31 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Morton X-Patchwork-Id: 186897 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 648742C007A for ; Wed, 26 Sep 2012 07:39:45 +1000 (EST) Received: from localhost ([::1]:35954 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TGcr1-00049G-HW for incoming@patchwork.ozlabs.org; Tue, 25 Sep 2012 17:39:43 -0400 Received: from eggs.gnu.org ([208.118.235.92]:36988) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TGcqu-00048n-Fg for qemu-devel@nongnu.org; Tue, 25 Sep 2012 17:39:37 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TGcqt-0001xN-ED for qemu-devel@nongnu.org; Tue, 25 Sep 2012 17:39:36 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:57529) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TGcqt-0001x6-87 for qemu-devel@nongnu.org; Tue, 25 Sep 2012 17:39:35 -0400 Received: from akpm.mtv.corp.google.com (216-239-45-4.google.com [216.239.45.4]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id D432E54F; Tue, 25 Sep 2012 21:39:32 +0000 (UTC) Date: Tue, 25 Sep 2012 14:39:31 -0700 From: Andrew Morton To: Minchan Kim Message-Id: <20120925143931.f404ca22.akpm@linux-foundation.org> In-Reply-To: <20120925081327.GA7759@bbox> References: <1348224383-1499-1-git-send-email-mgorman@suse.de> <1348224383-1499-6-git-send-email-mgorman@suse.de> <20120925070517.GK13234@bbox> <20120925075105.GC11266@suse.de> <20120925081327.GA7759@bbox> X-Mailer: Sylpheed 3.0.2 (GTK+ 2.20.1; x86_64-pc-linux-gnu) Mime-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 140.211.169.12 Cc: Richard Davies , KVM , QEMU-devel , LKML , Linux-MM , Mel Gorman , Shaohua Li , Avi Kivity Subject: Re: [Qemu-devel] [PATCH 5/9] mm: compaction: Acquire the zone->lru_lock as late as possible X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org On Tue, 25 Sep 2012 17:13:27 +0900 Minchan Kim wrote: > I see. To me, your saying is better than current comment. > I hope comment could be more explicit. > > diff --git a/mm/compaction.c b/mm/compaction.c > index df01b4e..f1d2cc7 100644 > --- a/mm/compaction.c > +++ b/mm/compaction.c > @@ -542,8 +542,9 @@ isolate_migratepages_range(struct zone *zone, struct compact_control *cc, > * splitting and collapsing (collapsing has already happened > * if PageLRU is set) but the lock is not necessarily taken > * here and it is wasteful to take it just to check transhuge. > - * Check transhuge without lock and skip if it's either a > - * transhuge or hugetlbfs page. > + * Check transhuge without lock and *skip* if it's either a > + * transhuge or hugetlbfs page because it's not safe to call > + * compound_order. > */ > if (PageTransHuge(page)) { > if (!locked) Going a bit further: --- a/mm/compaction.c~mm-compaction-acquire-the-zone-lru_lock-as-late-as-possible-fix +++ a/mm/compaction.c @@ -415,7 +415,8 @@ isolate_migratepages_range(struct zone * * if PageLRU is set) but the lock is not necessarily taken * here and it is wasteful to take it just to check transhuge. * Check transhuge without lock and skip if it's either a - * transhuge or hugetlbfs page. + * transhuge or hugetlbfs page because calling compound_order() + * requires lru_lock to exclude isolation and splitting. */ if (PageTransHuge(page)) { if (!locked)