From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 07F71C433EF for ; Sun, 24 Apr 2022 19:15:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238877AbiDXTSa (ORCPT ); Sun, 24 Apr 2022 15:18:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59022 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239213AbiDXTSX (ORCPT ); Sun, 24 Apr 2022 15:18:23 -0400 Received: from mail-pl1-x629.google.com (mail-pl1-x629.google.com [IPv6:2607:f8b0:4864:20::629]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 329E414080 for ; Sun, 24 Apr 2022 12:15:21 -0700 (PDT) Received: by mail-pl1-x629.google.com with SMTP id h12so18739662plf.12 for ; Sun, 24 Apr 2022 12:15:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=date:from:to:cc:subject:in-reply-to:message-id:references :mime-version; bh=jsx4mhumyN262gUb7FrEPxMNx1chS7GsJEszWuM5D/A=; b=Wo51Oxn2QBu17Kg6Ckcp5bmLU8e+B4E8VD8j14crRBfjC86gG/U1y40DNw22nLBdRX hV0rVVJD+P/GTrAmldnks0n0noeDYEERzQ3zwbYMJ6rRnXHfqLFcvKYAWyDZw3DwyXi9 BkPFym80fDvv61vi+J+CuqFvcB8Udk0iGnFEQRTHn8tNCu6/+8r8dJ4YYR/5y+SM1PV/ cJvPrj+seMmvsTSESZQxqCh6r8Ycz6Yal/aiqAE0z0T1okFQwoGINm6SwcmDqLGt2mQn 8nouGyPlhLb08BxvHN70GpQsLelVKBZ3RChs1GvrmCELqRdyxPuFb08t1LCRzEG7/Qr6 6Hmg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:in-reply-to:message-id :references:mime-version; bh=jsx4mhumyN262gUb7FrEPxMNx1chS7GsJEszWuM5D/A=; b=OO/6sbbC3rOhFLAY+beT1A5ax44c4aCB7gM3tJCTH3kK7I41NMlawnvTRVK6jpF5lj sp58HHObBzj/ElBDh35TmzWDaIvrXV/FmYKzZ4sFon3VSj4txfV8TUltqupIlJhmN3O9 WE5i0kG45cw3SCohfhRpVv8RDeRvAiH8GAoltOx26aSmTJ+IcIj2xJr3L2OsSR2S0n5d +ERpNvtMWMr7FVzxlmmBbFUJVf/VrWvy3suPdELlXCijvDK1XtAgfGETaRSRoT5MsVqm lhkXLPCJ88BT0JMGA+/xmAqo6o8KDdfcWxG7/x28ALMGjORLykKMceXofm6ZPiJuFvgy Ap1w== X-Gm-Message-State: AOAM533dumg3R64VoK2z7VcEie5YvWeh+WotXn+qu1/Yvfj0DpP2BA4A on0WsPvIzNLda6kX0mrvsYUjKQ== X-Google-Smtp-Source: ABdhPJxErEZvneHieQ1EqeKHlqIJ3de1/bJPxlpbuZEV4KrBg6XGSmnIkPJFh+dSRl0AfqymrzMBow== X-Received: by 2002:a17:90b:1e49:b0:1d2:9d82:8bb1 with SMTP id pi9-20020a17090b1e4900b001d29d828bb1mr27937373pjb.226.1650827720436; Sun, 24 Apr 2022 12:15:20 -0700 (PDT) Received: from [2620:15c:29:204:d4fc:f95c:4d79:861f] ([2620:15c:29:204:d4fc:f95c:4d79:861f]) by smtp.gmail.com with ESMTPSA id c9-20020a63a409000000b0039912d50806sm7313352pgf.87.2022.04.24.12.15.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 24 Apr 2022 12:15:20 -0700 (PDT) Date: Sun, 24 Apr 2022 12:15:19 -0700 (PDT) From: David Rientjes To: Peter Collingbourne cc: Andrey Konovalov , Hyeonggon Yoo <42.hyeyoo@gmail.com>, Andrew Morton , Catalin Marinas , Linux ARM , Linux Memory Management List , Linux Kernel Mailing List , vbabka@suse.cz, penberg@kernel.org, roman.gushchin@linux.dev, iamjoonsoo.kim@lge.com, Herbert Xu , Andrey Ryabinin , Alexander Potapenko , Dmitry Vyukov , kasan-dev , Eric Biederman , Kees Cook Subject: Re: [PATCH v3] mm: make minimum slab alignment a runtime property In-Reply-To: <20220422201830.288018-1-pcc@google.com> Message-ID: <5cb2b96c-4f5e-d278-534a-d9e1ea989cf@google.com> References: <20220422201830.288018-1-pcc@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 22 Apr 2022, Peter Collingbourne wrote: > When CONFIG_KASAN_HW_TAGS is enabled we currently increase the minimum > slab alignment to 16. This happens even if MTE is not supported in > hardware or disabled via kasan=off, which creates an unnecessary > memory overhead in those cases. Eliminate this overhead by making > the minimum slab alignment a runtime property and only aligning to > 16 if KASAN is enabled at runtime. > > On a DragonBoard 845c (non-MTE hardware) with a kernel built with > CONFIG_KASAN_HW_TAGS, waiting for quiescence after a full Android > boot I see the following Slab measurements in /proc/meminfo (median > of 3 reboots): > > Before: 169020 kB > After: 167304 kB > > Link: https://linux-review.googlesource.com/id/I752e725179b43b144153f4b6f584ceb646473ead > Signed-off-by: Peter Collingbourne > Reviewed-by: Andrey Konovalov Acked-by: David Rientjes The command line options are described by Documentation/dev-tools/kasan.rst but it doesn't look like a update is necessary. I think the assumption today is that if we're using kasan=off then we aren't doing the alignment. I do wonder why kasan=off is not at least mentioned in Documentation/admin-guide/kernel-parameters.txt and perhaps for all other kasan options point the reader to Documentation/dev-tools/kasan.rst. From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 797E7C433F5 for ; Sun, 24 Apr 2022 19:16:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:Message-ID: In-Reply-To:Subject:cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=K6UiJvn9rkRhRnUCY5pwFb8hwBAfYL5KAkZdhKxTzMw=; b=4K48EwBbLBH7pv rbImf7fcGSGun/soobS6NW78K7+MFVfBaRjtN8nebRyC8qMyR4KZwh46d2uatgcYcckiQEfarQ1C3 j2nD7d9FWH2rRonSgdCdPoXXrxUmeIvXQwmSA6Q7RqK3b7Fkc8AgOorZ1p/+iMU+B87gZ+0hgWYm3 rL0otfjCI4thqyjbCBkX9gPyEu3M/uT/dOKmuB24LAxf2nKG1FABA3HLbPdJ3EY/Oaf6Bm6haEZeG YiXNylyDNK+OhKokF+9MvwJvVDpFVBVkYGqa09RmzasSUTa8xc9WKE2haknoQIJ2hEkFH1aT2NUz/ bjZ5uXBKHa0k4PIOXQww==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nihhg-007GKT-1g; Sun, 24 Apr 2022 19:15:28 +0000 Received: from mail-pl1-x62c.google.com ([2607:f8b0:4864:20::62c]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nihhd-007GJe-3J for linux-arm-kernel@lists.infradead.org; Sun, 24 Apr 2022 19:15:26 +0000 Received: by mail-pl1-x62c.google.com with SMTP id c12so22427533plr.6 for ; Sun, 24 Apr 2022 12:15:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=date:from:to:cc:subject:in-reply-to:message-id:references :mime-version; bh=jsx4mhumyN262gUb7FrEPxMNx1chS7GsJEszWuM5D/A=; b=Wo51Oxn2QBu17Kg6Ckcp5bmLU8e+B4E8VD8j14crRBfjC86gG/U1y40DNw22nLBdRX hV0rVVJD+P/GTrAmldnks0n0noeDYEERzQ3zwbYMJ6rRnXHfqLFcvKYAWyDZw3DwyXi9 BkPFym80fDvv61vi+J+CuqFvcB8Udk0iGnFEQRTHn8tNCu6/+8r8dJ4YYR/5y+SM1PV/ cJvPrj+seMmvsTSESZQxqCh6r8Ycz6Yal/aiqAE0z0T1okFQwoGINm6SwcmDqLGt2mQn 8nouGyPlhLb08BxvHN70GpQsLelVKBZ3RChs1GvrmCELqRdyxPuFb08t1LCRzEG7/Qr6 6Hmg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:in-reply-to:message-id :references:mime-version; bh=jsx4mhumyN262gUb7FrEPxMNx1chS7GsJEszWuM5D/A=; b=Dnjw+tuKC6Ar6o9bXGzPKJ/mKIQiXou6/o24pQvw6dy2wRYuqLa4+2S0i0BKdGqHJK R+/wISriJk9KWpscL/TWD0r5RG/nPFq192svC6tpmSruXlfhUNWgcAZGx2FUGYrx/WgF DYYNvlpiUOrzQ0d/CKIMMNlmlrfOn4FSpjYGHSYbSYPgTmdhUiUs17LC5D3sji7KP7T8 +FryJL6xbvlSEWtNHhliY1dMMv77tWagU+k4Cfz8OitAoBpmTYYFCu6hDwo/s4BjgsgF xrEEt+Zgp/bOt4h+7kVmEw0LNFeBu2eFj2nDEX28R02w5bU57VvpowDZyc0p19coVkGi Z/nA== X-Gm-Message-State: AOAM533w8y9w3OhZNI2zxdA6E3pcSpQTqOV+Rp150mpeVGpfaudlw8H1 X2v6EeT/vCDr88U+CZnhaq9/Og== X-Google-Smtp-Source: ABdhPJxErEZvneHieQ1EqeKHlqIJ3de1/bJPxlpbuZEV4KrBg6XGSmnIkPJFh+dSRl0AfqymrzMBow== X-Received: by 2002:a17:90b:1e49:b0:1d2:9d82:8bb1 with SMTP id pi9-20020a17090b1e4900b001d29d828bb1mr27937373pjb.226.1650827720436; Sun, 24 Apr 2022 12:15:20 -0700 (PDT) Received: from [2620:15c:29:204:d4fc:f95c:4d79:861f] ([2620:15c:29:204:d4fc:f95c:4d79:861f]) by smtp.gmail.com with ESMTPSA id c9-20020a63a409000000b0039912d50806sm7313352pgf.87.2022.04.24.12.15.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 24 Apr 2022 12:15:20 -0700 (PDT) Date: Sun, 24 Apr 2022 12:15:19 -0700 (PDT) From: David Rientjes To: Peter Collingbourne cc: Andrey Konovalov , Hyeonggon Yoo <42.hyeyoo@gmail.com>, Andrew Morton , Catalin Marinas , Linux ARM , Linux Memory Management List , Linux Kernel Mailing List , vbabka@suse.cz, penberg@kernel.org, roman.gushchin@linux.dev, iamjoonsoo.kim@lge.com, Herbert Xu , Andrey Ryabinin , Alexander Potapenko , Dmitry Vyukov , kasan-dev , Eric Biederman , Kees Cook Subject: Re: [PATCH v3] mm: make minimum slab alignment a runtime property In-Reply-To: <20220422201830.288018-1-pcc@google.com> Message-ID: <5cb2b96c-4f5e-d278-534a-d9e1ea989cf@google.com> References: <20220422201830.288018-1-pcc@google.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220424_121525_175998_37AF4EEC X-CRM114-Status: GOOD ( 17.31 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Fri, 22 Apr 2022, Peter Collingbourne wrote: > When CONFIG_KASAN_HW_TAGS is enabled we currently increase the minimum > slab alignment to 16. This happens even if MTE is not supported in > hardware or disabled via kasan=off, which creates an unnecessary > memory overhead in those cases. Eliminate this overhead by making > the minimum slab alignment a runtime property and only aligning to > 16 if KASAN is enabled at runtime. > > On a DragonBoard 845c (non-MTE hardware) with a kernel built with > CONFIG_KASAN_HW_TAGS, waiting for quiescence after a full Android > boot I see the following Slab measurements in /proc/meminfo (median > of 3 reboots): > > Before: 169020 kB > After: 167304 kB > > Link: https://linux-review.googlesource.com/id/I752e725179b43b144153f4b6f584ceb646473ead > Signed-off-by: Peter Collingbourne > Reviewed-by: Andrey Konovalov Acked-by: David Rientjes The command line options are described by Documentation/dev-tools/kasan.rst but it doesn't look like a update is necessary. I think the assumption today is that if we're using kasan=off then we aren't doing the alignment. I do wonder why kasan=off is not at least mentioned in Documentation/admin-guide/kernel-parameters.txt and perhaps for all other kasan options point the reader to Documentation/dev-tools/kasan.rst. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel