From nobody Sun Dec 14 06:40:50 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C307EC83F19 for ; Tue, 29 Aug 2023 17:13:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237758AbjH2RNW (ORCPT ); Tue, 29 Aug 2023 13:13:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48670 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237723AbjH2RM4 (ORCPT ); Tue, 29 Aug 2023 13:12:56 -0400 Received: from out-243.mta1.migadu.com (out-243.mta1.migadu.com [IPv6:2001:41d0:203:375::f3]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DD261CDF for ; Tue, 29 Aug 2023 10:12:42 -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=1693329161; 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=MjxW8cEdQiVOI1Uv8f/KLmoitLM15XxpvrzjQCh/NXc=; b=tY6t+d+vBtGNax4kT5p4Y7yBgtMWSnu/QUCRoJmsSpGYGi+JfvAHktxIuYT65MqPmBkvxp 8RKOWRZXFpn759z55PlIk/UrGpleF+qwN8UTuRs6xh3eea3xHUbqZVYdzJbVmPrc/bwhgG rJ4DhJcJpXlAotO4gn30Fc2AmkPTb4c= From: andrey.konovalov@linux.dev To: Marco Elver , Alexander Potapenko Cc: Andrey Konovalov , Dmitry Vyukov , Vlastimil Babka , kasan-dev@googlegroups.com, Evgenii Stepanov , Andrew Morton , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Andrey Konovalov Subject: [PATCH 09/15] stackdepot: store next pool pointer in new_pool Date: Tue, 29 Aug 2023 19:11:19 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Migadu-Flow: FLOW_OUT Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" 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. 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 11934ea3b1c2..5982ea79939d 100644 --- a/lib/stackdepot.c +++ b/lib/stackdepot.c @@ -86,6 +86,8 @@ static unsigned int stack_hash_mask; =20 /* 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. */ @@ -236,7 +238,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] =3D *prealloc; + new_pool =3D *prealloc; *prealloc =3D NULL; } =20 @@ -266,6 +268,8 @@ static bool depot_update_pools(size_t required_size, vo= id **prealloc) * stack_depot_fetch. */ WRITE_ONCE(pool_index, pool_index + 1); + stack_pools[pool_index] =3D new_pool; + new_pool =3D NULL; pool_offset =3D 0; =20 /* --=20 2.25.1