Message ID | 301a115cf7ce8ddb42ef6de9151c2bb76ba728fc.1700502145.git.andreyknvl@google.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2b07:b0:403:3b70:6f57 with SMTP id io7csp108288vqb; Mon, 20 Nov 2023 09:52:43 -0800 (PST) X-Google-Smtp-Source: AGHT+IFEM2GOJACOZFv0+ySvNIVAB1WYc+eXJ19MjvwMyym5SK8R15ucyqmAcCxURbyDEst+4+x/ X-Received: by 2002:a05:6e02:156f:b0:357:a71f:8310 with SMTP id k15-20020a056e02156f00b00357a71f8310mr12156983ilu.10.1700502763426; Mon, 20 Nov 2023 09:52:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700502763; cv=none; d=google.com; s=arc-20160816; b=ZBlbqTd4m9h4O7PxFAQ7LC23z6eZHID5fCj+IODAuNZdH6EuxYhZe421NT2cb23pe6 KvqYLRA7MjSOGYblvX7FbVLhELm/Dey8WlcoEdJyyQvPxeoy9xwPqdXqpnY1Bo0ep3CF J9pX5n4zHIUo5fyAbXpEwwroZLVLRBMbz1ho0EEIJiZyS9PT+NGQz78xR1PUIpxwrgU1 YrgXKB3pZc83OArY4HJlyPH9K2dd8ta7u5sOEKbQLXyRvJzOsZ42Qtz3c8hpr+vPsxH8 TJJOVkcYowtLP+5Yo79R7vFuvO1pzPVfImZ8AF5fehOZ5V10AJlEkMSNVJSoLL4hl6ft yeRQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=mWJyEm6VyaOWhREL8AAhhvtbKxcDTX0iHOdq2I7biaE=; fh=qWoxmPN1zRqnLSoCWGpfFsDtzJsx/SGdqx98lbP+Uho=; b=HbWIVL/HDlC211t/sAq77U3AH65ea2Jxe4XLIuP/2FoqxL9P+Hzr8og7hGcmiKxFCR PFSdTYaqe2UgzeIT1arg/BXtPTc+Vmh2/tMpPhHqRbOOmbaWL0xYqtl3hL/WF5C6mn24 3Fu8CqkBQNlcCjqpS+IioZFtGaFphPRs7M0sGl0evAmh8VXnxPjSiyRb6PElmoOoHwbE gZer9i/hWiTmDO458god0+6SnxgoRAID+8ZFG7DNzxsEzcGcZmYPQsPgjjGUYcnsdqvW AHvXyXkWO4qGS+0o7XnQeb/uS4gOT9w9b4ifSLYx17icyv66FNOWWa/E2VsVuUBZkZ1i +pAg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=WmK6Qhek; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Received: from agentk.vger.email (agentk.vger.email. [2620:137:e000::3:2]) by mx.google.com with ESMTPS id e12-20020a65678c000000b00563d9ff5157si8433277pgr.547.2023.11.20.09.52.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Nov 2023 09:52:43 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) client-ip=2620:137:e000::3:2; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=WmK6Qhek; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id 4E3A0803D8CC; Mon, 20 Nov 2023 09:52:41 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234473AbjKTRwC (ORCPT <rfc822;heyuhang3455@gmail.com> + 27 others); Mon, 20 Nov 2023 12:52:02 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49162 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234457AbjKTRvZ (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Mon, 20 Nov 2023 12:51:25 -0500 Received: from out-188.mta1.migadu.com (out-188.mta1.migadu.com [95.215.58.188]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 542FA1988 for <linux-kernel@vger.kernel.org>; Mon, 20 Nov 2023 09:50:47 -0800 (PST) X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1700502645; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=mWJyEm6VyaOWhREL8AAhhvtbKxcDTX0iHOdq2I7biaE=; b=WmK6QhekX7FInJyHV2uIR20pRmvpYax2GIBAaZMlPJyA0fa28yyqkU2wHc9EZkcNKhaGVw rpPS5IdkJL5crjQMbxbFNxa8MnpB9QR4IgbAId2GDpPOic2y+TwrC0P2SZxzr/nb1ApKtj eY3o0dSnWGXhfqV2/RcUKsx+woR/BOo= From: andrey.konovalov@linux.dev To: Andrew Morton <akpm@linux-foundation.org> Cc: Andrey Konovalov <andreyknvl@gmail.com>, Marco Elver <elver@google.com>, Alexander Potapenko <glider@google.com>, Dmitry Vyukov <dvyukov@google.com>, Vlastimil Babka <vbabka@suse.cz>, kasan-dev@googlegroups.com, Evgenii Stepanov <eugenis@google.com>, Oscar Salvador <osalvador@suse.de>, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Andrey Konovalov <andreyknvl@google.com> Subject: [PATCH v4 22/22] lib/stackdepot: adjust DEPOT_POOLS_CAP for KMSAN Date: Mon, 20 Nov 2023 18:47:20 +0100 Message-Id: <301a115cf7ce8ddb42ef6de9151c2bb76ba728fc.1700502145.git.andreyknvl@google.com> In-Reply-To: <cover.1700502145.git.andreyknvl@google.com> References: <cover.1700502145.git.andreyknvl@google.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Migadu-Flow: FLOW_OUT X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Mon, 20 Nov 2023 09:52:41 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1783106385430841998 X-GMAIL-MSGID: 1783106385430841998 |
Series |
stackdepot: allow evicting stack traces
|
|
Commit Message
andrey.konovalov@linux.dev
Nov. 20, 2023, 5:47 p.m. UTC
From: Andrey Konovalov <andreyknvl@google.com> KMSAN is frequently used in fuzzing scenarios and thus saves a lot of stack traces. As KMSAN does not support evicting stack traces from the stack depot, the stack depot capacity might be reached quickly with large stack records. Adjust the maximum number of stack depot pools for this case. The average size of a stack trace saved into the stack depot is ~16 frames. Thus, adjust the maximum pools number accordingly to keep the maximum number of stack traces that can be saved into the stack depot similar to the one that was allowed before the stack trace eviction changes. Signed-off-by: Andrey Konovalov <andreyknvl@google.com> --- lib/stackdepot.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
diff --git a/lib/stackdepot.c b/lib/stackdepot.c index c1b31160f4b4..870cce2f4cbd 100644 --- a/lib/stackdepot.c +++ b/lib/stackdepot.c @@ -41,7 +41,17 @@ #define DEPOT_OFFSET_BITS (DEPOT_POOL_ORDER + PAGE_SHIFT - DEPOT_STACK_ALIGN) #define DEPOT_POOL_INDEX_BITS (DEPOT_HANDLE_BITS - DEPOT_OFFSET_BITS - \ STACK_DEPOT_EXTRA_BITS) +#if IS_ENABLED(CONFIG_KMSAN) && CONFIG_STACKDEPOT_MAX_FRAMES >= 32 +/* + * KMSAN is frequently used in fuzzing scenarios and thus saves a lot of stack + * traces. As KMSAN does not support evicting stack traces from the stack + * depot, the stack depot capacity might be reached quickly with large stack + * records. Adjust the maximum number of stack depot pools for this case. + */ +#define DEPOT_POOLS_CAP (8192 * (CONFIG_STACKDEPOT_MAX_FRAMES / 16)) +#else #define DEPOT_POOLS_CAP 8192 +#endif #define DEPOT_MAX_POOLS \ (((1LL << (DEPOT_POOL_INDEX_BITS)) < DEPOT_POOLS_CAP) ? \ (1LL << (DEPOT_POOL_INDEX_BITS)) : DEPOT_POOLS_CAP)