From patchwork Fri May 23 08:34:55 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vlastimil Babka X-Patchwork-Id: 4229141 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 36D49BF90C for ; Fri, 23 May 2014 08:38:16 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 668C020386 for ; Fri, 23 May 2014 08:38:15 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 50C34202DD for ; Fri, 23 May 2014 08:38:14 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1Wnkwo-0008RC-0t; Fri, 23 May 2014 08:35:26 +0000 Received: from cantor2.suse.de ([195.135.220.15] helo=mx2.suse.de) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Wnkwl-0007M7-CM for linux-arm-kernel@lists.infradead.org; Fri, 23 May 2014 08:35:24 +0000 Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 24B0CAC85; Fri, 23 May 2014 08:34:58 +0000 (UTC) Message-ID: <537F082F.50501@suse.cz> Date: Fri, 23 May 2014 10:34:55 +0200 From: Vlastimil Babka User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.5.0 MIME-Version: 1.0 To: Shawn Guo , Kevin Hilman , Andrew Morton Subject: Re: [PATCH v2] mm, compaction: properly signal and act upon lock and need_sched() contention References: <1399904111-23520-1-git-send-email-vbabka@suse.cz> <1400233673-11477-1-git-send-email-vbabka@suse.cz> In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140523_013523_622404_DB652916 X-CRM114-Status: GOOD ( 17.52 ) X-Spam-Score: -5.0 (-----) Cc: Rik van Riel , Stephen Warren , Minchan Kim , Bartlomiej Zolnierkiewicz , Hugh Dickins , LKML , Michal Nazarewicz , linux-mm@kvack.org, Mel Gorman , David Rientjes , Olof Johansson , Greg Thelen , Joonsoo Kim , Christoph Lameter , linux-arm-kernel X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-2.5 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP On 05/23/2014 04:48 AM, Shawn Guo wrote: > On 23 May 2014 07:49, Kevin Hilman wrote: >> On Fri, May 16, 2014 at 2:47 AM, Vlastimil Babka wrote: >>> Compaction uses compact_checklock_irqsave() function to periodically check for >>> lock contention and need_resched() to either abort async compaction, or to >>> free the lock, schedule and retake the lock. When aborting, cc->contended is >>> set to signal the contended state to the caller. Two problems have been >>> identified in this mechanism. >> >> This patch (or later version) has hit next-20140522 (in the form >> commit 645ceea9331bfd851bc21eea456dda27862a10f4) and according to my >> bisect, appears to be the culprit of several boot failures on ARM >> platforms. > > On i.MX6 where CMA is enabled, the commit causes the drivers calling > dma_alloc_coherent() fail to probe. Tracing it a little bit, it seems > dma_alloc_from_contiguous() always return page as NULL after this > commit. > > Shawn > Really sorry, guys :/ -----8<----- From: Vlastimil Babka Date: Fri, 23 May 2014 10:18:56 +0200 Subject: mm-compaction-properly-signal-and-act-upon-lock-and-need_sched-contention-fix2 Step 1: Change function name and comment between v1 and v2 so that the return value signals the opposite thing. Step 2: Change the call sites to reflect the opposite return value. Step 3: ??? Step 4: Make a complete fool of yourself. Signed-off-by: Vlastimil Babka Tested-by: Shawn Guo Tested-by: Kevin Hilman Tested-by: Stephen Warren --- mm/compaction.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mm/compaction.c b/mm/compaction.c index a525cd4..5175019 100644 --- a/mm/compaction.c +++ b/mm/compaction.c @@ -237,13 +237,13 @@ static inline bool compact_should_abort(struct compact_control *cc) if (need_resched()) { if (cc->mode == MIGRATE_ASYNC) { cc->contended = true; - return false; + return true; } cond_resched(); } - return true; + return false; } /* Returns true if the page is within a block suitable for migration to */