From patchwork Mon Jun 16 05:40:49 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joonsoo Kim X-Patchwork-Id: 4356321 Return-Path: X-Original-To: patchwork-kvm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 6734E9F1C4 for ; Mon, 16 Jun 2014 05:38:27 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A05A3202A1 for ; Mon, 16 Jun 2014 05:38:26 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id CC59220279 for ; Mon, 16 Jun 2014 05:38:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754024AbaFPFiN (ORCPT ); Mon, 16 Jun 2014 01:38:13 -0400 Received: from lgeamrelo01.lge.com ([156.147.1.125]:38449 "EHLO lgeamrelo01.lge.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753726AbaFPFgm (ORCPT ); Mon, 16 Jun 2014 01:36:42 -0400 Received: from unknown (HELO js1304-P5Q-DELUXE.LGE.NET) (10.177.220.145) by 156.147.1.125 with ESMTP; 16 Jun 2014 14:36:41 +0900 X-Original-SENDERIP: 10.177.220.145 X-Original-MAILFROM: iamjoonsoo.kim@lge.com From: Joonsoo Kim To: Andrew Morton , "Aneesh Kumar K.V" , Marek Szyprowski , Michal Nazarewicz Cc: Minchan Kim , Russell King - ARM Linux , Greg Kroah-Hartman , Paolo Bonzini , Gleb Natapov , Alexander Graf , Benjamin Herrenschmidt , Paul Mackerras , linux-mm@kvack.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, kvm@vger.kernel.org, kvm-ppc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, Zhang Yanfei , Joonsoo Kim Subject: [PATCH v3 -next 7/9] mm, CMA: clean-up CMA allocation error path Date: Mon, 16 Jun 2014 14:40:49 +0900 Message-Id: <1402897251-23639-8-git-send-email-iamjoonsoo.kim@lge.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1402897251-23639-1-git-send-email-iamjoonsoo.kim@lge.com> References: <1402897251-23639-1-git-send-email-iamjoonsoo.kim@lge.com> Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Spam-Status: No, score=-7.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham 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 We can remove one call sites for clear_cma_bitmap() if we first call it before checking error number. Acked-by: Minchan Kim Reviewed-by: Michal Nazarewicz Reviewed-by: Zhang Yanfei Reviewed-by: Aneesh Kumar K.V Signed-off-by: Joonsoo Kim diff --git a/mm/cma.c b/mm/cma.c index 0cf50da..b442a13 100644 --- a/mm/cma.c +++ b/mm/cma.c @@ -285,11 +285,12 @@ struct page *cma_alloc(struct cma *cma, int count, unsigned int align) if (ret == 0) { page = pfn_to_page(pfn); break; - } else if (ret != -EBUSY) { - cma_clear_bitmap(cma, pfn, count); - break; } + cma_clear_bitmap(cma, pfn, count); + if (ret != -EBUSY) + break; + pr_debug("%s(): memory range at %p is busy, retrying\n", __func__, pfn_to_page(pfn)); /* try again with a bit different memory target */