Received: by 2002:a05:7412:b130:b0:e2:908c:2ebd with SMTP id az48csp2405518rdb; Mon, 20 Nov 2023 09:52:25 -0800 (PST) X-Google-Smtp-Source: AGHT+IHj3V49KFIqGWpbwdYD61Fw+V3TmBxrcxFudoNhzxP/euyl7U2ul9sRA2/2KlR3keJzpjEq X-Received: by 2002:a92:4a07:0:b0:35b:7af:b31f with SMTP id m7-20020a924a07000000b0035b07afb31fmr2512872ilf.16.1700502745288; Mon, 20 Nov 2023 09:52:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700502745; cv=none; d=google.com; s=arc-20160816; b=izbeAnJPrs5KmrEaCT2VSjhNZQ7oTlQnz+hb6BwjiZSzG6o+Qrb736ko2qdU3Edqz8 pkNUIm0G8vKGfT1RKdsriRx6JrW5PDNVVbRr8cgOry3CxU7Au4H/HMU0g2acN1uJbj0d Zh2meMw78Dqw+UMvRgjcB3w5T02Mf3uq+MlxRpKIJkm8W8MLdbX4eZJh1p3vK8qUGj3b EbOMlQDecv60R6GXgfc3ylJJkhdl5Q5Ozj2rcmM8ovlGaXigbAqOnP6xVBQS76ad4AXT tnOp4GAnet5gixEOWOFChZcMJG9y9ZYp5ozpf6Qd3bkQtyUv7/fIE4ecrJIc2ZWAYIfP 4d8A== 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:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Return-Path: Received: from lipwig.vger.email (lipwig.vger.email. [2620:137:e000::3:3]) by mx.google.com with ESMTPS id a190-20020a6390c7000000b0056fbf85c743si8338818pge.790.2023.11.20.09.52.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Nov 2023 09:52:25 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) client-ip=2620:137:e000::3:3; 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:3 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 lipwig.vger.email (Postfix) with ESMTP id C7A73802FAAC; Mon, 20 Nov 2023 09:52:22 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234467AbjKTRwC (ORCPT + 99 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 ); 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 ; 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 Cc: Andrey Konovalov , Marco Elver , Alexander Potapenko , Dmitry Vyukov , Vlastimil Babka , kasan-dev@googlegroups.com, Evgenii Stepanov , Oscar Salvador , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Andrey Konovalov 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: References: 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 lipwig.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Mon, 20 Nov 2023 09:52:22 -0800 (PST) From: Andrey Konovalov 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 --- 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) -- 2.25.1