Received: by 2002:a05:7412:b130:b0:e2:908c:2ebd with SMTP id az48csp2403156rdb; Mon, 20 Nov 2023 09:48:21 -0800 (PST) X-Google-Smtp-Source: AGHT+IF+hiNne43ksaPgJxFrcN8anVAZ08NW4UGKwMm1iYm/Zb1OlZMuLY+2bO/WowmrSQC2t/N+ X-Received: by 2002:a05:6808:148e:b0:3ab:8295:f2f1 with SMTP id e14-20020a056808148e00b003ab8295f2f1mr11882795oiw.45.1700502501377; Mon, 20 Nov 2023 09:48:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700502501; cv=none; d=google.com; s=arc-20160816; b=b+OCHBpfbB49y88x63Js+FYzaCsuwD2zjkxIxS3VESOT30osF5tTfecZAcEJA75kB7 v60XAXNbDsNXuxB9LVjyFNccvdPBnql0oQEyNLMmnlFLOuKOLxxpauTlhOtuHFMhYf/2 TtxXAVBkiXmp8M5Wnq8Uqn4cVMTPPfCUe7QVFsc7R51yDLjIyIYHORwXgno/nm2yt4xX CflL7DO2NgA7EFg8cFBdBhhqeaJHIRJ0UOn5UBc3266Idc/+PfsxuIWdqEwwXFZ96ODz +AS/iQO/28EgmUA2kN+mdFUKXu3AfZTQ7Uc7yU53ms0F7621TVcLXFKdaFPJVBXH7bDu YAow== 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=VQKv8ipVyqmLqtwmF3tWarfk+ElO5xq6wgwn4qj22hY=; fh=qWoxmPN1zRqnLSoCWGpfFsDtzJsx/SGdqx98lbP+Uho=; b=Y73Ivh/LoyfPCDmAV0H9fNIpvESBU8z+pJKa2nYKIxRPeWnBS2/9WrKRO5Wy2Z7JFW GFvkcOx9cakZtfDn/JsH4A9GU15rhMJFfknLJraaDgU+E9ZX+IUfet+LjMsHn1YhGj8C gozbxz3b7NrLY8/97TvnyFx0teyQYEG765Nxmwz8uCcU1ZsrSRcQFih4is4269ppQyLZ dh8QC0FIYQ9Ftn+ObHlFwbh06j8hnO62Ma4fBXF7qqKTJSVHf14KHh4F1vodHWKTPZka ui2lTURYel/1HMhGUy5ABqEdEQPdwC2YvG+QEXIBRKHv14UVQuZdR98htsWtPZUSw+BA nCnA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=DpwTRKlG; 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 Return-Path: Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id cb6-20020a056a02070600b005ab7b51ab6csi8684503pgb.515.2023.11.20.09.48.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Nov 2023 09:48:21 -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=DpwTRKlG; 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 E17B380ECF2D; Mon, 20 Nov 2023 09:47:56 -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 S233944AbjKTRrn (ORCPT + 99 others); Mon, 20 Nov 2023 12:47:43 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51272 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232734AbjKTRrd (ORCPT ); Mon, 20 Nov 2023 12:47:33 -0500 Received: from out-172.mta1.migadu.com (out-172.mta1.migadu.com [IPv6:2001:41d0:203:375::ac]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3E65411C for ; Mon, 20 Nov 2023 09:47:30 -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=1700502448; 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=VQKv8ipVyqmLqtwmF3tWarfk+ElO5xq6wgwn4qj22hY=; b=DpwTRKlGqKrBB4M8buYXFUbh5C4t1DeCOJCZmUpqezNSRGsyD+Wdylo613HdhfnrTQ5s+e pjLcUIFVsXiRTj7skGIcX0r4YxbEBcZF9ntx+1uASDYWt1MOFzRn7mamvzav2NVLFYw6Tg zTiWDgpYpFtnG/OSWJ9T8vQPvfnqvc0= From: andrey.konovalov@linux.dev To: Andrew Morton Cc: Andrey Konovalov , Marco Elver , Alexander Potapenko , Dmitry Vyukov , Vlastimil Babka , kasan-dev@googlegroups.com, Evgenii Stepanov , Oscar Salvador , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Andrey Konovalov Subject: [PATCH v4 03/22] lib/stackdepot: simplify __stack_depot_save Date: Mon, 20 Nov 2023 18:47:01 +0100 Message-Id: <3b0763c8057a1cf2f200ff250a5f9580ee36a28c.1700502145.git.andreyknvl@google.com> In-Reply-To: References: 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: 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:47:57 -0800 (PST) From: Andrey Konovalov The retval local variable in __stack_depot_save has the union type handle_parts, but the function never uses anything but the union's handle field. Define retval simply as depot_stack_handle_t to simplify the code. Reviewed-by: Alexander Potapenko Signed-off-by: Andrey Konovalov --- lib/stackdepot.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/lib/stackdepot.c b/lib/stackdepot.c index f8a8033e1dc8..3e71c8f61c7d 100644 --- a/lib/stackdepot.c +++ b/lib/stackdepot.c @@ -366,7 +366,7 @@ depot_stack_handle_t __stack_depot_save(unsigned long *entries, gfp_t alloc_flags, bool can_alloc) { struct stack_record *found = NULL, **bucket; - union handle_parts retval = { .handle = 0 }; + depot_stack_handle_t handle = 0; struct page *page = NULL; void *prealloc = NULL; unsigned long flags; @@ -383,7 +383,7 @@ depot_stack_handle_t __stack_depot_save(unsigned long *entries, nr_entries = filter_irq_stacks(entries, nr_entries); if (unlikely(nr_entries == 0) || stack_depot_disabled) - goto fast_exit; + return 0; hash = hash_stack(entries, nr_entries); bucket = &stack_table[hash & stack_hash_mask]; @@ -449,9 +449,8 @@ depot_stack_handle_t __stack_depot_save(unsigned long *entries, free_pages((unsigned long)prealloc, DEPOT_POOL_ORDER); } if (found) - retval.handle = found->handle.handle; -fast_exit: - return retval.handle; + handle = found->handle.handle; + return handle; } EXPORT_SYMBOL_GPL(__stack_depot_save); -- 2.25.1