From patchwork Fri Feb 5 15:39:12 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrey Konovalov X-Patchwork-Id: 12070387 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.5 required=3.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED,DKIM_INVALID,DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1EEB3C433DB for ; Fri, 5 Feb 2021 15:39:48 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 9B508650F2 for ; Fri, 5 Feb 2021 15:39:47 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9B508650F2 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 124496B0078; Fri, 5 Feb 2021 10:39:47 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 0AE878D0005; Fri, 5 Feb 2021 10:39:47 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id EDD216B007D; Fri, 5 Feb 2021 10:39:46 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0166.hostedemail.com [216.40.44.166]) by kanga.kvack.org (Postfix) with ESMTP id CB28C6B0078 for ; Fri, 5 Feb 2021 10:39:46 -0500 (EST) Received: from smtpin15.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 98DE93621 for ; Fri, 5 Feb 2021 15:39:46 +0000 (UTC) X-FDA: 77784624372.15.run00_2906c01275e5 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin15.hostedemail.com (Postfix) with ESMTP id 6FAC51814B0C7 for ; Fri, 5 Feb 2021 15:39:46 +0000 (UTC) X-HE-Tag: run00_2906c01275e5 X-Filterd-Recvd-Size: 5504 Received: from mail-wr1-f73.google.com (mail-wr1-f73.google.com [209.85.221.73]) by imf47.hostedemail.com (Postfix) with ESMTP for ; Fri, 5 Feb 2021 15:39:45 +0000 (UTC) Received: by mail-wr1-f73.google.com with SMTP id r5so5574741wrx.18 for ; Fri, 05 Feb 2021 07:39:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=sender:date:in-reply-to:message-id:mime-version:references:subject :from:to:cc; bh=r9X5DpdR9qKQzOGqj5YPMHvNzUxwchyNv1XRoONrpMQ=; b=GinXCbIKDRoOgLUpKmgxzl260l9tsG2LG+b4gApdVcTyZiiVgLI843m0SQIZzi7Qae NfAp0Io+LgzQcCk69t45hFOJaqjI9KbQccxbpOgaJcJcsZgClEf6fOOjoLnqeysqDHzq FFGcssvQchbEYQAOQYIjmmCgsqDh8MRge4yFNbKPar14MoUKxkyYfLYU4IcGP5q5DCJ/ uq6GvLUb93p8KgHDIgo2/wB6GGYBaMGnvBP6ZxWTkuxb9g0ZXn0bOOLgzYqsobzl23WX ypCO6WqihQFQ1clhxfXOzKJRjdZ8iu8uQBbv8Tp6n8rPnb3bq8lPznSVsroHSUulMSsU BQGQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=r9X5DpdR9qKQzOGqj5YPMHvNzUxwchyNv1XRoONrpMQ=; b=Ssq9zvpc1t8cdorJXxuR1KflDECdy0Ot6Y57jgx2zRKIbnnHBZC7js7+3P7bT5zihJ R8mlZoKJZDTwwZVEIImLU/St/yJFQ35jQmy0m468/IVeRhAgh5gt0AsG9yybSV/LcwdX SqAlJ0X+xu+TgyX/Tg2E7ja3agbExZUCmqXAenzuusJQiEHuFHe7tH5HCaKomrkkuh2j wisPKNG4vqWl5vL5JEdJ2tDXyY5zUQGrFwGKhYYhgtSYUoMSFBV4a00iv88os066WGAr kwFzNUb+03vQAxKCh7w586yj477YdLiVE163KiVzM0cMzWE1nUyF1FbGs4PF9sYwzYJ4 aQCA== X-Gm-Message-State: AOAM531GefPmtgSim1iv5Ko1bEQRYasMN1UnS2mBqPQjUelDP6jd547T q5NePgaYV8Gd3JKSEdS9bvlqX20q46WTE/9k X-Google-Smtp-Source: ABdhPJwGux2zXHlarundz7K3SOkAa4ybczg07jIuC0920I9YRGfTqF2RXx4UClbc5pUiakH6JEZV6yYw43coZmqv X-Received: from andreyknvl3.muc.corp.google.com ([2a00:79e0:15:13:edb8:b79c:2e20:e531]) (user=andreyknvl job=sendgmr) by 2002:a1c:730a:: with SMTP id d10mr4025957wmb.53.1612539584906; Fri, 05 Feb 2021 07:39:44 -0800 (PST) Date: Fri, 5 Feb 2021 16:39:12 +0100 In-Reply-To: Message-Id: <182acaae3ed39231e6c3132c6bc7fc6b08ef003f.1612538932.git.andreyknvl@google.com> Mime-Version: 1.0 References: X-Mailer: git-send-email 2.30.0.365.g02bc693789-goog Subject: [PATCH v2 11/12] kasan: inline HW_TAGS helper functions From: Andrey Konovalov To: Andrew Morton , Catalin Marinas , Vincenzo Frascino , Dmitry Vyukov , Alexander Potapenko , Marco Elver Cc: Will Deacon , Andrey Ryabinin , Peter Collingbourne , Evgenii Stepanov , Branislav Rankov , Kevin Brodsky , kasan-dev@googlegroups.com, linux-arm-kernel@lists.infradead.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Andrey Konovalov 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: Mark all static functions in common.c and kasan.h that are used for hardware tag-based KASAN as inline to avoid unnecessary function calls. Signed-off-by: Andrey Konovalov --- mm/kasan/common.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/mm/kasan/common.c b/mm/kasan/common.c index 7ffb1e6de2ef..7b53291dafa1 100644 --- a/mm/kasan/common.c +++ b/mm/kasan/common.c @@ -279,7 +279,8 @@ void __kasan_poison_object_data(struct kmem_cache *cache, void *object) * based on objects indexes, so that objects that are next to each other * get different tags. */ -static u8 assign_tag(struct kmem_cache *cache, const void *object, bool init) +static inline u8 assign_tag(struct kmem_cache *cache, + const void *object, bool init) { if (IS_ENABLED(CONFIG_KASAN_GENERIC)) return 0xff; @@ -321,8 +322,8 @@ void * __must_check __kasan_init_slab_obj(struct kmem_cache *cache, return (void *)object; } -static bool ____kasan_slab_free(struct kmem_cache *cache, void *object, - unsigned long ip, bool quarantine) +static inline bool ____kasan_slab_free(struct kmem_cache *cache, + void *object, unsigned long ip, bool quarantine) { u8 tag; void *tagged_object; @@ -366,7 +367,7 @@ bool __kasan_slab_free(struct kmem_cache *cache, void *object, unsigned long ip) return ____kasan_slab_free(cache, object, ip, true); } -static bool ____kasan_kfree_large(void *ptr, unsigned long ip) +static inline bool ____kasan_kfree_large(void *ptr, unsigned long ip) { if (ptr != page_address(virt_to_head_page(ptr))) { kasan_report_invalid_free(ptr, ip); @@ -461,8 +462,8 @@ void * __must_check __kasan_slab_alloc(struct kmem_cache *cache, return tagged_object; } -static void *____kasan_kmalloc(struct kmem_cache *cache, const void *object, - size_t size, gfp_t flags) +static inline void *____kasan_kmalloc(struct kmem_cache *cache, + const void *object, size_t size, gfp_t flags) { unsigned long redzone_start; unsigned long redzone_end;