From patchwork Tue Mar 26 22:49:56 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolin Chen X-Patchwork-Id: 10872279 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 4451315AC for ; Tue, 26 Mar 2019 22:50:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2C33F28CA6 for ; Tue, 26 Mar 2019 22:50:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2038128D6F; Tue, 26 Mar 2019 22:50:37 +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 5F22D28CA6 for ; Tue, 26 Mar 2019 22:50:36 +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=rImlM4d6yYD050/Nqn/p3Zd4JI8dQnJVItg6F8OtbRw=; b=lyciafjmmnRxE5dtIER6/LKuKC 88OlucnAhgy739gcGTYKb2WApW4f6MJ3KbLlkQFiF8qwcOU5g9wKqmo4TULIBu6riS81yvFKYZDV8 7RmhMvFHyTfbzb7/baJcaQdDBvV371oCQ0rfChIpviS7D5Xbp9EN4RpSV48WQ/LALPpc23xmQQUSs E+8hLnKHMUWyU3lCowZKkXINKHk25BkwTKnZ+lhSWP6biF7lJmt8OlMP9aK//p50KuAQLzaQaZzcq CxrriHoe3AKOpdqR+s/JIE0nr7gzL+XqCjFFMoAYxDiBw2c9DAt3UeNhkbFiuzAom+62oKyGQt71e CPHhR26g==; 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 1h8utr-0005KG-Va; Tue, 26 Mar 2019 22:50:31 +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 1h8utV-0004wn-W9 for linux-arm-kernel@lists.infradead.org; Tue, 26 Mar 2019 22:50:16 +0000 Received: by mail-pl1-x644.google.com with SMTP id q6so2318236pll.4 for ; Tue, 26 Mar 2019 15:50:09 -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=nSqLKLQoUDGkS6WO6/0mqXSeMgP/CMmbaNUycpN9yEE=; b=ZVveUJyfJtWMiRM4wzAvSqvIrGb5Uc4l2fO8VFBJijcJW7PWGpQb8oVHdGr0AoCgDE 3A6CC9+a+wrgLm2xlITj6BH4POxgy856dcYoulSSjYKNcRXv/P/8Pdps5oSzikhA3+KD Nr6ybuvCcvEAfUO4Aj/nP6wiVfwmPGk5vp1NMOYeKrE1mfER2xMRG891B1EcnUjv+0QL 1PV0iOoeyf52M2f3f3oe//dlwFLXILaoVIDLaEM5YS83vmVbGZXfpHZhknITyT400jI9 Bo+MqtKKdeKLLchEHs8DWIbTTI4kTFMoX5odJYfHaP53mgCJyyhjufaKI+yUrmlmcpm6 naiA== 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=nSqLKLQoUDGkS6WO6/0mqXSeMgP/CMmbaNUycpN9yEE=; b=oaLzO0oq5p3C5Y8y5FAs7ze4/XCLgUnxC3K9d0vqgiRFXNwu03PYgbN9BFJkarJaCm ZWks7LXP0aoutcSimZBcoZX3BTGvcyNShmJiTSFxUl1RJ7h1d2xR1KIPSVvZ1s1Z4Kq7 hb2Y3e7t02vfgPDs7QIgZtt0aIKjyx8LKGGrATIdJHsjimuPV3FltXgIXvKpPui+uQfx GZ5Pev8c/QnsPZ9QQBDJTBSU9SvqLiTWCf/GE3YtC7lfcC3I77vTi+JpzOXXX9lDN+3o Hsu6eSnpFMOFOXzSeAK/ub2YA0s2tfWgGgWRM9u/xSk7bNVPn0K5K38+V7iQIGPtZ7me ntAg== X-Gm-Message-State: APjAAAX3/c7Px5pPHI4PzA0hK4IQ/ADjwg6gxydd4d+aHdJD9VWA+/a4 qD7X66dNZckQmS6ii4rd+O0= X-Google-Smtp-Source: APXvYqwmClTzI7FvtAmxZGjK3gY6Chb0F1x05w8JRFZiw+0qSexX6YaMke6VFqQXamPljAAhWjWM2A== X-Received: by 2002:a17:902:846:: with SMTP id 64mr33494874plk.266.1553640609222; Tue, 26 Mar 2019 15:50:09 -0700 (PDT) Received: from Asurada-Nvidia.nvidia.com (thunderhill.nvidia.com. [216.228.112.22]) by smtp.gmail.com with ESMTPSA id 8sm56937368pfs.50.2019.03.26.15.50.07 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 26 Mar 2019 15:50:08 -0700 (PDT) From: Nicolin Chen To: hch@lst.de, robin.murphy@arm.com Subject: [PATCH RFC/RFT 2/5] dma-remap: Run alloc_pages() on failure Date: Tue, 26 Mar 2019 15:49:56 -0700 Message-Id: <20190326224959.9656-3-nicoleotsuka@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190326224959.9656-1-nicoleotsuka@gmail.com> References: <20190326224959.9656-1-nicoleotsuka@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190326_155010_030111_0A9C2805 X-CRM114-Status: GOOD ( 12.24 ) 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 --- kernel/dma/remap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/dma/remap.c b/kernel/dma/remap.c index 2b750f13bc8f..daab2f3186a2 100644 --- a/kernel/dma/remap.c +++ b/kernel/dma/remap.c @@ -116,7 +116,7 @@ int __init dma_atomic_pool_init(gfp_t gfp, pgprot_t prot) 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;