From patchwork Mon Oct 23 16:22:33 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: 156974 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:ce89:0:b0:403:3b70:6f57 with SMTP id p9csp1408455vqx; Mon, 23 Oct 2023 09:23:22 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHYtcrP4Fx7+U/VLoQW+dql5Hv821nY54wcqTyO6o0wK//zj2tZzNOsavQL+idKb2OD80nk X-Received: by 2002:a17:90b:4f82:b0:274:77b3:64d0 with SMTP id qe2-20020a17090b4f8200b0027477b364d0mr16934882pjb.17.1698078202207; Mon, 23 Oct 2023 09:23:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698078202; cv=none; d=google.com; s=arc-20160816; b=pPTj63AURUx3FEqVumrw9dc79tx6aqmZu6WaLpdQw1y7EODOMBgsoTUEnAkTi4WarK JhQUo6okhhO2xOb7TZ+v2fj3oeYqgJfGTNdmeYyVQDfpjOJKLuRRAvtxrKbGnAU9jM5L fJmlYcwteY6NwLzF6WyD0U1MQV1SAiMQTT6bw8yaVWQkH9l0uqTmxHxR8AvaN3ncdC73 XCXr3oyxHhgMgN2moOHHyLrgqJNoDN+In/zxjimDj7adYDyrlr3Ic7EsWbVJH48Vm2So htI0MDmaHld1Tkl3a1HSqNzjBsjtfJbSrIpZhT95OK1A6olCyos8Q2o8YMRu6fdufX3Q YzvQ== 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:2 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 agentk.vger.email (agentk.vger.email. [2620:137:e000::3:2]) by mx.google.com with ESMTPS id m5-20020a170902db8500b001b025aba9f2si6286686pld.22.2023.10.23.09.23.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Oct 2023 09:23:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) client-ip=2620:137:e000::3:2; 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:2 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 agentk.vger.email (Postfix) with ESMTP id 455F6805AA3C; Mon, 23 Oct 2023 09:23:18 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232426AbjJWQXH (ORCPT + 27 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 X-Migadu-Flow: FLOW_OUT X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email 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 (agentk.vger.email [0.0.0.0]); Mon, 23 Oct 2023 09:23:18 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1780564048989443980 X-GMAIL-MSGID: 1780564048989443980 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);