From patchwork Tue Aug 29 17:11:23 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: 13369248 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 5BEBFC83F12 for ; Tue, 29 Aug 2023 17:13:48 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id DA10B8E003A; Tue, 29 Aug 2023 13:13:47 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id D2B0A8E0036; Tue, 29 Aug 2023 13:13:47 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A455B8E003A; Tue, 29 Aug 2023 13:13:47 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 86D258E0036 for ; Tue, 29 Aug 2023 13:13:47 -0400 (EDT) Received: from smtpin16.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 64FCE40241 for ; Tue, 29 Aug 2023 17:13:47 +0000 (UTC) X-FDA: 81177789294.16.2929464 Received: from out-248.mta1.migadu.com (out-248.mta1.migadu.com [95.215.58.248]) by imf28.hostedemail.com (Postfix) with ESMTP id 8B8C7C0019 for ; Tue, 29 Aug 2023 17:13:45 +0000 (UTC) Authentication-Results: imf28.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b=PT1yVeNi; spf=pass (imf28.hostedemail.com: domain of andrey.konovalov@linux.dev designates 95.215.58.248 as permitted sender) smtp.mailfrom=andrey.konovalov@linux.dev; dmarc=pass (policy=none) header.from=linux.dev ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1693329225; 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=6r+jJInS3pVfd7hB9KGynpwXDuP9tHCSgnjNZ7TlokM=; b=eB6kv/u5rODTWPhyevob++wTXWPJINrrUNwmPclgn/Gu6a9uJbB6nkS+h0W6UfuM+4iGCc cnBqoLo3L76HmMR2rOYs8lRrg7E1/HsnhRwh4E+R//GQCJwvVnCWDYY4jIA/MbwpV3I0Zq bJMA1Wj8KC1hag+iqsLOC+Gg66i/OeQ= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1693329225; a=rsa-sha256; cv=none; b=RHdiWkpwmAf/YOeQI8Ui4gLepBQShYZ2PyyYoIG7VGnFKjdyQ/Wh3t4Lvh51H6A89+NHIg HwLvB5wDsnKdHt5i5XYutVlJnkNX1KS6Cja31GCNbDidtOfMHhMkXq8i4ZMBKkrbL+NBXr rkQ9W7JCFCDiGVU4uV/nb3uIeBp95Lg= ARC-Authentication-Results: i=1; imf28.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b=PT1yVeNi; spf=pass (imf28.hostedemail.com: domain of andrey.konovalov@linux.dev designates 95.215.58.248 as permitted sender) smtp.mailfrom=andrey.konovalov@linux.dev; dmarc=pass (policy=none) header.from=linux.dev 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=1693329224; 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=6r+jJInS3pVfd7hB9KGynpwXDuP9tHCSgnjNZ7TlokM=; b=PT1yVeNi/WFW0iBcrm2Hn4oAVO5Mp4hu85tRrRP1HYBbHSPjNipz67GtVxzpFdOYzHKM/M EOna2VPwPAI1BS2TmFOrLFsWZmPHYOllcK3aTIE2DJg0Lqwv7JOqQ+rn0o60sbtux81qug hC+Sq5lFDkk29LN4JU6YC08g6eDKk+8= 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 13/15] stackdepot: add backwards links to hash table buckets Date: Tue, 29 Aug 2023 19:11:23 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Migadu-Flow: FLOW_OUT X-Rspamd-Queue-Id: 8B8C7C0019 X-Rspam-User: X-Stat-Signature: 3ksgobeqr48846xudx5qnbyy88fjcqeh X-Rspamd-Server: rspam03 X-HE-Tag: 1693329225-788023 X-HE-Meta: U2FsdGVkX1+GlVlmbeO1TPiVRdddH7eDeOz8ttl5FL0TVvn+n9gRmhsdYjZfjKa9v44ml1FLCQDlHex5E2ul92Gra5oRSTSW23HNGeQcWAu3Joo4jr/LqIMNAK+Bd8nRaSQ6wp0W2OQBCJ4KReZgxoASDjw13pW2uISuVHnpDw6miVz5rd16Ea6CNw8vquNJBPKEgbOiuYcP8uEn7xi7QyhW3g7Wzye5uNkfEzTW87Ngm1EXkBVL/GBmzL7EE0HuItTjQDymaNGuv5ip+0JuMZEkXDAJCetOnp2yD0YNXWPM+IiMHP7keISwG1q7okYzVKpgWk/OdX1ipzPkQJOf20jNG+MwDHKAqF4K1GK/TrW/hYIi6iCPvRMXVvOd9LV0Z+j8mDIEPUaB0A9SL1cPmCATDBj2mxPLO9wx3VBVATJIjUiZm7P/F8zxTqpYXeAsVWRyaZh2+00sYProRqdoZAHUZGJrWP7uyiJKjWaQAcjZJO67Xi62u6qG3NsHOge/YMIpxzAcHtPL/TmPiynqEL7eNmn9PXsHR0UOkT8/nd9wpP/u/QchtgAB2CPmMqSQNyibyteEFnDGFKe72AXYG5uEu++b1USNDTYvG6X82Jh/VuKbuVIv/050BG+OewyMNWBpR1rC+MGcv7CzLA0sUfPdnbbyTb7/HGH/eMB5ASlhFEWnsf8GcDpdsDqCKA2lfIabSUb93YDutfTfSzvVCgjwl9kMLKxHVAJ8nsB2ApAVXiNTqbfXw8C++OM98ns3ATIRfHgb/USwXjwJZHMqTdrRSfCPpEcfCQjTpjQ9fpzyUHC5y69tfnhljKarLy42Wg3rbaN8VXpwGwLrThW1BEiOND0OdeW/BOIpPdIY9LcICJVCe6+Zz8XW54qgY4jkSQ/JD6WK6wGUd0fE4fk7+cA6ZZrMOgjn1WpZwNomgHcOjCKtqczZLqdCbtbZEW4zw3S/584Hk9+sF0VnL4g uR6cQqmP vsj7J8T9VemgiNEYmMCmrX1kXZDOGuK1TUu26VogZoEFQxUWf6RlNNDvpJmwSv/ZXwk8AuCO1U52Ujc9KfYn/QLoe3DARcU7H0MSq 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 Maintain links in the stack records to previous entries within the hash table buckets. This is preparatory patch for implementing the eviction of stack records from the stack depot. Signed-off-by: Andrey Konovalov --- lib/stackdepot.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/stackdepot.c b/lib/stackdepot.c index a84c0debbb9e..641db97d8c7c 100644 --- a/lib/stackdepot.c +++ b/lib/stackdepot.c @@ -58,6 +58,7 @@ union handle_parts { struct stack_record { struct stack_record *next; /* Link in hash table or freelist */ + struct stack_record *prev; /* Link in hash table */ u32 hash; /* Hash in hash table */ u32 size; /* Number of stored frames */ union handle_parts handle; @@ -493,6 +494,9 @@ depot_stack_handle_t __stack_depot_save(unsigned long *entries, if (new) { new->next = *bucket; + new->prev = NULL; + if (*bucket) + (*bucket)->prev = new; *bucket = new; found = new; }