Message ID | 448bc18296c16bef95cb3167697be6583dcc8ce3.1700502145.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:2b07:b0:403:3b70:6f57 with SMTP id io7csp106879vqb; Mon, 20 Nov 2023 09:50:12 -0800 (PST) X-Google-Smtp-Source: AGHT+IF3S96YAPz9fkfkHMw0hHQkb8YIjdAr+ccCJyd/KTHj0OGqjDt5SNP8AOXa62t4HJvnR05M X-Received: by 2002:a05:6808:23d0:b0:3ae:5e0e:1671 with SMTP id bq16-20020a05680823d000b003ae5e0e1671mr12255556oib.4.1700502611830; Mon, 20 Nov 2023 09:50:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700502611; cv=none; d=google.com; s=arc-20160816; b=Pi+8ZPg5RTvNTt2qDU95bvwu40Jj1CyD4viOjOFsGW+44FMq5j6XolBkfnMeFxc4ZZ imXEMGYJqRS+9c+/hCqEuBYzJDVunQW2e7g48WDBIUOFoJt4xrvqFh2QSiCADhHgXVUR j8owdqajaeiVAt2XMHMny6OJkNuya3GF345AvDbEzY738wCiLaZeddGc9jdv9bYeOnn8 VUHkrPT/eIFN35qOKLc2Cc/EtnAFEZFkLzxbEMLOidJyt6lWR2nb8nB5P1CP/wSu3nR0 KX/1xpYUjg560XytQd9zd+vnzGaX0YLWil6WTDGZbrq+O+MgAAsIhaMEloc8KFbmEodg BZZA== 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 2620:137:e000::3:7 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 snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id b19-20020a63d313000000b005c1faa82bfesi8387724pgg.857.2023.11.20.09.49.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Nov 2023 09:50:11 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; 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 2620:137:e000::3:7 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 snail.vger.email (Postfix) with ESMTP id 41D8880EE0FF; Mon, 20 Nov 2023 09:49:48 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233752AbjKTRtk (ORCPT <rfc822;heyuhang3455@gmail.com> + 27 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 <rfc822;linux-kernel@vger.kernel.org>); 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 <linux-kernel@vger.kernel.org>; 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 <akpm@linux-foundation.org> Cc: Andrey Konovalov <andreyknvl@gmail.com>, Marco Elver <elver@google.com>, Alexander Potapenko <glider@google.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>, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Andrey Konovalov <andreyknvl@google.com> 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: <cover.1700502145.git.andreyknvl@google.com> References: <cover.1700502145.git.andreyknvl@google.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Migadu-Flow: FLOW_OUT X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net 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 (snail.vger.email [0.0.0.0]); Mon, 20 Nov 2023 09:49:48 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1783106226762000273 X-GMAIL-MSGID: 1783106226762000273 |
Series |
stackdepot: allow evicting stack traces
|
|
Commit Message
andrey.konovalov@linux.dev
Nov. 20, 2023, 5:47 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. Reviewed-by: Alexander Potapenko <glider@google.com> Signed-off-by: Andrey Konovalov <andreyknvl@google.com> --- lib/stackdepot.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
Comments
On Mon, Nov 20, 2023 at 06:47:08PM +0100, 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. > > Reviewed-by: Alexander Potapenko <glider@google.com> > Signed-off-by: Andrey Konovalov <andreyknvl@google.com> Reviewed-by: Oscar Salvador <osalvador@suse.de>
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; /*