From nobody Sun Dec 14 06:37:33 2025 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1F65DC83F14 for ; Tue, 29 Aug 2023 17:15:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237709AbjH2ROv (ORCPT ); Tue, 29 Aug 2023 13:14:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49546 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237702AbjH2ROV (ORCPT ); Tue, 29 Aug 2023 13:14:21 -0400 Received: from out-251.mta1.migadu.com (out-251.mta1.migadu.com [IPv6:2001:41d0:203:375::fb]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C56F5E7D for ; Tue, 29 Aug 2023 10:13:49 -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=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 Content-Transfer-Encoding: quoted-printable X-Migadu-Flow: FLOW_OUT Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" 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 { =20 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, =20 if (new) { new->next =3D *bucket; + new->prev =3D NULL; + if (*bucket) + (*bucket)->prev =3D new; *bucket =3D new; found =3D new; } --=20 2.25.1