From patchwork Tue Dec 18 13:30:33 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrey Konovalov X-Patchwork-Id: 10735659 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 752866C2 for ; Tue, 18 Dec 2018 13:30:44 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 64D702A07D for ; Tue, 18 Dec 2018 13:30:44 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 588D82A087; Tue, 18 Dec 2018 13:30:44 +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=-10.5 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE, USER_IN_DEF_DKIM_WL autolearn=unavailable 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 F1CBE2A096 for ; Tue, 18 Dec 2018 13:30:43 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id CDD848E0007; Tue, 18 Dec 2018 08:30:42 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id C8B448E0001; Tue, 18 Dec 2018 08:30:42 -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 B2EBC8E0007; Tue, 18 Dec 2018 08:30:42 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-wr1-f70.google.com (mail-wr1-f70.google.com [209.85.221.70]) by kanga.kvack.org (Postfix) with ESMTP id 570BB8E0001 for ; Tue, 18 Dec 2018 08:30:42 -0500 (EST) Received: by mail-wr1-f70.google.com with SMTP id f18so5262971wrt.1 for ; Tue, 18 Dec 2018 05:30:42 -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:mime-version:content-transfer-encoding; bh=1DLr9hZIqfTBfQ8vZM5TVqGu/0wSU0e2RGylEo0U1xk=; b=F1hazPvvwRRZWtuFVSLT9ck7ysfrd82+lg7+8oIw9BAYnT6vcqHpl+82OZ7usSDJFI ccRH2qo2izBcu6EkAX4IkaGYdfY7xIe99kV8YavsZt9nF8FGsbP7H449NRSuXaVjM/LN VcouIjQtuvGBRH0vVplfnazGNMsOiaI9xJs6k6SHxa9VpfUDL2fuVE0loSae150jPiLK SwRnbMY3ckEfyMoulnWWSbWw4RiuyO8XEFJb+tmE2FL6fk9YdsDJ5a09aKDNlWCOU4IJ ulLXkM49rZLFiUdXA+PhplWPG+iFGSiU6tTwMegglZ8UWQIkU4VNOapzgnGCpUd3nvt8 fH0Q== X-Gm-Message-State: AA+aEWYGHayx9buODSLRdqywjZBge56KqHmncfZl2uaGxKszig9oSd1c Sb4TUoehbh49se2wrwQDE896RKWSbqxhi/OAEJmuFzaFSjPHox1cPL4h6hnjOGgyJ3SpfJtT2v/ OMdWhg3UUdN/KeNtBrFYhP3WlP1TG+IfP5PNAWiV//RT6G73h0yt5N2wedlNiLHawRIOQytIpL4 QD2Qyrd23XjyiY5cn4nPM+itOaNrGzxBgnANKf8CPouFydWb2pxDxUKyMGZP/rS6KaHleJjrzSR VqTrf+MuoGuetdy4Xyuksrz+CgksGUaRDVUqHDEGv8DH7dglKoXPJSSGYSi/0RBh13d8BFemQmf zVVHSKv4cOv5RNGIxO7Wy4ba4sxFkhlgZg3+PG7bO343407ABk4U92pbjQz1E75icrUawIz6yiJ L X-Received: by 2002:a1c:650b:: with SMTP id z11mr3237196wmb.23.1545139841732; Tue, 18 Dec 2018 05:30:41 -0800 (PST) X-Received: by 2002:a1c:650b:: with SMTP id z11mr3237124wmb.23.1545139840637; Tue, 18 Dec 2018 05:30:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1545139840; cv=none; d=google.com; s=arc-20160816; b=GzMDvxgsTnva/NajYdRoKk1liojUpJWPkH3OepSRfT+G3/ddKRajQGkINbH8oYybps 5xLfT66xQPysON3jhhI4iaMIa7wYyzEHHhkULD2WNYLsK8XSXaeJAWjuxWnelgLkYDZy Klk2vgqYO3srSUUJaza/DNtE0kUWmb7Y9qx8f7xwkjITw4ud06wbYnEDwVrMfkmLk7SO NW+SclZOOb0vXxEIYQiLXpcGNyV25eEDWjBJmbjVzocHdcxSDYi1fXCrLp8GvbKG55qO 8ksiDcmYuWYo6VipyxgiAtyc5ySPU1T0ta4TNXkArDJ3I0K4IRIaVILOwZ17UG5PE6QN 9jzA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:dkim-signature; bh=1DLr9hZIqfTBfQ8vZM5TVqGu/0wSU0e2RGylEo0U1xk=; b=PZKpYjgI0z99iZBF4MP3/AMDWsaIDxNw7HTjoD4UMy5wQagM6cg4tcPL1E3JPO7oes F/4cVIf7VysCZIbmD3LwfslBLD89wu7XGDG0i4GzBgWglsVAxkVCMTZr02p2d8HiWr1q SZE3B2fEmUAPc9eS0A2TSxxNzpHCeIry+NTV/VAYmAQK+fZStVG8vRS6x8aJHMxSwxeY zQVlVO9J42PmEADPMjX88Y+eerjCYX3BQdpnI3SP0ZAQheDIdmXO2WHxzNWY3lu9wXCP uEG8sksMtNYLyj6R+PlexYyrGJ0DJuFl+j+nARovU32upujAOuK6DmVdrwnDIC8199/x M9FA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=b6CeLxm4; spf=pass (google.com: domain of andreyknvl@google.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=andreyknvl@google.com; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id 69sor1716705wmy.3.2018.12.18.05.30.40 for (Google Transport Security); Tue, 18 Dec 2018 05:30:40 -0800 (PST) Received-SPF: pass (google.com: domain of andreyknvl@google.com designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=b6CeLxm4; spf=pass (google.com: domain of andreyknvl@google.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=andreyknvl@google.com; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=1DLr9hZIqfTBfQ8vZM5TVqGu/0wSU0e2RGylEo0U1xk=; b=b6CeLxm48QORSNimPysCsqnEvAwvbwCEMK3zZ2IeU55RUe8jfEaoKD7B2W5pu4GMVM ZMfAqk8UVGyjCZdWBu94z+/d06Nqhr39DI+oBkGQF6PQNRAP48V2nHE1nMmWB13EyfCm NtxsSWQvTBxTL+Fd0/UOOq7DzicVsxlDHD16s9b1lX0C6x/VSR5lAuzePhQ9L1d5Oul8 VXrACEN0B09HGP6S1WtlkS87efzvH+4OfJy778AP3n08axpCT24ejrd+gQ8n9Wv0ZFss zNcku1rhZAk/DpR9yt64U57aTzC8whKP5MKSsmn/EKNweqDVHhOPHIVAgeVnlG4EPeY4 Oa+Q== X-Google-Smtp-Source: AFSGD/Vk4dHI/WjETFO6q3mGOkSMUeOtBy8kBD/BEP66o/kq3hhOh6hYuClxgxsdrN7KcTWqc7mrIQ== X-Received: by 2002:a1c:a104:: with SMTP id k4mr3226049wme.54.1545139839904; Tue, 18 Dec 2018 05:30:39 -0800 (PST) Received: from andreyknvl0.muc.corp.google.com ([2a00:79e0:15:10:3180:41f8:3010:ff61]) by smtp.gmail.com with ESMTPSA id g188sm1995927wmf.32.2018.12.18.05.30.38 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 18 Dec 2018 05:30:38 -0800 (PST) From: Andrey Konovalov To: Andrey Ryabinin , Alexander Potapenko , Dmitry Vyukov , Catalin Marinas , Will Deacon , Christoph Lameter , Andrew Morton , Mark Rutland , Nick Desaulniers , Marc Zyngier , Dave Martin , Ard Biesheuvel , "Eric W . Biederman" , Ingo Molnar , Paul Lawrence , Geert Uytterhoeven , Arnd Bergmann , "Kirill A . Shutemov" , Greg Kroah-Hartman , Kate Stewart , Mike Rapoport , Vincenzo Frascino , kasan-dev@googlegroups.com, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-sparse@vger.kernel.org, linux-mm@kvack.org, linux-kbuild@vger.kernel.org Cc: Kostya Serebryany , Evgeniy Stepanov , Lee Smith , Ramana Radhakrishnan , Jacob Bramley , Ruben Ayrapetyan , Jann Horn , Mark Brand , Chintan Pandya , Vishwath Mohan , Andrey Konovalov Subject: [PATCH mm] kasan, arm64: use ARCH_SLAB_MINALIGN instead of manual aligning Date: Tue, 18 Dec 2018 14:30:33 +0100 Message-Id: <706da77adfceb0c324e824d03b52d58a752577ea.1545139710.git.andreyknvl@google.com> X-Mailer: git-send-email 2.20.0.405.gbc1bbc6f85-goog 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 Instead of changing cache->align to be aligned to KASAN_SHADOW_SCALE_SIZE in kasan_cache_create() we can reuse the ARCH_SLAB_MINALIGN macro. Suggested-by: Vincenzo Frascino Signed-off-by: Andrey Konovalov --- arch/arm64/include/asm/kasan.h | 4 ++++ mm/kasan/common.c | 2 -- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/arch/arm64/include/asm/kasan.h b/arch/arm64/include/asm/kasan.h index b52aacd2c526..ba26150d578d 100644 --- a/arch/arm64/include/asm/kasan.h +++ b/arch/arm64/include/asm/kasan.h @@ -36,6 +36,10 @@ #define KASAN_SHADOW_OFFSET (KASAN_SHADOW_END - (1ULL << \ (64 - KASAN_SHADOW_SCALE_SHIFT))) +#ifdef CONFIG_KASAN_SW_TAGS +#define ARCH_SLAB_MINALIGN (1ULL << KASAN_SHADOW_SCALE_SHIFT) +#endif + void kasan_init(void); void kasan_copy_shadow(pgd_t *pgdir); asmlinkage void kasan_early_init(void); diff --git a/mm/kasan/common.c b/mm/kasan/common.c index 03d5d1374ca7..44390392d4c9 100644 --- a/mm/kasan/common.c +++ b/mm/kasan/common.c @@ -298,8 +298,6 @@ void kasan_cache_create(struct kmem_cache *cache, unsigned int *size, return; } - cache->align = round_up(cache->align, KASAN_SHADOW_SCALE_SIZE); - *flags |= SLAB_KASAN; }