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: 13383615 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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 96152EE01F1 for ; Wed, 13 Sep 2023 17:14:56 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 16FFD6B0253; Wed, 13 Sep 2023 13:14:53 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 0F5856B0254; Wed, 13 Sep 2023 13:14:52 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D56136B0257; Wed, 13 Sep 2023 13:14:52 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id C0BE56B0254 for ; Wed, 13 Sep 2023 13:14:52 -0400 (EDT) Received: from smtpin17.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 97D581C9FEB for ; Wed, 13 Sep 2023 17:14:52 +0000 (UTC) X-FDA: 81232224024.17.CBCDDE7 Received: from out-220.mta0.migadu.com (out-220.mta0.migadu.com [91.218.175.220]) by imf12.hostedemail.com (Postfix) with ESMTP id D582A40016 for ; Wed, 13 Sep 2023 17:14:50 +0000 (UTC) Authentication-Results: imf12.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b=pRcWYiA4; dmarc=pass (policy=none) header.from=linux.dev; spf=pass (imf12.hostedemail.com: domain of andrey.konovalov@linux.dev designates 91.218.175.220 as permitted sender) smtp.mailfrom=andrey.konovalov@linux.dev ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1694625291; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=hlykGlfL2an/VgWBLR95t+wE6CpOLlFaVT0cHbSVLN0=; b=0VCT8XP3Iu/BxAcKam+zE9PXNuwR8cMEp/77oBHfwAQXYkK/FrsxGmdJRR0WutiMGqkVYw HHHkhXkuTG3pHHzaXvbwqe1ChICs7MmKf1F6PQFGGsTJlH5np9RPa1yEKqTz6WpcSPXw8z fHzrwubvVk/qeNtdIRiN2kf39D35AX8= ARC-Authentication-Results: i=1; imf12.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b=pRcWYiA4; dmarc=pass (policy=none) header.from=linux.dev; spf=pass (imf12.hostedemail.com: domain of andrey.konovalov@linux.dev designates 91.218.175.220 as permitted sender) smtp.mailfrom=andrey.konovalov@linux.dev ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1694625291; a=rsa-sha256; cv=none; b=uIay0L6c0jB7vaDmTVD/qUgu24aADhiA8+FuO68KcQo0YsUwlV8aYKrEO6+Tsi/3tb8HlF sPIkS0rSN2JsVyPq00oez0m/jTWsPYlNHtjhvCsnlgcKquQq0WIm/qBcQ0O1x3V0GKStbY wC0r8qXXUndH38Aw8r7C74vzFU5+PBE= 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 X-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: D582A40016 X-Stat-Signature: fsohfdxxao5k59qw9z3qihfjmiyt1s7d X-Rspam-User: X-HE-Tag: 1694625290-311960 X-HE-Meta: U2FsdGVkX19gi4NO6UxEZKOs2do7RdhNenaqzbd7tmKNBRYagAfCTQX6yBuMyla8/wgw7bPn2X9GbM1D0pZViv2htn/vfGKTiSRQBsneiWmIefiL7nFmefzrgS8/htYIvwjLrC6pPq8IMnj+GSQCEye10Few1ip2tCAbEz5U7UWUsoRqarIzcprVTZ/ZDnInDXLVBY+D4KMt1jQlM3+/ajlPBWq2k07yFVPWoFdz0UGvNNC1Jxmf0tdusTb+KI516tJ+RCZjMRJSutNQ+6s/n1cCh/4Fy6bSDwbpgR/I/WRJ9SNe51BtV7qAG4IBfKl5Lshl3UWgnfT7HnKzn6FlLgq7pOqFBEr8a5yFD9AtbOBOU8znUuhnaZZfksszgC51WlX+8FWM5Lq3n1lASlJJ0hkXeYZ7iRp7EP5zYuDMf5/x9BYncJAdDX/aOonQoTqYdJD+7Iq+oSUKAHWaw1VKfBT7ay2+WefINdobeT7ov2qyuMoVtZC+ipVI/ThH3U8NshTeWIW0nbwqi30Cniu1O7bcU6zAHhB7l8pYJEze98avHUaIXp3e9i7Fbt323Sfp1fxwT+3WobbO0mkff3faynB00zoM0Yb9FsvitfGj3loOmv2RUeeM46+YD1G1LYgohTdH85jzA2c8W7dshyqrrkIvwnDSwEcCYHMyM8pjX+us9GfyjJ5EEmcimAiDeRH/KG11I/HRYRGmRTEfVf1zs6iEOh/20zlk/0mH5JnFe9jELa/wdvANFBx8zteUXJQxN3IzbBhVDaJO0I6qzFvkcQqDfZGrLb0PW6C8voBdTf6f/PSwNmCvOBtyBSCu5addIFp9vKVo5lGqaj9bm0cEwP3sREpSAHCy8rw6XwZ+cOAABjJgJPzDxNcOS15I0BjQ35Ob/FMrAiZpvkArhehwpIx/MV9nl+ei7E7IieeDmMIX/nzEm949mnxorNU+N2K+VJUC7Mmj2Klf1wX4gUx eifDUfPp BoK2KsOs6u9aBvR/fEr/L7Wf7UZCpa2BMjhVihNtVCSMp2nV6NIMftQBuwinkag40KONLSQ3udYGVJk9iqtEkWFokm83mLGti/QTV9s0hW4ZTPWLS6JycEVghP/j4aWQfi+v2gtI1FAVSShaCgA6T4J49kQ== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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);