Received: by 2002:a05:7412:251c:b0:e2:908c:2ebd with SMTP id w28csp1334639rda; Mon, 23 Oct 2023 09:23:10 -0700 (PDT) X-Google-Smtp-Source: AGHT+IECYlH2EtSc9GDFEf4ySqmup/VSR1K/Pmu2GfpNx+0sUVaAkG6nOtyGwwqJ7qQiqsi+Km1c X-Received: by 2002:a05:6a00:986:b0:68f:d44c:22f8 with SMTP id u6-20020a056a00098600b0068fd44c22f8mr13760496pfg.1.1698078190039; Mon, 23 Oct 2023 09:23:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698078190; cv=none; d=google.com; s=arc-20160816; b=a6H81MiW/2Gkb/ulr0zKnKzuXuQ+IoVcZDsg4QwJM+/Rwv2r3pMUKP/e7mAFRFhkFV QL9g7rvUXv+54nQBKHBrRpOCP2E0+StnWWQhSKP6Znws7wTrvZiqxWTGwjnTWQXM6lYR icGGchLHA2QstxiFpFGETPYodiWReYkGmTMRb2sRQcOQDIZvrMOKaxsPJo/IU9NfbPTl 8fq6L77H/pCfZTA/lug7YsXYVGZaQLgRPnzkM/xbUWsROd3zwLsJ74wLE0vvwgZu+t6Q jHRfqra0bZ3xQv4rz+DkV5TnfXAoqD/bHo48rQCsWuepGQnUTuiqfcJCy/5ma6gwWGAN wSPg== 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=hlykGlfL2an/VgWBLR95t+wE6CpOLlFaVT0cHbSVLN0=; fh=nfQSbTp1dWHt2Ier1Up8UhVNdXOqoJJLNvTrpT3jJEk=; b=oFxbNloWov0XAJ31wA+XPULPBlAMQJj4aQr/ZpRNTNa8zKI3hFgNYDYlj9fxnza62h dqXiGRwiP2rEufJqhYVo4/xr/x8ECXUikH2zFILAte+cLb8x+L/d3oiA8Nt6KSDSzisv owYQq9WX8IoGdEY8oAK88j8pPgiSqgn9RtIR62IUaW6RonR5J6IvAhXGwcRx1Yd/qE+o sFYeLl79l89jT3nn8Qu776lFjvToGaoCwLyvnX9kRKetYq11wPU7hj4zXkMZlkXXsuuV KySQcaWEUVGm/zRafx2khMFkGPRYbhROIKiKT31TV7gNDWhG0Lt0ECMzJ2+C0ris4nAV ybZA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=BwPbMNBq; 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 x14-20020aa79ace000000b0068fcf194dacsi6850829pfp.92.2023.10.23.09.23.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Oct 2023 09:23:10 -0700 (PDT) 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=BwPbMNBq; 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 C1F7C804E726; Mon, 23 Oct 2023 09:23:08 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229741AbjJWQXH (ORCPT + 99 others); Mon, 23 Oct 2023 12:23:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38406 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230329AbjJWQXF (ORCPT ); Mon, 23 Oct 2023 12:23:05 -0400 Received: from out-205.mta0.migadu.com (out-205.mta0.migadu.com [91.218.175.205]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4D03E10E for ; Mon, 23 Oct 2023 09:23:00 -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=1698078178; 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=hlykGlfL2an/VgWBLR95t+wE6CpOLlFaVT0cHbSVLN0=; b=BwPbMNBqQr8eCi/2bzTTF8duZP4VRRfQUHs2ug+CAfTzdfxW5c7tGWmaNI5EFjq6IxzJZq SfjwshdOrp6OB9NwpUh9zr0qnIhgsa5b547AMebg2LpMrGL6e3ElCdDIR06kr2JMooKxRy iI329x7c9WbbQOKgKwFWyqcU/WVnUL4= From: andrey.konovalov@linux.dev To: Marco Elver , Alexander Potapenko Cc: Andrey Konovalov , Dmitry Vyukov , Vlastimil Babka , kasan-dev@googlegroups.com, Evgenii Stepanov , Oscar Salvador , Andrew Morton , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Andrey Konovalov Subject: [PATCH v3 02/19] lib/stackdepot: simplify __stack_depot_save Date: Mon, 23 Oct 2023 18:22:33 +0200 Message-Id: <6ff0d1e89e50ba74618eed30fd3170dc78decea3.1698077459.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,SPF_HELO_NONE,SPF_PASS 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, 23 Oct 2023 09:23:09 -0700 (PDT) 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 3a945c7206f3..0772125efe8a 100644 --- a/lib/stackdepot.c +++ b/lib/stackdepot.c @@ -360,7 +360,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; @@ -377,7 +377,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]; @@ -443,9 +443,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