From patchwork Tue Mar 26 22:49:54 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolin Chen X-Patchwork-Id: 10872275 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 64A4414DE for ; Tue, 26 Mar 2019 22:50:24 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4334A28843 for ; Tue, 26 Mar 2019 22:50:24 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3692C28CA8; Tue, 26 Mar 2019 22:50: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 D549628843 for ; Tue, 26 Mar 2019 22:50:23 +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: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:In-Reply-To: References:List-Owner; bh=V+LjU62Pk24RibutbqInWWM+y2EGYiTdoZ7f7lU7MQ8=; b=che MwG5TfxsgfHE01MkLdKPAEM6hEzuFPAkBFEnZsiM8D1xM74LhRHAQwJaas3SI7Oa/vjtSp294gkwj UweBzZs2jWePYnqfmZbMh7FHun/gURm0pjsTHDEChCaB9HeozQrcUYvOP2y/YBR3xly26+pKpLkfz IDEEzeY1D+UJqE5AHURGlLkNJIgPLhC48tsXC+P/mza05Nft0Ab30hYvyg3QOXPRq2mzg+DTtesZw RvKkhEQ4ID6vO/JdGrpB1uH9E35um6G6FNIRQKkrph7ZAYv0IOchzirCKybn+d2c0eXB7t43zAuQj 8gGfligs+Ks9C4x4fNYrAWRpNT1fIsw==; 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 1h8utX-0004xh-Ux; Tue, 26 Mar 2019 22:50:11 +0000 Received: from mail-pl1-x643.google.com ([2607:f8b0:4864:20::643]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1h8utU-0004dl-Tm for linux-arm-kernel@lists.infradead.org; Tue, 26 Mar 2019 22:50:10 +0000 Received: by mail-pl1-x643.google.com with SMTP id m10so2320910plt.10 for ; Tue, 26 Mar 2019 15:50:07 -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; bh=e5DY//bd4ABajPh9E86maxYkAmj3lPA2dscnZKXW2Qk=; b=n2wbbN0OsXuVk+0FAj6hZ8X/6dH6uDYiZnI8cfOX7sOOjdIS3Y4LiWU0vynQNlWYBb sW3zBvEUNTwT+0JyqYUWU89azy79knAiMV6lU4I0rboLLmEQGwIRoLxnnLmpGzwK1O9/ JKuZ0mjPhZKmHNStJC9o6VK2hLXPPlLKdyY0cjYyKMCb/RORxwzWI9y9OWu+y0XiMA1C OjZjcpcpRrmZ8np+NVdbpjUOHgPx2IYChG1yOgWerx2nuy7Y7ISN+QiqZXiJiAbttVtO vp7+gAT9pUa0GOUOkCJHEcssuDdRiu2l3pO55bnSTvBeDk/nZdXSNLHlO1AQrY326ebf bw/g== 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; bh=e5DY//bd4ABajPh9E86maxYkAmj3lPA2dscnZKXW2Qk=; b=B3WtZEp3DLFiT+NfGrmIoCWO2IiTeTi6hT6uylryVnaqvJRhQSUboLG9Z/VbmEuxYr O5V8M8B0if2b17RM++Cf9WiU63L1adeO8dMKYLIameWp3MHrB/bva3qArnU2JpnT2uUg bkeYG8L8dx2/M3kK0poVggV4yntknZxsz27NDwZyy9rEXYcQs/t32u1vU8hS0K6GIrAn 0hbtIfLZAC1pldDu059ws8OwiFeKSkGZFwW0oZuBBGsR4u8pfDRDdGr/JmqCF3KklCe8 YrHhWup8fUm8zsHhBzaToGwWhRRACE//Ekd9dO20Bh8hEdfdbhEPUGjKbOXCu1AjtH5A clcg== X-Gm-Message-State: APjAAAWykcHozBDSReBw+qCkNewt8VJaxCVoo0Q0JXYsKFIZ7xyS7eEu mVHVivKVvOd/1tRPgbukhVDLv2gt X-Google-Smtp-Source: APXvYqzENC9UGVQ3jRiFlKy6HAKbq8RA5f10B6IfDv3ZnpV7i7ECCReq6XySdE8T7KZaU5V1waKJdw== X-Received: by 2002:a17:902:6907:: with SMTP id j7mr32053108plk.32.1553640606166; Tue, 26 Mar 2019 15:50:06 -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.04 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 26 Mar 2019 15:50:05 -0700 (PDT) From: Nicolin Chen To: hch@lst.de, robin.murphy@arm.com Subject: [PATCH RFC/RFT 0/5] Save single pages from CMA area Date: Tue, 26 Mar 2019 15:49:54 -0700 Message-Id: <20190326224959.9656-1-nicoleotsuka@gmail.com> X-Mailer: git-send-email 2.17.1 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190326_155008_966541_C489ADC7 X-CRM114-Status: UNSURE ( 7.91 ) X-CRM114-Notice: Please train this message. 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 This series of patches try to save single pages from CMA area bypassing all CMA single page alloctions and allocating normal pages instead, as all addresses within one single page are contiguous. We had once applied the PATCH-5 but reverted it as actually not all the callers handled the fallback allocations. Per Robin's suggestion, let's stuff alloc_pages()/free_page() fallbacks to those callers before having PATCH-5. Nicolin Chen (5): ARM: dma-mapping: Add fallback normal page allocations dma-remap: Run alloc_pages() on failure iommu: amd_iommu: Add fallback normal page allocations arm64: dma-mapping: Add fallback normal page allocations dma-contiguous: Do not allocate a single page from CMA area arch/arm/mm/dma-mapping.c | 13 ++++++++++--- arch/arm64/mm/dma-mapping.c | 19 ++++++++++++------- drivers/iommu/amd_iommu.c | 3 +++ kernel/dma/contiguous.c | 22 +++++++++++++++++++--- kernel/dma/remap.c | 2 +- 5 files changed, 45 insertions(+), 14 deletions(-)