From patchwork Wed Dec 5 05:48:26 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolas Boichat X-Patchwork-Id: 10713013 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 C309F157A for ; Wed, 5 Dec 2018 05:48:53 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B13672C884 for ; Wed, 5 Dec 2018 05:48:53 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A38C32C8B2; Wed, 5 Dec 2018 05:48:53 +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=-3.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1F5462C884 for ; Wed, 5 Dec 2018 05:48:53 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 2B3D36B72C7; Wed, 5 Dec 2018 00:48:52 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 2627B6B72C8; Wed, 5 Dec 2018 00:48:52 -0500 (EST) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 12B1F6B72C9; Wed, 5 Dec 2018 00:48:52 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-pf1-f199.google.com (mail-pf1-f199.google.com [209.85.210.199]) by kanga.kvack.org (Postfix) with ESMTP id C4CB06B72C7 for ; Wed, 5 Dec 2018 00:48:51 -0500 (EST) Received: by mail-pf1-f199.google.com with SMTP id s14so15930043pfk.16 for ; Tue, 04 Dec 2018 21:48:51 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:dkim-signature:from:to:cc:subject:date :message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=Mtj+5lLpDKXzv34oRdlikvP0Q/L3pkB7CbeDcaUQ2ak=; b=RkcdlerUxX6lTwVSwmrxubSImI4vrx7tRr1g5+JogD1tJ5HTa8EZuTQBS+Okn+l7/D JdlDv5nO2gyuNEhOCXSwPDHXhNCrNuMaApHb8VpaU/5uOphMAXoP0+OywXbkvXfEEruc 5XB1rXWks918r2RhnC3YKbIK+rifkkpNSkn/1wTaAbRvg5UF1hRq9qFrIi5c5aW08xuM k3d0hMN2zNFoOQLSf7gAq+9ddnri1Zz2NFhJlPULXPGXvac8XkWb1SyHowGEDhankWJJ gB82j/2WwlAH1+F4ikNPB5QvQ7wv9QiiuiAHRB44sng9p4HNFtRgHJrjNx2bQleRB6me T+Mg== X-Gm-Message-State: AA+aEWaZTJk+2HUd65+8dvRs3i9ehWDRT44yFSKwQRapCcC/fYoqDjfw BhdV7RfE/inpXTvkwQ2bhgoGqH/gk+BD5zxb7/da+gzVZ/+cXxT7xbrlTCItUrKyMR2j0phv1wy 6psRlkn2OXM/o1+L/vP0yom9EmnfJO34yRqTRh9mLsV6UAfTD0o0XtGwPJn3qfBix9yr/jgYXDW I/mZ/zvq5jXLjsSKvN1BDK4r2Jh10OUZUgdhVY72gX5P3vHg33SDO79RSZZd1HMhCRpWfWupHTc JqdSw0SN837UqdDZqYvoSaMyIQxsgQF98KlDl0pUNwLviRwp6zTsd67gmfKhpD5HfpWDFzZPpHX iogIS50LRkMkh817rJGRkR4OzRX2UVl0GU5odN5JorsQoejhSenpUbdA78tEJZosadlUxn9eeTi X X-Received: by 2002:a63:d40a:: with SMTP id a10mr18961857pgh.394.1543988931447; Tue, 04 Dec 2018 21:48:51 -0800 (PST) X-Received: by 2002:a63:d40a:: with SMTP id a10mr18961835pgh.394.1543988930586; Tue, 04 Dec 2018 21:48:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543988930; cv=none; d=google.com; s=arc-20160816; b=y7OiKLzUfZetLlgLqpVxGslWk+S91TRA2TXcM5sCq24qvN8FRkRzhzK8i7NNgiknDy B/kWU3pxAKTOyAOCC7PZjZJzeoNVguwjyS33Nh2lv4IIQoKxsAZUUmeTc/CCW15L5M39 xhoKHI4XH77g96OhTVaXhMG9AgD14f1UO+wPrfSJV+6ILGkHvZAo50CWjjx6LhKG7KXq vvOp/bjfaAk0IM5l2AOMMTDaeLlEovN4RGi66p1kxlnQfYqp/AO0TelizxcjH2WE31IQ HBRPhlPwh423nBkNJIm3CFdyVlkyWcV/bQKeqqbC2y6c6l1Bqj8evRRFhBCFvVkdawu7 JxVw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=Mtj+5lLpDKXzv34oRdlikvP0Q/L3pkB7CbeDcaUQ2ak=; b=oBwP5voSOixZXVyZl1cw7ndvWgzhjWwrPDp6Jv8Key/1HBiZbx0haM2ut4tNDpKv3t 19UwlJ5nJ0XtkNGrCPHK8sSvZB4TProoMdK0yd0ry/DaZnK5ruYI8Iq7vwO46lOOGcAG 6NmOLrBd37CqVgy4jse+iGt8bh6QDZYaa1OnBBRJRTZgoym35w57cf28x+SLDW4yhZcm nx5rszKPqa8solc4EijA1dKDm1Cu9lCQxv2MnZL8U1nP780kKmDBrBFM7WYiCKDj740W D/P1o+/Pf3y3DSGTKcaRUeeS8XOf8MMnxWpXLBflYPtiwwLkx8dDPj0A+/wySRlGmikn 47kA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=RJSBonDD; spf=pass (google.com: domain of drinkcat@chromium.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=drinkcat@chromium.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id r29sor27233867pfk.38.2018.12.04.21.48.50 for (Google Transport Security); Tue, 04 Dec 2018 21:48:50 -0800 (PST) Received-SPF: pass (google.com: domain of drinkcat@chromium.org designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=RJSBonDD; spf=pass (google.com: domain of drinkcat@chromium.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=drinkcat@chromium.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Mtj+5lLpDKXzv34oRdlikvP0Q/L3pkB7CbeDcaUQ2ak=; b=RJSBonDDmVEWs69m9HOjZuGuqOpCHmEu3NrRrK9BUoJUXpNKmfFBa/K9sBDN9HQqGh 2ZMUshSZxpFyy3R/xn0fNdnzD/OwClqvrwVW7yxt56sC7V8w/aBqcc+M6P6ZdmJBInbV xpbXCfLfeacU+cokjOF3Z/mV3EHPLT5eakXq4= X-Google-Smtp-Source: AFSGD/XIZbASUT86Hq6bBLcbgIr8yOKCqq/M0hjDPq1OmQpZfK1rdsqT2OjTw5YTsOUmsgwtOM+HyQ== X-Received: by 2002:a62:7dcb:: with SMTP id y194mr23238987pfc.113.1543988930153; Tue, 04 Dec 2018 21:48:50 -0800 (PST) Received: from drinkcat2.tpe.corp.google.com ([2401:fa00:1:b:f659:7f17:ea11:4e8e]) by smtp.gmail.com with ESMTPSA id 4sm30806513pfq.10.2018.12.04.21.48.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 04 Dec 2018 21:48:49 -0800 (PST) From: Nicolas Boichat To: Will Deacon Cc: Robin Murphy , Joerg Roedel , Christoph Lameter , Pekka Enberg , David Rientjes , Joonsoo Kim , Andrew Morton , Vlastimil Babka , Michal Hocko , Mel Gorman , Levin Alexander , Huaisheng Ye , Mike Rapoport , linux-arm-kernel@lists.infradead.org, iommu@lists.linux-foundation.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, Yong Wu , Matthias Brugger , Tomasz Figa , yingjoe.chen@mediatek.com, hch@infradead.org, Matthew Wilcox Subject: [PATCH v4 1/3] mm: slab/slub: Add check_slab_flags function to check for valid flags Date: Wed, 5 Dec 2018 13:48:26 +0800 Message-Id: <20181205054828.183476-2-drinkcat@chromium.org> X-Mailer: git-send-email 2.20.0.rc1.387.gf8505762e3-goog In-Reply-To: <20181205054828.183476-1-drinkcat@chromium.org> References: <20181205054828.183476-1-drinkcat@chromium.org> MIME-Version: 1.0 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: X-Virus-Scanned: ClamAV using ClamSMTP Remove duplicated code between slab and slub, and will make it easier to make the test more complicated in the next commits. Fixes: ad67f5a6545f ("arm64: replace ZONE_DMA with ZONE_DMA32") Signed-off-by: Nicolas Boichat Acked-by: Vlastimil Babka --- mm/internal.h | 18 ++++++++++++++++-- mm/slab.c | 8 +------- mm/slub.c | 8 +------- 3 files changed, 18 insertions(+), 16 deletions(-) diff --git a/mm/internal.h b/mm/internal.h index f0c9ccde3bdb9e..a2ee82a0cd44ae 100644 --- a/mm/internal.h +++ b/mm/internal.h @@ -33,8 +33,22 @@ /* Control allocation cpuset and node placement constraints */ #define GFP_CONSTRAINT_MASK (__GFP_HARDWALL|__GFP_THISNODE) -/* Do not use these with a slab allocator */ -#define GFP_SLAB_BUG_MASK (__GFP_DMA32|__GFP_HIGHMEM|~__GFP_BITS_MASK) +/* Check for flags that must not be used with a slab allocator */ +static inline gfp_t check_slab_flags(gfp_t flags) +{ + gfp_t bug_mask = __GFP_DMA32 | __GFP_HIGHMEM | ~__GFP_BITS_MASK; + + if (unlikely(flags & bug_mask)) { + gfp_t invalid_mask = flags & bug_mask; + + flags &= ~bug_mask; + pr_warn("Unexpected gfp: %#x (%pGg). Fixing up to gfp: %#x (%pGg). Fix your code!\n", + invalid_mask, &invalid_mask, flags, &flags); + dump_stack(); + } + + return flags; +} void page_writeback_init(void); diff --git a/mm/slab.c b/mm/slab.c index 73fe23e649c91a..65a774f05e7836 100644 --- a/mm/slab.c +++ b/mm/slab.c @@ -2643,13 +2643,7 @@ static struct page *cache_grow_begin(struct kmem_cache *cachep, * Be lazy and only check for valid flags here, keeping it out of the * critical path in kmem_cache_alloc(). */ - if (unlikely(flags & GFP_SLAB_BUG_MASK)) { - gfp_t invalid_mask = flags & GFP_SLAB_BUG_MASK; - flags &= ~GFP_SLAB_BUG_MASK; - pr_warn("Unexpected gfp: %#x (%pGg). Fixing up to gfp: %#x (%pGg). Fix your code!\n", - invalid_mask, &invalid_mask, flags, &flags); - dump_stack(); - } + flags = check_slab_flags(flags); WARN_ON_ONCE(cachep->ctor && (flags & __GFP_ZERO)); local_flags = flags & (GFP_CONSTRAINT_MASK|GFP_RECLAIM_MASK); diff --git a/mm/slub.c b/mm/slub.c index c229a9b7dd5448..21a3f6866da472 100644 --- a/mm/slub.c +++ b/mm/slub.c @@ -1685,13 +1685,7 @@ static struct page *allocate_slab(struct kmem_cache *s, gfp_t flags, int node) static struct page *new_slab(struct kmem_cache *s, gfp_t flags, int node) { - if (unlikely(flags & GFP_SLAB_BUG_MASK)) { - gfp_t invalid_mask = flags & GFP_SLAB_BUG_MASK; - flags &= ~GFP_SLAB_BUG_MASK; - pr_warn("Unexpected gfp: %#x (%pGg). Fixing up to gfp: %#x (%pGg). Fix your code!\n", - invalid_mask, &invalid_mask, flags, &flags); - dump_stack(); - } + flags = check_slab_flags(flags); return allocate_slab(s, flags & (GFP_RECLAIM_MASK | GFP_CONSTRAINT_MASK), node); From patchwork Wed Dec 5 05:48:27 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolas Boichat X-Patchwork-Id: 10713015 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 25190157A for ; Wed, 5 Dec 2018 05:48:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0FD2B2C8A5 for ; Wed, 5 Dec 2018 05:48:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 044092C8AE; Wed, 5 Dec 2018 05:48:58 +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=-3.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4539E2C8A5 for ; Wed, 5 Dec 2018 05:48:57 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 549936B72C9; Wed, 5 Dec 2018 00:48:56 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 4FA7A6B72CA; Wed, 5 Dec 2018 00:48:56 -0500 (EST) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3C3256B72CB; Wed, 5 Dec 2018 00:48:56 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-pf1-f199.google.com (mail-pf1-f199.google.com [209.85.210.199]) by kanga.kvack.org (Postfix) with ESMTP id EE2326B72C9 for ; Wed, 5 Dec 2018 00:48:55 -0500 (EST) Received: by mail-pf1-f199.google.com with SMTP id q63so14371989pfi.19 for ; Tue, 04 Dec 2018 21:48:55 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:dkim-signature:from:to:cc:subject:date :message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=Z0BiixZmP1pDhSC3KjyxkVa455GEDPvgYqpZeuzB8Xo=; b=OMwbcrAgpSWPLsVItfSE+rqgYa203Qk3pvZrZz7t/+CwhxLdccVcbfNqW0IYyzdFeL 5pK+4jO3wEpuyWbFUiaY/xBsBsRBpFVkf4X4oVI9QE6EsJZykbdoVTOP0vabCGIQdhlh zQ6LE/8+MThaV0rVRUIatDfurAI4clvgTE7IOE856GNy4kAs+ko7k7WV0hh1zPAwywoF HZCR/NkWUzaHryiUON6VMNUHd1dyFQwc49286U2IMnEC+yL9Sz0lGy4Q4wcB2Pw1ypd6 6OedAjeqKVeoy0bOVupyZB0MvxEaJHlwlkJOSWKp8Rllhw1Bjv19tTZfSgSI62AIUvSi ispA== X-Gm-Message-State: AA+aEWYrh8mIduWsL/HdtM3jyRImpoZ/Wg0DhWMnytkdmxTVxMpXblpc gCQEeU4Iv9irfXPVuYPqhWAm5V+OnCerdpz5mMzeonX1zHx6+53BbnaRVduj6/hjuniRioFuRt4 LXB9EFVE4E7o/H9HHnlJ4RV4QpY7kFB6qS2wTtY8kIZfM1IRtPxPfNZwzOOEVqrCdcfJvP9K2ct Tn4AgRjyTL38jbOzjhMvwoQhVxonnj/X17stNJRv6qUQEL5jXWcxKRQJBZSoiYfL1Lth1mvxjcN MlYjZaANA1j0yXjm9lQ9YNho0Cl/FmGieP4soVyiIJ56qc8JT1potZdMP+V5+TDl99AKlK3eVMI u3P+j2X078nw/G4WxtKIdZnWbHmuGRFjHD3Peo2t+3H8g5TEsmEzQqKwvOzPdiqD/rnBsm+/lXG Q X-Received: by 2002:a17:902:7683:: with SMTP id m3mr4267668pll.187.1543988935613; Tue, 04 Dec 2018 21:48:55 -0800 (PST) X-Received: by 2002:a17:902:7683:: with SMTP id m3mr4267643pll.187.1543988934644; Tue, 04 Dec 2018 21:48:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543988934; cv=none; d=google.com; s=arc-20160816; b=Y5p3jcVGAHjl73Gdcv2WS9ycpjbFvGiR/usXXX6Lqeha5VVFB1zfUGyexlKG0jVAWa pKl0/Q351B7OLtLYFgxwdasIiwl2NwihHEA4m2sM6BOnV7TJ4sR9q2RRzJwdZXapdFNe ozqi229XnY0Ks/pDHHu4e3h+0+aEJkY3ugULyZD6K/I7DcDW92Is9GQJ/lhUw8LBz9GQ 2Tq8SdlQBSCwfr6At8Mqvi89leNEvI/PKLBKq9FB1Iz017x8GkETlqFBCpjT5BmhCj2m 8v9vdp39CNayUxC60Xz2z832YnRkqKz0QrCoi8odj3aCuC7+IWSZ/IMPYMWrzNXA3dVL 5GPg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=Z0BiixZmP1pDhSC3KjyxkVa455GEDPvgYqpZeuzB8Xo=; b=mVKpVsKg7BVgFAAs/jN8iMtgSoct+7FdsUobxI0IFbfkp/W90NuoHywBhgc/Vbszps 9Am9RM/MwoWcWHtdh7uJPUcadaTvvpnN+s8kByOkK3K6OmDwjfMqZS/CyFI7XGroe12x u7yJLKRjYfNr8ASzrq0YnrgG3zz+VHcfkuTnhYvQnzyV4XN2ne5joHkmpBgh2Y8UAJlY W5eyugdAFrzfeX3h/Rw57vT0em8OMY2bBmpGXlse0xdurfiLI5uS2hNZHHMyeojY36tT 9q8cNSIdTBjdWdLGmTVko4SYrxpig8CImRDkoWWP+dvTEc5Z9Gw8+35i/V99iZzVGsR5 ya1Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=DLh7U26H; spf=pass (google.com: domain of drinkcat@chromium.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=drinkcat@chromium.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id m3sor25647651plt.31.2018.12.04.21.48.54 for (Google Transport Security); Tue, 04 Dec 2018 21:48:54 -0800 (PST) Received-SPF: pass (google.com: domain of drinkcat@chromium.org designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=DLh7U26H; spf=pass (google.com: domain of drinkcat@chromium.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=drinkcat@chromium.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Z0BiixZmP1pDhSC3KjyxkVa455GEDPvgYqpZeuzB8Xo=; b=DLh7U26Hh8G7gZqeF58owtcmnf00W1CSfPGZXqTphZxw3n92e4i4vnbGd3ncbZHWLH cE0J5hjftyVZQmcJSYGFOheYEwkcYjcjvrUuvS1Lyc6traqdreqHNRLGzMBa0biF7mgR FyOgXrCBsLMKCBdyZGCjI/ds1PBLClWNXtFPI= X-Google-Smtp-Source: AFSGD/VrepCldjN2YYNX0nsK1ITTULAfBCyD8ySUtPTonL4vNny3UxhLTQGbUwm1epEq1bdtJ69FDw== X-Received: by 2002:a17:902:b595:: with SMTP id a21mr22018831pls.120.1543988934155; Tue, 04 Dec 2018 21:48:54 -0800 (PST) Received: from drinkcat2.tpe.corp.google.com ([2401:fa00:1:b:f659:7f17:ea11:4e8e]) by smtp.gmail.com with ESMTPSA id 4sm30806513pfq.10.2018.12.04.21.48.50 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 04 Dec 2018 21:48:53 -0800 (PST) From: Nicolas Boichat To: Will Deacon Cc: Robin Murphy , Joerg Roedel , Christoph Lameter , Pekka Enberg , David Rientjes , Joonsoo Kim , Andrew Morton , Vlastimil Babka , Michal Hocko , Mel Gorman , Levin Alexander , Huaisheng Ye , Mike Rapoport , linux-arm-kernel@lists.infradead.org, iommu@lists.linux-foundation.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, Yong Wu , Matthias Brugger , Tomasz Figa , yingjoe.chen@mediatek.com, hch@infradead.org, Matthew Wilcox Subject: [PATCH v4 2/3] mm: Add support for kmem caches in DMA32 zone Date: Wed, 5 Dec 2018 13:48:27 +0800 Message-Id: <20181205054828.183476-3-drinkcat@chromium.org> X-Mailer: git-send-email 2.20.0.rc1.387.gf8505762e3-goog In-Reply-To: <20181205054828.183476-1-drinkcat@chromium.org> References: <20181205054828.183476-1-drinkcat@chromium.org> MIME-Version: 1.0 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: X-Virus-Scanned: ClamAV using ClamSMTP In some cases (e.g. IOMMU ARMv7s page allocator), we need to allocate data structures smaller than a page with GFP_DMA32 flag. This change makes it possible to create a custom cache in DMA32 zone using kmem_cache_create, then allocate memory using kmem_cache_alloc. We do not create a DMA32 kmalloc cache array, as there are currently no users of kmalloc(..., GFP_DMA32). The new test in check_slab_flags ensures that such calls still fail (as they do before this change). Fixes: ad67f5a6545f ("arm64: replace ZONE_DMA with ZONE_DMA32") Signed-off-by: Nicolas Boichat Acked-by: Vlastimil Babka --- Changes since v2: - Clarified commit message - Add entry in sysfs-kernel-slab to document the new sysfs file (v3 used the page_frag approach) Documentation/ABI/testing/sysfs-kernel-slab | 9 +++++++++ include/linux/slab.h | 2 ++ mm/internal.h | 8 ++++++-- mm/slab.c | 4 +++- mm/slab.h | 3 ++- mm/slab_common.c | 2 +- mm/slub.c | 18 +++++++++++++++++- 7 files changed, 40 insertions(+), 6 deletions(-) diff --git a/Documentation/ABI/testing/sysfs-kernel-slab b/Documentation/ABI/testing/sysfs-kernel-slab index 29601d93a1c2ea..d742c6cfdffbe9 100644 --- a/Documentation/ABI/testing/sysfs-kernel-slab +++ b/Documentation/ABI/testing/sysfs-kernel-slab @@ -106,6 +106,15 @@ Description: are from ZONE_DMA. Available when CONFIG_ZONE_DMA is enabled. +What: /sys/kernel/slab/cache/cache_dma32 +Date: December 2018 +KernelVersion: 4.21 +Contact: Nicolas Boichat +Description: + The cache_dma32 file is read-only and specifies whether objects + are from ZONE_DMA32. + Available when CONFIG_ZONE_DMA32 is enabled. + What: /sys/kernel/slab/cache/cpu_slabs Date: May 2007 KernelVersion: 2.6.22 diff --git a/include/linux/slab.h b/include/linux/slab.h index 11b45f7ae4057c..9449b19c5f107a 100644 --- a/include/linux/slab.h +++ b/include/linux/slab.h @@ -32,6 +32,8 @@ #define SLAB_HWCACHE_ALIGN ((slab_flags_t __force)0x00002000U) /* Use GFP_DMA memory */ #define SLAB_CACHE_DMA ((slab_flags_t __force)0x00004000U) +/* Use GFP_DMA32 memory */ +#define SLAB_CACHE_DMA32 ((slab_flags_t __force)0x00008000U) /* DEBUG: Store the last owner for bug hunting */ #define SLAB_STORE_USER ((slab_flags_t __force)0x00010000U) /* Panic if kmem_cache_create() fails */ diff --git a/mm/internal.h b/mm/internal.h index a2ee82a0cd44ae..fd244ad716eaf8 100644 --- a/mm/internal.h +++ b/mm/internal.h @@ -14,6 +14,7 @@ #include #include #include +#include #include /* @@ -34,9 +35,12 @@ #define GFP_CONSTRAINT_MASK (__GFP_HARDWALL|__GFP_THISNODE) /* Check for flags that must not be used with a slab allocator */ -static inline gfp_t check_slab_flags(gfp_t flags) +static inline gfp_t check_slab_flags(gfp_t flags, slab_flags_t slab_flags) { - gfp_t bug_mask = __GFP_DMA32 | __GFP_HIGHMEM | ~__GFP_BITS_MASK; + gfp_t bug_mask = __GFP_HIGHMEM | ~__GFP_BITS_MASK; + + if (!IS_ENABLED(CONFIG_ZONE_DMA32) || !(slab_flags & SLAB_CACHE_DMA32)) + bug_mask |= __GFP_DMA32; if (unlikely(flags & bug_mask)) { gfp_t invalid_mask = flags & bug_mask; diff --git a/mm/slab.c b/mm/slab.c index 65a774f05e7836..2fd3b9a996cbe6 100644 --- a/mm/slab.c +++ b/mm/slab.c @@ -2109,6 +2109,8 @@ int __kmem_cache_create(struct kmem_cache *cachep, slab_flags_t flags) cachep->allocflags = __GFP_COMP; if (flags & SLAB_CACHE_DMA) cachep->allocflags |= GFP_DMA; + if (flags & SLAB_CACHE_DMA32) + cachep->allocflags |= GFP_DMA32; if (flags & SLAB_RECLAIM_ACCOUNT) cachep->allocflags |= __GFP_RECLAIMABLE; cachep->size = size; @@ -2643,7 +2645,7 @@ static struct page *cache_grow_begin(struct kmem_cache *cachep, * Be lazy and only check for valid flags here, keeping it out of the * critical path in kmem_cache_alloc(). */ - flags = check_slab_flags(flags); + flags = check_slab_flags(flags, cachep->flags); WARN_ON_ONCE(cachep->ctor && (flags & __GFP_ZERO)); local_flags = flags & (GFP_CONSTRAINT_MASK|GFP_RECLAIM_MASK); diff --git a/mm/slab.h b/mm/slab.h index 4190c24ef0e9df..fcf717e12f0a86 100644 --- a/mm/slab.h +++ b/mm/slab.h @@ -127,7 +127,8 @@ static inline slab_flags_t kmem_cache_flags(unsigned int object_size, /* Legal flag mask for kmem_cache_create(), for various configurations */ -#define SLAB_CORE_FLAGS (SLAB_HWCACHE_ALIGN | SLAB_CACHE_DMA | SLAB_PANIC | \ +#define SLAB_CORE_FLAGS (SLAB_HWCACHE_ALIGN | SLAB_CACHE_DMA | \ + SLAB_CACHE_DMA32 | SLAB_PANIC | \ SLAB_TYPESAFE_BY_RCU | SLAB_DEBUG_OBJECTS ) #if defined(CONFIG_DEBUG_SLAB) diff --git a/mm/slab_common.c b/mm/slab_common.c index 70b0cc85db67f8..18b7b809c8d064 100644 --- a/mm/slab_common.c +++ b/mm/slab_common.c @@ -53,7 +53,7 @@ static DECLARE_WORK(slab_caches_to_rcu_destroy_work, SLAB_FAILSLAB | SLAB_KASAN) #define SLAB_MERGE_SAME (SLAB_RECLAIM_ACCOUNT | SLAB_CACHE_DMA | \ - SLAB_ACCOUNT) + SLAB_CACHE_DMA32 | SLAB_ACCOUNT) /* * Merge control. If this is set then no merging of slab caches will occur. diff --git a/mm/slub.c b/mm/slub.c index 21a3f6866da472..6d47765a82d150 100644 --- a/mm/slub.c +++ b/mm/slub.c @@ -1685,7 +1685,7 @@ static struct page *allocate_slab(struct kmem_cache *s, gfp_t flags, int node) static struct page *new_slab(struct kmem_cache *s, gfp_t flags, int node) { - flags = check_slab_flags(flags); + flags = check_slab_flags(flags, s->flags); return allocate_slab(s, flags & (GFP_RECLAIM_MASK | GFP_CONSTRAINT_MASK), node); @@ -3577,6 +3577,9 @@ static int calculate_sizes(struct kmem_cache *s, int forced_order) if (s->flags & SLAB_CACHE_DMA) s->allocflags |= GFP_DMA; + if (s->flags & SLAB_CACHE_DMA32) + s->allocflags |= GFP_DMA32; + if (s->flags & SLAB_RECLAIM_ACCOUNT) s->allocflags |= __GFP_RECLAIMABLE; @@ -5095,6 +5098,14 @@ static ssize_t cache_dma_show(struct kmem_cache *s, char *buf) SLAB_ATTR_RO(cache_dma); #endif +#ifdef CONFIG_ZONE_DMA32 +static ssize_t cache_dma32_show(struct kmem_cache *s, char *buf) +{ + return sprintf(buf, "%d\n", !!(s->flags & SLAB_CACHE_DMA32)); +} +SLAB_ATTR_RO(cache_dma32); +#endif + static ssize_t usersize_show(struct kmem_cache *s, char *buf) { return sprintf(buf, "%u\n", s->usersize); @@ -5435,6 +5446,9 @@ static struct attribute *slab_attrs[] = { #ifdef CONFIG_ZONE_DMA &cache_dma_attr.attr, #endif +#ifdef CONFIG_ZONE_DMA32 + &cache_dma32_attr.attr, +#endif #ifdef CONFIG_NUMA &remote_node_defrag_ratio_attr.attr, #endif @@ -5665,6 +5679,8 @@ static char *create_unique_id(struct kmem_cache *s) */ if (s->flags & SLAB_CACHE_DMA) *p++ = 'd'; + if (s->flags & SLAB_CACHE_DMA32) + *p++ = 'D'; if (s->flags & SLAB_RECLAIM_ACCOUNT) *p++ = 'a'; if (s->flags & SLAB_CONSISTENCY_CHECKS) From patchwork Wed Dec 5 05:48:28 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolas Boichat X-Patchwork-Id: 10713017 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 D2A15157A for ; Wed, 5 Dec 2018 05:49:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C2D362C8A5 for ; Wed, 5 Dec 2018 05:49:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B6F7A2C8AC; Wed, 5 Dec 2018 05:49:01 +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=-3.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2E5F72C8A5 for ; Wed, 5 Dec 2018 05:49:01 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 154906B72CB; Wed, 5 Dec 2018 00:49:00 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 103336B72CD; Wed, 5 Dec 2018 00:49:00 -0500 (EST) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id F1BB66B72CB; Wed, 5 Dec 2018 00:48:59 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-pf1-f198.google.com (mail-pf1-f198.google.com [209.85.210.198]) by kanga.kvack.org (Postfix) with ESMTP id AFA0F6B72CB for ; Wed, 5 Dec 2018 00:48:59 -0500 (EST) Received: by mail-pf1-f198.google.com with SMTP id s14so15930225pfk.16 for ; Tue, 04 Dec 2018 21:48:59 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:dkim-signature:from:to:cc:subject:date :message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=vWhAhLkOVslUb8AGYpRlcTEDGRqYlnK33vbjofTVSKg=; b=Jqr0HkBvqAwz014e9/UViKNqxrPj9mFeNgrFf/AbEdJD+68JsfjUq/qOzGX6jChFgZ c9kwzXrizFyOb30kbXKbBEgkUj70ea9sA3XKK786/OPiwmvBIAHGqGAsZ6c0MKR6GIqN 2ttA0ipStay7/FZF/IfEUkre0wLLagOFKihrGTEzQTBAqeUsD/HlUcVpQLK7hggm/MIP rl1B9DY7gLFhEePtiCtc4s72OfDfYpYBr5iQdvaBkz+haRLTfLLySw3cL9c+fxQL2R9P wxUYMozR5OsHvgPXXJOLNVxZ6ACHaP/Bpot6lADlAaowGQ9UotCosR2zT/urMTNKlzEM u4Cg== X-Gm-Message-State: AA+aEWb2zG/TFrETAUu+bwn2gBf7zANUPoosFhLhPu7ZVl6LYyLLZRh+ HAUlBXyT92JQ2lcO0osm6lOemmXVtw0vQDGJX9USA0nTkB6TBaNzMyJv3SssDfMNkVSbYMEMZO8 sfNi1vaKWvohB+tLQi0eaS80nsnV+9HaLI3e24FACLv8xiLbyJKd841SFm0QgLfkbhua/ZGgAdv y1xBEXKoZwsHMKWP9oHkopsOg0kF71sCPgp/nNwehZSg7pynoKdIrTojweQL/47CjZ0vT/mCRaw hr9Y49Z0bAyjtZcigr+umnqT1sVIkDG2UkKlUmew59lW549P2le43SrDYTSYBlyZ2n967u1ORXG LX0ymH1tpThq+98RWcGp60I++VeP3BYyEn5ENP1VLZ8OueZ1dWjdfOMKEHCQXDjwTe/ddGmWzEF Q X-Received: by 2002:a63:b218:: with SMTP id x24mr18728964pge.223.1543988939362; Tue, 04 Dec 2018 21:48:59 -0800 (PST) X-Received: by 2002:a63:b218:: with SMTP id x24mr18728944pge.223.1543988938536; Tue, 04 Dec 2018 21:48:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543988938; cv=none; d=google.com; s=arc-20160816; b=IveiFU9IZv+3CvbH7FFUvxRFP+c9aOQQJr4mGfjkXkJZ3Lk4Xz1Owp1gd/YMxl+KjB JPLcz9CNseaot4zSj2LJxEKC4VDTYL41m66w+PKcywt7pj4fyPyQ1GWCKUoxcXaSL0kj bIFXwI7cm6mfah8z3DuVf+uh5ofvBlC/4Q3lVao+T9nBC6+TeSVmYsOmXjnrKq6uxubH M5/QYHBFj3qKfv6bwKmBIpK1V2DdNF1Mvh6FEx2VURAchuZtcEn0KNH/Es4YOrXNHxgL fmQ7gt5l4zANObPBDTqrRIoJvfnVHD6TIe8FqDWwWwrlWxfTqSrUAzxk9a2aJyGOrQkV ptbg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=vWhAhLkOVslUb8AGYpRlcTEDGRqYlnK33vbjofTVSKg=; b=VQCsJksLN4skfnEUxJWXp8l0iUX8hNadPJZTCqB8ZRL9mrRHwpsQUmg6uuY3u0xgaw 0Vc4gJs6Rc3Yt/ots93tC11FW3aFJyrK4yrM+OQTitz87itJLJBsqkSJL8P2xQ+HGMVo J538vbuPz+cXxo84Nzemk9yWX3ZfjyOoNomW3se1Tl0QH0MZrjUvbE25Bvz48TIXlpZ3 sUTXlM0AxN/1xD8PlyWggNv4jrv7aeKvJgNLzgECRgfp2fidupiNSLfd0TD/0RWW2FYd qCln2fprq+9vzW8NVuuZqMREf+AuolbK1di1+mzg0ZkGbS43fUOtUk9/7F9oI+V5CUpd 6A9A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=Ghvx7Srz; spf=pass (google.com: domain of drinkcat@chromium.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=drinkcat@chromium.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id k11sor26087189pll.39.2018.12.04.21.48.58 for (Google Transport Security); Tue, 04 Dec 2018 21:48:58 -0800 (PST) Received-SPF: pass (google.com: domain of drinkcat@chromium.org designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=Ghvx7Srz; spf=pass (google.com: domain of drinkcat@chromium.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=drinkcat@chromium.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=vWhAhLkOVslUb8AGYpRlcTEDGRqYlnK33vbjofTVSKg=; b=Ghvx7SrzrvOWt9iw9+n5jZ87Tl7UOaD02HoAC3peGH3KyiLo3niR48nxltOOoNpikP AXmdTlvLOzKrhtYVVs6NFLm5qNAqhe/Pw0Xcp6dwMzbyvMW5RPBAcWGEnKb508AfoBlt iwIXiQWvM4l59LTcMGKwE6VDaNtnpp7RulPmg= X-Google-Smtp-Source: AFSGD/VxTWcri7yQ/slMRzGNhZW0Xvh/a+9X/iz/yVfMl1irVge09KKfwpdURxLUulLz9sebxIBWHQ== X-Received: by 2002:a17:902:2468:: with SMTP id m37mr4041699plg.314.1543988938116; Tue, 04 Dec 2018 21:48:58 -0800 (PST) Received: from drinkcat2.tpe.corp.google.com ([2401:fa00:1:b:f659:7f17:ea11:4e8e]) by smtp.gmail.com with ESMTPSA id 4sm30806513pfq.10.2018.12.04.21.48.54 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 04 Dec 2018 21:48:57 -0800 (PST) From: Nicolas Boichat To: Will Deacon Cc: Robin Murphy , Joerg Roedel , Christoph Lameter , Pekka Enberg , David Rientjes , Joonsoo Kim , Andrew Morton , Vlastimil Babka , Michal Hocko , Mel Gorman , Levin Alexander , Huaisheng Ye , Mike Rapoport , linux-arm-kernel@lists.infradead.org, iommu@lists.linux-foundation.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, Yong Wu , Matthias Brugger , Tomasz Figa , yingjoe.chen@mediatek.com, hch@infradead.org, Matthew Wilcox Subject: [PATCH v4 3/3] iommu/io-pgtable-arm-v7s: Request DMA32 memory, and improve debugging Date: Wed, 5 Dec 2018 13:48:28 +0800 Message-Id: <20181205054828.183476-4-drinkcat@chromium.org> X-Mailer: git-send-email 2.20.0.rc1.387.gf8505762e3-goog In-Reply-To: <20181205054828.183476-1-drinkcat@chromium.org> References: <20181205054828.183476-1-drinkcat@chromium.org> MIME-Version: 1.0 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: X-Virus-Scanned: ClamAV using ClamSMTP IOMMUs using ARMv7 short-descriptor format require page tables (level 1 and 2) to be allocated within the first 4GB of RAM, even on 64-bit systems. For level 1/2 pages, ensure GFP_DMA32 is used if CONFIG_ZONE_DMA32 is defined (e.g. on arm64 platforms). For level 2 pages, allocate a slab cache in SLAB_CACHE_DMA32. Also, print an error when the physical address does not fit in 32-bit, to make debugging easier in the future. Fixes: ad67f5a6545f ("arm64: replace ZONE_DMA with ZONE_DMA32") Signed-off-by: Nicolas Boichat --- Changes since v2: - Commit message (v3 used the page_frag approach) drivers/iommu/io-pgtable-arm-v7s.c | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/drivers/iommu/io-pgtable-arm-v7s.c b/drivers/iommu/io-pgtable-arm-v7s.c index 445c3bde04800c..996f7b6d00b44a 100644 --- a/drivers/iommu/io-pgtable-arm-v7s.c +++ b/drivers/iommu/io-pgtable-arm-v7s.c @@ -161,6 +161,14 @@ #define ARM_V7S_TCR_PD1 BIT(5) +#ifdef CONFIG_ZONE_DMA32 +#define ARM_V7S_TABLE_GFP_DMA GFP_DMA32 +#define ARM_V7S_TABLE_SLAB_CACHE SLAB_CACHE_DMA32 +#else +#define ARM_V7S_TABLE_GFP_DMA GFP_DMA +#define ARM_V7S_TABLE_SLAB_CACHE SLAB_CACHE_DMA +#endif + typedef u32 arm_v7s_iopte; static bool selftest_running; @@ -198,13 +206,17 @@ static void *__arm_v7s_alloc_table(int lvl, gfp_t gfp, void *table = NULL; if (lvl == 1) - table = (void *)__get_dma_pages(__GFP_ZERO, get_order(size)); + table = (void *)__get_free_pages( + __GFP_ZERO | ARM_V7S_TABLE_GFP_DMA, get_order(size)); else if (lvl == 2) - table = kmem_cache_zalloc(data->l2_tables, gfp | GFP_DMA); + table = kmem_cache_zalloc(data->l2_tables, + gfp | ARM_V7S_TABLE_GFP_DMA); phys = virt_to_phys(table); - if (phys != (arm_v7s_iopte)phys) + if (phys != (arm_v7s_iopte)phys) { /* Doesn't fit in PTE */ + dev_err(dev, "Page table does not fit in PTE: %pa", &phys); goto out_free; + } if (table && !(cfg->quirks & IO_PGTABLE_QUIRK_NO_DMA)) { dma = dma_map_single(dev, table, size, DMA_TO_DEVICE); if (dma_mapping_error(dev, dma)) @@ -737,7 +749,7 @@ static struct io_pgtable *arm_v7s_alloc_pgtable(struct io_pgtable_cfg *cfg, data->l2_tables = kmem_cache_create("io-pgtable_armv7s_l2", ARM_V7S_TABLE_SIZE(2), ARM_V7S_TABLE_SIZE(2), - SLAB_CACHE_DMA, NULL); + ARM_V7S_TABLE_SLAB_CACHE, NULL); if (!data->l2_tables) goto out_free_data;