Received: by 2002:a05:7412:251c:b0:e2:908c:2ebd with SMTP id w28csp1339349rda; Mon, 23 Oct 2023 09:31:31 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFlZfCdLQ8swTEASYfbo8Wlp86GYm4cwb8+kdB3sVJe7IpD41zUqb+xLDQLZUl44ImDTHoI X-Received: by 2002:a05:6a21:7985:b0:16c:b95c:6d35 with SMTP id bh5-20020a056a21798500b0016cb95c6d35mr51866pzc.50.1698078690858; Mon, 23 Oct 2023 09:31:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698078690; cv=none; d=google.com; s=arc-20160816; b=QYsXOoqE4j9j2RANqlWq+8rUbD/SAdgbkuLPlbL68D4YpQso/8GXxz7iNWcnzc7cLK tbknNUPOexHru+VCDqTGP6etCqab5HHyrcKzvHHqmiIcQCwYOGBU8dsufmtaj4H1I/IV UQi9Vlz2EpaPGm6800Vf+1JMOnO0WRVBO3EaiAVuGkwz9OFJQEfiNK6iwQOk2HROKDrY fpHaiLQ6TU8NoqaVMzw4UXA2hPmNwJ/USiyg0/ty7d5OvKulfLEo3YahvJ7hOjShpiFV OVlvpEnDEnzfFSNQTmVzEaPMXrG09LqEYSbFv/lihsm/so0yNnIhbaU6HFHhCo7v9IzQ E/nA== 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=ApzhSzVlCGqOU4aCEVUKgk2/C6zStSgrVwNwdDBjs8U=; fh=nfQSbTp1dWHt2Ier1Up8UhVNdXOqoJJLNvTrpT3jJEk=; b=D5hr+XiNAg8NFYPWZ9wrLveFx0HSZX7PGXVQzJmA1rzFpx92DYi/iKODS/WsDIo6bD AGs+buoHx4QGT8T5Zqth0Qd8Wk5XUYYYOMcg8m/242Kqcj4M66dJ1BDyTqVep/EUZgSG +5ZrUkV7izPqw0SfPTx7f7Mom+KRaiC9eDNet2/ET/QuVBY1gzmtVGbSz4N8M0pjJSKl lMcx+UmvRma1EZbrdFfLrrQXdSaBOOyBPulePTR0O3ATMqpV6XzH1L2h85Lo2swvqkf6 95DN0KATCdpcSLODVittEcb0X8PztPbXCRe7d8j/vDYw7/I5AMCC+Xnygm6n8TiOa3NS Icag== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=NfBcevWE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 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 pete.vger.email (pete.vger.email. [23.128.96.36]) by mx.google.com with ESMTPS id ch10-20020a056a0208ca00b0053074c54c3fsi6794613pgb.868.2023.10.23.09.31.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Oct 2023 09:31:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) client-ip=23.128.96.36; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=NfBcevWE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 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 pete.vger.email (Postfix) with ESMTP id 07E5D805A895; Mon, 23 Oct 2023 09:30:07 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233620AbjJWQ3k (ORCPT + 99 others); Mon, 23 Oct 2023 12:29:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60536 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230255AbjJWQ3f (ORCPT ); Mon, 23 Oct 2023 12:29:35 -0400 X-Greylist: delayed 325 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Mon, 23 Oct 2023 09:29:31 PDT Received: from out-209.mta1.migadu.com (out-209.mta1.migadu.com [95.215.58.209]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B5799E5 for ; Mon, 23 Oct 2023 09:29:31 -0700 (PDT) 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=1698078245; 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=ApzhSzVlCGqOU4aCEVUKgk2/C6zStSgrVwNwdDBjs8U=; b=NfBcevWE9BlTOxp5WKU+AFsbwgvY+znjPFhBjCe3OZapZ0zGGWutAZrUfoCCoyqQvxbvaI R7EdE6nsCaw0PPJ/YMOZJqf2yEfy6oqmcAkClvCx2QV09MJBtPRaCYiYEtW9gHNizb9Lbe 030j3vL55nL81zukRlM4oSMetrRtY+M= From: andrey.konovalov@linux.dev To: Marco Elver , Alexander Potapenko Cc: Andrey Konovalov , Dmitry Vyukov , Vlastimil Babka , kasan-dev@googlegroups.com, Evgenii Stepanov , Oscar Salvador , Andrew Morton , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Andrey Konovalov Subject: [PATCH v3 09/19] lib/stackdepot: store next pool pointer in new_pool Date: Mon, 23 Oct 2023 18:22:40 +0200 Message-Id: <852c5fed993f6b1e21beca9faa85e0fc2d9b84e6.1698077459.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.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on pete.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 (pete.vger.email [0.0.0.0]); Mon, 23 Oct 2023 09:30:07 -0700 (PDT) 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 7579e20114b1..5315952f26ec 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. */ @@ -235,7 +237,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; } @@ -266,6 +268,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