From patchwork Tue Aug 29 17:11:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: andrey.konovalov@linux.dev X-Patchwork-Id: 13369238 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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 99D65C83F19 for ; Tue, 29 Aug 2023 17:12:48 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B0A3E8E002F; Tue, 29 Aug 2023 13:12:44 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 9F6368E0036; Tue, 29 Aug 2023 13:12:44 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7D3778E002F; Tue, 29 Aug 2023 13:12:44 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 5DB538E0036 for ; Tue, 29 Aug 2023 13:12:44 -0400 (EDT) Received: from smtpin04.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 3427214026B for ; Tue, 29 Aug 2023 17:12:44 +0000 (UTC) X-FDA: 81177786648.04.2ED848B Received: from out-244.mta1.migadu.com (out-244.mta1.migadu.com [95.215.58.244]) by imf14.hostedemail.com (Postfix) with ESMTP id 7F8B1100036 for ; Tue, 29 Aug 2023 17:12:42 +0000 (UTC) Authentication-Results: imf14.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b=tY6t+d+v; dmarc=pass (policy=none) header.from=linux.dev; spf=pass (imf14.hostedemail.com: domain of andrey.konovalov@linux.dev designates 95.215.58.244 as permitted sender) smtp.mailfrom=andrey.konovalov@linux.dev ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1693329162; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=MjxW8cEdQiVOI1Uv8f/KLmoitLM15XxpvrzjQCh/NXc=; b=o5P+hyKarVaGd4gCRHyRRCukG6kxfkHvEcy6vkrmPV2fT0ODUQFV1CJmuwdRU3yGFvq/bR 13cGqfjF6+oNv/Ej84dlWX/qsJEYa5vVTSswDR1ZanJz8KWLTDaTlOhK806GRRNztW+XEU aKLAvnAqzfOLbyL30zCaG3eJkrGFy4o= ARC-Authentication-Results: i=1; imf14.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b=tY6t+d+v; dmarc=pass (policy=none) header.from=linux.dev; spf=pass (imf14.hostedemail.com: domain of andrey.konovalov@linux.dev designates 95.215.58.244 as permitted sender) smtp.mailfrom=andrey.konovalov@linux.dev ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1693329162; a=rsa-sha256; cv=none; b=Yu1jt+1M0qZXVyAfbV8HgWtaeSAIJu42TgT2QDgGSpG1lldxHLBRNrbSidBIw/lJPDVaJf QoU5GQmTx+dA3kfxxAQzgxOw6HPj5qoMA/ELnXNHBlQVGIhimd6x8jhVFmYNzcf8zhleFs 4Ah3aORMeFc1oXP43DiS64BG4htrp2U= 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 X-Migadu-Flow: FLOW_OUT X-Rspamd-Queue-Id: 7F8B1100036 X-Rspam-User: X-Rspamd-Server: rspam02 X-Stat-Signature: kkmcudjyk855t5reh161pycz9stefzd4 X-HE-Tag: 1693329162-816897 X-HE-Meta: U2FsdGVkX19dLXZIJ7o4D7vSMBd4ERiItpWZEeRPx+nyFYr5sJqEBHiTWw/orGxixVboEq7JRt1s8s2kkj3lMORr8wAOd3ArumCYvG8KpYa8eGHNIRa8/c9gc1UewcAMOOEr0U0EYh2qCyAaA7LW6CWisRUDI0Z00fbRQb8uJIZqG9RcWb8CWfLG4yabKgnijohs2U7x/gH7kqCow8219QMNSBH/cqeDJ49K07fhvB+szuEMksSpb4Qy69cXwvyZLZOyLK2PLNfybVVtE9Umzlz/e6AlWFMRlES5wSGck1bil/0cR9W/Zx2pmNqTJlFuWobhJ1ypu+3ilz2cY/EeFJmcxPe3s9oVZkDqGPPGFL6xMKr5Vu+o/ly3HvkRk4VjND/7P3oyFcxulJ0EL2nR4cI020QX2z0473nukUg3tCTwxvdv8bJQDzgHpGKvMgZfQpANL9haIfvPsMXYp0s9ysGpzDqt30f0uzHdjjVOSeQ5+P7ebYPVGd32snY7lbGrOPjdsbm1SoUviXCfRSY1DCfzP9LDF/gT0uj2Y5qq3EqaqTT5RIGlnI1uAh6HvBdzIu44PyDZA0ym/h9UOW60kZ5w23L5KEe5GZklJ3ujF53pYyRom7Llec6Stk6fcGkvMUaDvzEJn712Topo/vENKXJ93mciqjAYO8Xkl+qCRiC5pS+SgdQgR5tOFoO4YxQJvkqaAnASXqkKbyfzMvOlozWbyYJCtLEKn0HB3ZBgeqx7T1x6735mkGjv8uD7kTtf/z77eP5t9FBBSioQT+IAqD+iAobbeyDlnD0DF6VmfIfd7yyXdjiVEu/qYFlsMTZbirBq+Cv31kspYm3r6u+XPrA+2KnfhuetYtCUTWeLXSx3dM2rmvN4kpZe7COOZunSS8Og47qTXxjJrfzymstxx9IdXDZ7Uh6dhxfjyHeO/mFu16/IL5J+HZUFiHwyWeTaMUWtB6sLYuMDBqfzDtg PXhXHu75 mrtXe1lqt6pf7sFevrLDWDgdxeYG18j+Gy3zzptehUJ4G68UB6tk/4eQotPgwsEOmKVXVFtHFYrvb4dr+GbPyxiPVupmWQ0+yzabr2+mr/eUlL2RB3++GVA1GL2d6JkT3d0LMyyj18KzXYGgfdVDfl5j1iQ== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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; /* 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] = *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; /*