Message ID | 3a7056408e391ff0c66b5f50c460a7b9f796228f.1694625260.git.andreyknvl@google.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:a8d:b0:3f2:4152:657d with SMTP id gr13csp120857vqb; Wed, 13 Sep 2023 15:23:22 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHJdSEDLT+sD5k/mvzofdsONPve3bCeOJUNPvCpN7S+kGg7J4eSjgr9g/aqBNtpT3uwFXgX X-Received: by 2002:a05:6a21:778c:b0:14d:d9f8:83ee with SMTP id bd12-20020a056a21778c00b0014dd9f883eemr4025595pzc.61.1694643801708; Wed, 13 Sep 2023 15:23:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694643801; cv=none; d=google.com; s=arc-20160816; b=t/pBk6nfXU+e+QNigLUWQcEhhW8C4QtYKlicT1KOCGOuAHRVLKEdKDvjT35mQehIbp fPubsQEwzV0vkOrCxFhHG4zr8p9RT4712aYqwRvS3pvKufaqoLvd4r/nCixbBMv+HLpe aiC4W6jPHnAVJElSKzaGu7CgtNjYMVsrhAP4W7tvAA/lNOl2/Oi0iJp1/VidoOkFr2O1 BfxY60h9oR0k2mDj75hoqI5mPisYYxeRFYKAW8RBQC/cfhaMO8/KCquSkYZ0SX+7blUN IgJrHf1rX+M05D8jOxPzgwSF1abDatas2MTft5l4W/YNtu7E70YuLjg9ZmU3QA8f72hw qyyw== 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.35 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 groat.vger.email (groat.vger.email. [23.128.96.35]) by mx.google.com with ESMTPS id o13-20020a17090ab88d00b00263fc986e28si2364895pjr.24.2023.09.13.15.23.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Sep 2023 15:23:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) client-ip=23.128.96.35; 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.35 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 groat.vger.email (Postfix) with ESMTP id 882FD826FB73; Wed, 13 Sep 2023 10:17:10 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230453AbjIMRQH (ORCPT <rfc822;pwkd43@gmail.com> + 34 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 <rfc822;linux-kernel@vger.kernel.org>); 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 <linux-kernel@vger.kernel.org>; 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 <elver@google.com>, Alexander Potapenko <glider@google.com> Cc: Andrey Konovalov <andreyknvl@gmail.com>, Dmitry Vyukov <dvyukov@google.com>, Vlastimil Babka <vbabka@suse.cz>, kasan-dev@googlegroups.com, Evgenii Stepanov <eugenis@google.com>, Oscar Salvador <osalvador@suse.de>, Andrew Morton <akpm@linux-foundation.org>, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Andrey Konovalov <andreyknvl@google.com> 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: <cover.1694625260.git.andreyknvl@google.com> References: <cover.1694625260.git.andreyknvl@google.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Migadu-Flow: FLOW_OUT Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Wed, 13 Sep 2023 10:17:10 -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 groat.vger.email X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1776962818953172052 X-GMAIL-MSGID: 1776962818953172052 |
Series |
stackdepot: allow evicting stack traces
|
|
Commit Message
andrey.konovalov@linux.dev
Sept. 13, 2023, 5:14 p.m. UTC
From: Andrey Konovalov <andreyknvl@google.com> 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 <andreyknvl@google.com> --- lib/stackdepot.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
Comments
On Wed, Sep 13, 2023 at 7:15 PM <andrey.konovalov@linux.dev> wrote: > > From: Andrey Konovalov <andreyknvl@google.com> > > 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 <andreyknvl@google.com> Reviewed-by: Alexander Potapenko <glider@google.com>
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; /*