Received: by 2002:a05:7412:b130:b0:e2:908c:2ebd with SMTP id az48csp2404833rdb; Mon, 20 Nov 2023 09:51:10 -0800 (PST) X-Google-Smtp-Source: AGHT+IFsao2CbbERGtzEfwOfTv63Esjauro1bMEFkJhiFtF8hJ8l6/WZ+rKSJ7Wu+qF0yaSdV+V5 X-Received: by 2002:a17:902:70c8:b0:1cc:ef37:664a with SMTP id l8-20020a17090270c800b001ccef37664amr5527194plt.31.1700502670099; Mon, 20 Nov 2023 09:51:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700502670; cv=none; d=google.com; s=arc-20160816; b=d8sWP4me26PUt+SQXAoUFWBCN0yDq5C1RwpoQSe2T/Xv9La/YG1jbyAZK/cehhAuFQ XEFnDzOZZOXcGKh247qOhePD6jKLqNu+75ZZ6XXprWBzn2ukKG8vcCayQPR4CR/5OfAS QOW4qVH5xzfTP8xit65fn6TJtyFy5NqBU35DaC3VvqqJzocELHlm/vifmZwAAOUTZjjk Ffy9A+GYzG2CvAIfKgFw2H9qaEV7BO1tRMRWqPlnfQLrwMbIBPGvbrvIKCjh3HsLOo3j LQngaSpby17B9V9yeIcw//CVC8ZDTtTfPyVHSKGfq8XKIZcWtr/qcUan06wIPZoHrlZJ CKoA== 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=Wo0lOk4QF0V4/CSryrBtBcTGMr2NPIzDQs2c2iiME6Q=; fh=qWoxmPN1zRqnLSoCWGpfFsDtzJsx/SGdqx98lbP+Uho=; b=w02MFeCzmkV7MuJv91aQ0vV6KnrwickPELAs4Dd3ZGzOQmN9hVyQckUAxYNSjsstAr ITmJEIG/JvsHTKz2HmpHb1ty73DjQ1P+KZtGs47sxsOL9iztH/Rxo9GbFz/6pee8uene Su8yjwJynvwlSL/8I4HeL+OmfYqXrQDMrhnhHv98l4HOF+8XWUkJsqfK0D1orr6hzBqO QXnn9aOWc2fx/XxXyCOzzxhcsA2/vVB3oHEb+khdmUAGGTkXIeRIfyLRAXic72R6yc0r v4OeTxXqkmfgjrTWP8iffI9Qvv+pKKbrp1v7IsXHDPa9u9UmR3Bh8Q/d7VSDRRN6A21h Y0HQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=mVlXzudg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 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 fry.vger.email (fry.vger.email. [23.128.96.38]) by mx.google.com with ESMTPS id u7-20020a17090341c700b001cf6b85fea1si337995ple.364.2023.11.20.09.51.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Nov 2023 09:51:10 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) client-ip=23.128.96.38; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=mVlXzudg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 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 fry.vger.email (Postfix) with ESMTP id 1377580AE238; Mon, 20 Nov 2023 09:50:46 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234513AbjKTRtk (ORCPT + 99 others); Mon, 20 Nov 2023 12:49:40 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53448 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234254AbjKTRtS (ORCPT ); Mon, 20 Nov 2023 12:49:18 -0500 Received: from out-184.mta0.migadu.com (out-184.mta0.migadu.com [91.218.175.184]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 291A6D7D for ; Mon, 20 Nov 2023 09:48:37 -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=1700502515; 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=Wo0lOk4QF0V4/CSryrBtBcTGMr2NPIzDQs2c2iiME6Q=; b=mVlXzudgWPREwFPbPjEzWKl0pkuPrGrBfXgV/o3hu2wbrexzrKyl7c+k+ldkpF3cqIoiwI u8DO0T3MhAJP+5xhUN4eko0SgcoGz172qfdNSCMVSIN1yVWwfrjX7hnhKKWOfY2ZNwgi4e RtBwt9lIOYU3HUK95YFtEZQHsBHOLqY= 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 10/22] lib/stackdepot: store next pool pointer in new_pool Date: Mon, 20 Nov 2023 18:47:08 +0100 Message-Id: <448bc18296c16bef95cb3167697be6583dcc8ce3.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 fry.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 (fry.vger.email [0.0.0.0]); Mon, 20 Nov 2023 09:50:46 -0800 (PST) From: Andrey Konovalov Instead of using the last pointer in stack_pools for storing the pointer to a new pool (which does not yet store any stack records), use a new new_pool variable. This a purely code readability change: it seems more logical to store the pointer to a pool with a special meaning in a dedicated variable. Reviewed-by: Alexander Potapenko Signed-off-by: Andrey Konovalov --- lib/stackdepot.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/stackdepot.c b/lib/stackdepot.c index a38661beab97..68c1ac9aa916 100644 --- a/lib/stackdepot.c +++ b/lib/stackdepot.c @@ -85,6 +85,8 @@ static unsigned int stack_hash_mask; /* Array of memory regions that store stack traces. */ static void *stack_pools[DEPOT_MAX_POOLS]; +/* Newly allocated pool that is not yet added to stack_pools. */ +static void *new_pool; /* Currently used pool in stack_pools. */ static int pool_index; /* Offset to the unused space in the currently used pool. */ @@ -241,7 +243,7 @@ static void depot_keep_new_pool(void **prealloc) * as long as we do not exceed the maximum number of pools. */ if (pool_index + 1 < DEPOT_MAX_POOLS) { - stack_pools[pool_index + 1] = *prealloc; + new_pool = *prealloc; *prealloc = NULL; } @@ -272,6 +274,8 @@ static bool depot_update_pools(size_t required_size, void **prealloc) * stack_depot_fetch(). */ WRITE_ONCE(pool_index, pool_index + 1); + stack_pools[pool_index] = new_pool; + new_pool = NULL; pool_offset = 0; /* -- 2.25.1