Received: by 2002:a05:7412:31a9:b0:e2:908c:2ebd with SMTP id et41csp3396743rdb; Wed, 13 Sep 2023 10:41:43 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGv5o+VXSbrbJkecV18Y3V4C4wn6zkFTXcLrqxmwnpuUMO08WYrmJ8cTguNDmqkBUDopR0I X-Received: by 2002:a17:90a:1283:b0:268:38a7:842e with SMTP id g3-20020a17090a128300b0026838a7842emr2711540pja.2.1694626902874; Wed, 13 Sep 2023 10:41:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694626902; cv=none; d=google.com; s=arc-20160816; b=vn+8Tpp9oelHVmmxwcvb/thE6VoFMP2liwzZfSkZW/5JQT2lZevbA11PJ3+GEnLSO9 TsiFTNIJCUbslCrEgC3dJvKNyUw730gSzCEt8G8bxadV6mm7ePUCUis6cUdxEVpd41SL iAB15SGM4q9pTEjxaAo7p/USDhlv/TPwyrGStY1R83rj/tBSwVxAylL/AdEMaNx9dYLM SqRpaGh7miGdF79eiHfb0zBO4SjEKzuCxzpOq6KEIcwzJkGVLQe972DGJlUAoiqLhnTk 1vhh9vE8/i9lLKMajjZFHX/xZJJ+2+1yfAeTS6lXNoG9CTI+b86ibH9xM/X7Bt103yBR fE1Q== 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=iF8d5PIu0hiypd5p1X1vzHkKz0HhegtzJ4nwY5HqH4s=; fh=nfQSbTp1dWHt2Ier1Up8UhVNdXOqoJJLNvTrpT3jJEk=; b=YxZZmL8bPzJD5CLb6R9/RVWzHVHgqvIfi5zoOJ1gT7qA1P26AnS5HxmKEfxASZUvg5 tIh1EsrdFWZSFTnNvnQ4UJtZuxTiVEz1HEl8P96EIGIpznPEree291+KKv2aeORj1xlV E9IFH1Vip+yi/dZU0sZPL0L2a8x+tDFLSUB0pXbuTUhQbC/MXAtggCAIjElbGzdCQ22r lJsfe4m/7oEEHQWECz6nASDVq0X/BkuG8Z18Tn0BR3a0ntlVkf59dd3WwGs10VePhCNY 3hsvwY3IYJhuBm+i8vN+ZX6tfegpKoEDW3vS1T2YOpH6hDYESYIMRFIKV87OYsxzfLDa gNlw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=wHA2oEp9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 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 morse.vger.email (morse.vger.email. [23.128.96.31]) by mx.google.com with ESMTPS id oj2-20020a17090b4d8200b0026d41496190si2202994pjb.85.2023.09.13.10.41.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Sep 2023 10:41:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) client-ip=23.128.96.31; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=wHA2oEp9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 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 morse.vger.email (Postfix) with ESMTP id 90E4181CB0D2; Wed, 13 Sep 2023 10:16:12 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231127AbjIMRQH (ORCPT + 99 others); Wed, 13 Sep 2023 13:16:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49680 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230349AbjIMRQC (ORCPT ); Wed, 13 Sep 2023 13:16:02 -0400 Received: from out-221.mta1.migadu.com (out-221.mta1.migadu.com [95.215.58.221]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E5FB498 for ; Wed, 13 Sep 2023 10:15:57 -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=1694625356; 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=iF8d5PIu0hiypd5p1X1vzHkKz0HhegtzJ4nwY5HqH4s=; b=wHA2oEp9M2Png7tDBErdFmtaGLdMmLLdtrI6Au1BGNIa11sMWCsUSSkjE5ssXZQMsf89kF /ktIdpIwNBEW+HewSCwtqwLFJguCHnjOmSkrdVpWer6wxYm1qnbAq12KYjmRjrBs1FoPap FFJ3/1H7E9nEL5HyfuXogMs6GDWTN4w= 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 v2 09/19] lib/stackdepot: store next pool pointer in new_pool Date: Wed, 13 Sep 2023 19:14:34 +0200 Message-Id: <3a7056408e391ff0c66b5f50c460a7b9f796228f.1694625260.git.andreyknvl@google.com> In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Migadu-Flow: FLOW_OUT 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 (morse.vger.email [0.0.0.0]); Wed, 13 Sep 2023 10:16:12 -0700 (PDT) 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 autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.vger.email 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 e428f470faf6..81d8733cdbed 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. */ @@ -233,7 +235,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; } @@ -263,6 +265,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