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 X-Spam-Level: X-Spam-Status: No, score=-6.9 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE, SPF_PASS,USER_AGENT_SANE_1 autolearn=no 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 0ACAAC433E2 for ; Tue, 8 Sep 2020 19:54:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C8C4120768 for ; Tue, 8 Sep 2020 19:54:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732281AbgIHTyW (ORCPT ); Tue, 8 Sep 2020 15:54:22 -0400 Received: from mx2.suse.de ([195.135.220.15]:38070 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730551AbgIHPhh (ORCPT ); Tue, 8 Sep 2020 11:37:37 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id A93B9AC26; Tue, 8 Sep 2020 15:36:46 +0000 (UTC) Subject: Re: [PATCH RFC 00/10] KFENCE: A low-overhead sampling-based memory safety error detector To: Marco Elver , Dave Hansen Cc: glider@google.com, akpm@linux-foundation.org, catalin.marinas@arm.com, cl@linux.com, rientjes@google.com, iamjoonsoo.kim@lge.com, mark.rutland@arm.com, penberg@kernel.org, hpa@zytor.com, paulmck@kernel.org, andreyknvl@google.com, aryabinin@virtuozzo.com, luto@kernel.org, bp@alien8.de, dave.hansen@linux.intel.com, dvyukov@google.com, edumazet@google.com, gregkh@linuxfoundation.org, mingo@redhat.com, jannh@google.com, corbet@lwn.net, keescook@chromium.org, peterz@infradead.org, cai@lca.pw, tglx@linutronix.de, will@kernel.org, x86@kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, kasan-dev@googlegroups.com, linux-arm-kernel@lists.infradead.org, linux-mm@kvack.org References: <20200907134055.2878499-1-elver@google.com> <20200908153102.GB61807@elver.google.com> From: Vlastimil Babka Message-ID: Date: Tue, 8 Sep 2020 17:36:44 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.11.0 MIME-Version: 1.0 In-Reply-To: <20200908153102.GB61807@elver.google.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 9/8/20 5:31 PM, Marco Elver wrote: >> >> How much memory overhead does this end up having? I know it depends on >> the object size and so forth. But, could you give some real-world >> examples of memory consumption? Also, what's the worst case? Say I >> have a ton of worst-case-sized (32b) slab objects. Will I notice? > > KFENCE objects are limited (default 255). If we exhaust KFENCE's memory > pool, no more KFENCE allocations will occur. > Documentation/dev-tools/kfence.rst gives a formula to calculate the > KFENCE pool size: > > The total memory dedicated to the KFENCE memory pool can be computed as:: > > ( #objects + 1 ) * 2 * PAGE_SIZE > > Using the default config, and assuming a page size of 4 KiB, results in > dedicating 2 MiB to the KFENCE memory pool. > > Does that clarify this point? Or anything else that could help clarify > this? Hmm did you observe that with this limit, a long-running system would eventually converge to KFENCE memory pool being filled with long-aged objects, so there would be no space to sample new ones? > Thanks, > -- Marco > 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 X-Spam-Level: X-Spam-Status: No, score=-6.9 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=no 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 A5691C43461 for ; Tue, 8 Sep 2020 16:23:13 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 177D920678 for ; Tue, 8 Sep 2020 16:23:13 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="C+buf3sF" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 177D920678 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=suse.cz Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:Date:Message-ID:From: References:To:Subject:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=e36GH2KnffXwgnWAhLBPPNFa2vcm+8H2qNSj7x1veoM=; b=C+buf3sFaPfotaHmu9o1XjY/4 Sx3sHErr5yu9rOKCCzj+hdKUa5u/xCrUiU72aQIYA/NOw5ZmrgY03opmwEyNVHULoJBS/cigOlu+W MXJimUr+WO6LuGwNE3AwBSnJmDg/yO6GxpII7x4WJuZUpGNMIlMdxwCXoiuPszfmh0jRSW/+V6JUb HYFbq7cXUv9CP5ngguhZsAW2imqZr1xZimIomqDwhljpvx507iXnxwoV8k8iDK+H0G/L7PmV0Dicn 2YtpzqFBMcGKjJqhnakBdoepNyR0pVASrmMrkOXEEsj5AkMNi4hvXEET56ZfubrfzD1VoM8tkBwqv NHJbovegA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kFffw-0005lu-24; Tue, 08 Sep 2020 15:36:52 +0000 Received: from mx2.suse.de ([195.135.220.15]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kFffs-0005jz-D5 for linux-arm-kernel@lists.infradead.org; Tue, 08 Sep 2020 15:36:49 +0000 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id A93B9AC26; Tue, 8 Sep 2020 15:36:46 +0000 (UTC) Subject: Re: [PATCH RFC 00/10] KFENCE: A low-overhead sampling-based memory safety error detector To: Marco Elver , Dave Hansen References: <20200907134055.2878499-1-elver@google.com> <20200908153102.GB61807@elver.google.com> From: Vlastimil Babka Message-ID: Date: Tue, 8 Sep 2020 17:36:44 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.11.0 MIME-Version: 1.0 In-Reply-To: <20200908153102.GB61807@elver.google.com> Content-Language: en-US X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200908_113648_612580_5942E0BB X-CRM114-Status: GOOD ( 16.90 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: mark.rutland@arm.com, linux-doc@vger.kernel.org, peterz@infradead.org, catalin.marinas@arm.com, dave.hansen@linux.intel.com, linux-mm@kvack.org, edumazet@google.com, glider@google.com, hpa@zytor.com, cl@linux.com, will@kernel.org, corbet@lwn.net, x86@kernel.org, kasan-dev@googlegroups.com, mingo@redhat.com, linux-arm-kernel@lists.infradead.org, rientjes@google.com, aryabinin@virtuozzo.com, keescook@chromium.org, paulmck@kernel.org, jannh@google.com, andreyknvl@google.com, bp@alien8.de, luto@kernel.org, tglx@linutronix.de, akpm@linux-foundation.org, dvyukov@google.com, gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org, penberg@kernel.org, cai@lca.pw, iamjoonsoo.kim@lge.com 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 9/8/20 5:31 PM, Marco Elver wrote: >> >> How much memory overhead does this end up having? I know it depends on >> the object size and so forth. But, could you give some real-world >> examples of memory consumption? Also, what's the worst case? Say I >> have a ton of worst-case-sized (32b) slab objects. Will I notice? > > KFENCE objects are limited (default 255). If we exhaust KFENCE's memory > pool, no more KFENCE allocations will occur. > Documentation/dev-tools/kfence.rst gives a formula to calculate the > KFENCE pool size: > > The total memory dedicated to the KFENCE memory pool can be computed as:: > > ( #objects + 1 ) * 2 * PAGE_SIZE > > Using the default config, and assuming a page size of 4 KiB, results in > dedicating 2 MiB to the KFENCE memory pool. > > Does that clarify this point? Or anything else that could help clarify > this? Hmm did you observe that with this limit, a long-running system would eventually converge to KFENCE memory pool being filled with long-aged objects, so there would be no space to sample new ones? > Thanks, > -- Marco > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel