From patchwork Wed Sep 13 17:14:27 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: 139192 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:172:b0:3f2:4152:657d with SMTP id h50csp31513vqi; Wed, 13 Sep 2023 17:55:29 -0700 (PDT) X-Google-Smtp-Source: AGHT+IE8vLklTVZhoHjC2/BiCmJcI2LlGNA3wZbwLDZesV1fX7Q75UipTlaGX0V1Tj7VayCXlsvz X-Received: by 2002:a17:902:b701:b0:1c4:335:b06d with SMTP id d1-20020a170902b70100b001c40335b06dmr854180pls.32.1694652928647; Wed, 13 Sep 2023 17:55:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694652928; cv=none; d=google.com; s=arc-20160816; b=ZC2hKqwFBwBTzttb8XPRV9HRxr6hnCy+liTEAu+kcqivSie2R27BPEfA3wg2dMPIzN qGnVeEuyuMenyXk8T2wBcC9bZAQiDS011t3Lsez1TVaX5t11FMFMcKVhj7I2I5gL5G25 Dz/wkrei3q6cS1EJkTXmpSfTouGLFnx/ATz29zusIgtwp/9qWasMDanrhM9ZnJfViQ+T mt9aDYDIp1/FVfu8AVXolKdQ6sirBy2ZixyVxmWxpJSDXtSf2RacAFUhEMrPsdQ1A/Ow 9QIYxEgb1pzU+ObbmDK0bc3Qfv0HyD2sduM/8C8bJRiVFI4pvT3st3QeX77WvprN/sHC rHfw== 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=YlflyAk6n32t53xzN47UEDJhwSFMjx/Oy5VUczHXxTDztLDdzv+ftawZXaR6q1tQ+Q 1rfpJ0mAuqTgnpVwHzvI451n9IunT/0PkbOujP9JIpbE7n+B+gBvFC9kFAHtoyd25YtG Q+MJ6g8FRc0Dr7zcSyGKH/h6jypYx9WECGRJZCHz5jdpbvScqBFDgOl1Fjetl4lLGWT/ WuqeeTzEW41g/ip0heEN8mBKDvc2DdQP3pdXOSNnDS/1Mn/KhHBb5ejQrsziU2pfCNFh 8rtsmueTmp+ouYx5IW3Edt7l16vyMKh4PDXwDFacer4IKZL0KNgpj1AX5+1eDlFZGIHg CMhg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=pRcWYiA4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 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 lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id n2-20020a170902d0c200b001c3ba275321si442679pln.76.2023.09.13.17.55.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Sep 2023 17:55:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) client-ip=23.128.96.33; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=pRcWYiA4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 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 lipwig.vger.email (Postfix) with ESMTP id 6FC7A80AE81A; Wed, 13 Sep 2023 10:15:25 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231448AbjIMRPL (ORCPT + 34 others); Wed, 13 Sep 2023 13:15:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39204 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230386AbjIMRO7 (ORCPT ); Wed, 13 Sep 2023 13:14:59 -0400 Received: from out-228.mta0.migadu.com (out-228.mta0.migadu.com [91.218.175.228]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A725F19B1 for ; Wed, 13 Sep 2023 10:14:54 -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=1694625289; 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=pRcWYiA4V9DcqOTdN2gLjPxezJ2SlGOHPh1Fz59jRDjJpcStfHaMZtV5oUBDvkHZp9pcN1 2sU42kzOkV4/EmNirmCx2z3pluIo9R1jBj4CZupNvF1dF6+hUeuhGaZZv4dXI+nj7Z61iS xPrZS4MeqQS5+CE7Icb238Gz0TxGYDs= 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 v2 02/19] lib/stackdepot: simplify __stack_depot_save Date: Wed, 13 Sep 2023 19:14:27 +0200 Message-Id: <3336cf19b8e53ed5449550a085cff9bddec4c873.1694625260.git.andreyknvl@google.com> In-Reply-To: References: MIME-Version: 1.0 X-Migadu-Flow: FLOW_OUT 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 (lipwig.vger.email [0.0.0.0]); Wed, 13 Sep 2023 10:15:25 -0700 (PDT) X-Spam-Status: No, score=-0.9 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 lipwig.vger.email X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1776972389382359660 X-GMAIL-MSGID: 1776972389382359660 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);