From patchwork Tue Mar 26 23:01:28 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolin Chen X-Patchwork-Id: 10872297 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9B8A317E0 for ; Tue, 26 Mar 2019 23:02:24 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8159028D92 for ; Tue, 26 Mar 2019 23:02:24 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 75C4028DA0; Tue, 26 Mar 2019 23:02:24 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,DKIM_VALID,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 1C8E228D92 for ; Tue, 26 Mar 2019 23:02:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=asKRfXJ8a2nh76vN7Je+9hkMKDaa+7fohJbHmnvthgE=; b=iig1pfkgjYrAasHL5+Xbf4GSH0 7crdcMnoofGSUXkSbQ5Sotx/nxHkNEPQCTxXieGaH1/IRH1fgu5G6XX/AFzYf44lbrNb62WzEJ7Q/ /DwBIxRwGxSmAkqr0JUOKXUnBdn4i7qa3HFT3Ewmr4Bq7J1Ao4xKlOvkpC3HZs5FC/8Z0GrD5UCMb 9J+MrDe/kA3tMqOoIf1qpmK3QXkJgrT8kuKX17gmWt3F65fBptZ41S+eWCBW+Nos6h8t+me7XseTh +Hp6G5xQ04nvav16kk7DsBTC8tzP3oQyf/ZtkSYX8OqHfApqC8sIxhOqT/S9Voqi6+9ggxWq0FFWm mcQoCvIA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1h8v5G-0001xi-4r; Tue, 26 Mar 2019 23:02:18 +0000 Received: from mail-pl1-x644.google.com ([2607:f8b0:4864:20::644]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1h8v4h-0001Ko-LN for linux-arm-kernel@lists.infradead.org; Tue, 26 Mar 2019 23:01:45 +0000 Received: by mail-pl1-x644.google.com with SMTP id b11so2327105plr.7 for ; Tue, 26 Mar 2019 16:01:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=YwwzX2Ckb5IfO36KXFpoRn0bgcwJZJMjsrMm/Tj5wmQ=; b=Nn9q3ZFaAD/c1+ZSBu573k//eegbkL8oLW4s44qOduajMYZ21kIvPvakhZ0S5rv4QB tJnGB7JqGFkcFhJ4Xcnl1T94Uzhdg5SUmHGXHq9IzLJ4oa+vRIGN0MF8fznY7AjLo161 M4mwwCYDcNkdNq/I0W4PRkG597A/r+FLTt94H8HrzDzqFQ8roUk3SO3mZbUG3AHgV45w VW7bgYKIeZ9LKh5xsktkTHnYZ5svDQ+6FdZYNk2Qv7cGP0YkZDTuNHNP5emgFZpMqqwr e9G3wJbgWu2utDgh+a5fXLTaKac2Je2evrrANpmaSszlhOrX6XujofGDF+rELW4LogUS ghMQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=YwwzX2Ckb5IfO36KXFpoRn0bgcwJZJMjsrMm/Tj5wmQ=; b=kSYX7mdlPEctFY2Eagxj1I0/mGr2mnOq6Sg5P82nnnNAf8ojzm/HGfA4Wo6oSL4Q1J wLuMic5Zsg04QjnwlJsNyQMvZg2J8qbgFFdyl/Cc1gJ5r0hL9nRFulD/mkQ3MRH1tex+ JhWYsh6jMpgCxaOAck7mpnbdl1AQOXiP5JZezx4xqedNeY3GHy65Xvevv+nBaLZTTupi ykVS8mvADOqUUVvYJpANahOWm16xcdkvd4YNHJpndnLric6ryjUnuSpoO/yNqiNXHaJ9 cc7ABeR7rDGWgSz3tQEPEiTsSxyayuKPG5kxBlmjsDHBjQo7KZopQ9ASAWzId8vn2v21 JUuw== X-Gm-Message-State: APjAAAVf3JUJ6xusaCwADNNJ+VokZWQyh5g3O1p3FlmEyy93zrO5b1Fs xVnKbJ1t6gJRIA2MoxIj0nI= X-Google-Smtp-Source: APXvYqwos9GlWk8aPE/h4lNoYQAEJzJM0q9VFoHFIolVkeadZjxjBGqN/o6Xk9M/LFnA64Pau6O61g== X-Received: by 2002:a17:902:8643:: with SMTP id y3mr33347145plt.195.1553641300615; Tue, 26 Mar 2019 16:01:40 -0700 (PDT) Received: from Asurada-Nvidia.nvidia.com (thunderhill.nvidia.com. [216.228.112.22]) by smtp.gmail.com with ESMTPSA id n24sm43832587pfi.123.2019.03.26.16.01.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 26 Mar 2019 16:01:40 -0700 (PDT) From: Nicolin Chen To: hch@lst.de, robin.murphy@arm.com Subject: [PATCH v2 RFC/RFT 2/5] dma-remap: Run alloc_pages() on failure Date: Tue, 26 Mar 2019 16:01:28 -0700 Message-Id: <20190326230131.16275-3-nicoleotsuka@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190326230131.16275-1-nicoleotsuka@gmail.com> References: <20190326230131.16275-1-nicoleotsuka@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190326_160143_844703_579DFB93 X-CRM114-Status: GOOD ( 12.12 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: tony@atomide.com, catalin.marinas@arm.com, joro@8bytes.org, will.deacon@arm.com, linux@armlinux.org.uk, iommu@lists.linux-foundation.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, m.szyprowski@samsung.com MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP The CMA allocation will skip allocations of single pages to save CMA resource. This requires its callers to rebound those page allocations from normal area. So this patch moves the alloc_pages() call to the fallback routines. Signed-off-by: Nicolin Chen --- Changlog v1->v2: * PATCH-2: Initialized page pointer to NULL kernel/dma/remap.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/kernel/dma/remap.c b/kernel/dma/remap.c index 2b750f13bc8f..c2076c6d6c17 100644 --- a/kernel/dma/remap.c +++ b/kernel/dma/remap.c @@ -109,14 +109,14 @@ int __init dma_atomic_pool_init(gfp_t gfp, pgprot_t prot) { unsigned int pool_size_order = get_order(atomic_pool_size); unsigned long nr_pages = atomic_pool_size >> PAGE_SHIFT; - struct page *page; + struct page *page = NULL; void *addr; int ret; if (dev_get_cma_area(NULL)) page = dma_alloc_from_contiguous(NULL, nr_pages, pool_size_order, false); - else + if (!page) page = alloc_pages(gfp, pool_size_order); if (!page) goto out;