From patchwork Mon Nov 20 17:47:01 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: 13461817 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 06D40C5AD4C for ; Mon, 20 Nov 2023 17:47:37 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 8BB9A6B032F; Mon, 20 Nov 2023 12:47:32 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 86AAF6B032C; Mon, 20 Nov 2023 12:47:32 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5ACB76B033A; Mon, 20 Nov 2023 12:47:32 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 3ECA26B032F for ; Mon, 20 Nov 2023 12:47:32 -0500 (EST) Received: from smtpin03.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 08F341209D1 for ; Mon, 20 Nov 2023 17:47:32 +0000 (UTC) X-FDA: 81479064744.03.4F80B46 Received: from out-189.mta1.migadu.com (out-189.mta1.migadu.com [95.215.58.189]) by imf16.hostedemail.com (Postfix) with ESMTP id 464F218001C for ; Mon, 20 Nov 2023 17:47:30 +0000 (UTC) Authentication-Results: imf16.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b=DpwTRKlG; dmarc=pass (policy=none) header.from=linux.dev; spf=pass (imf16.hostedemail.com: domain of andrey.konovalov@linux.dev designates 95.215.58.189 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=1700502450; 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=VQKv8ipVyqmLqtwmF3tWarfk+ElO5xq6wgwn4qj22hY=; b=KpXrewssA0A30txq2+0LZMxaNBNRgcw7lha2WakUfQ5Hvx6ZYo08DGuIsk6TloJhqYlhXy Fbef/voGLe9W3OtCM8f3ESy4d2BEIFdf4ztbMxXHCubConZqLGfFKmNRIbqi+HU96r8S/k U6S9MoFRxsvg7fTk7+PuKrE3RHoMwCY= ARC-Authentication-Results: i=1; imf16.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b=DpwTRKlG; dmarc=pass (policy=none) header.from=linux.dev; spf=pass (imf16.hostedemail.com: domain of andrey.konovalov@linux.dev designates 95.215.58.189 as permitted sender) smtp.mailfrom=andrey.konovalov@linux.dev ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1700502450; a=rsa-sha256; cv=none; b=u/Y4bAiB7x0c7UhNieRZbd1jE4amrFJFCBpNoa2u055+zsO9JNPz2mJ8mCSyEGGLVGDWTj KY4ho1kteTYvdOHU0bE++muACH7H41JoRxDT1glgcQ4KkO7P7bIS7RujRIRISBQxiEgpcA FN+7bcKaVk5eAr4eAMOWss6x6BC/khc= 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 X-Migadu-Flow: FLOW_OUT X-Rspamd-Queue-Id: 464F218001C X-Rspam-User: X-Rspamd-Server: rspam04 X-Stat-Signature: 8dmhibswgcywnrk1pox99r83rcgfeoi8 X-HE-Tag: 1700502450-163337 X-HE-Meta: U2FsdGVkX1/rDK61TF+QpvRU6sHx0RPsPuJI8wTeeDk5fGQcgFqk1IG8yeva++/kiCzmitGogeU+UxLm7YV2ka3vkQY0LNI1lhjFpXRhgRBBV3RKxGq/L/4flHNlhlw8L0m433mBx8XPkphDmrj5lW8Cuszqfi7ZVwPi9JlXQjxLIHrb8BJH4P7fWNym7tT1tw7Su20c47M8GEot63xTyFTkiKeig6KZROKhIPB0bNpEm3zNnUX62ESExL9q+bpjXh7Cr7AIh+q8Di9MCnqgbBir25iwwsZy/xsmA71Qk5OT41teQQ6CllzeEVheaFIcI7ggsgnWCN8j3pjrz3ijsoH9aUL9/NtzSGdJUux4IoqH/JBO4ZMBTUwHGtT2+V1WoBDAIWT/83wk8vlSLQe8ShoqcUsp7sOQrd4mIZQ/k4QtkOnkVa4Omhgfi3w6sBLq5zqQZlT2QnnSt/imtlTEztHar2ByIqm0x4nHG9Nc9iftkhQps6/6lk3YNr9eKmzY47Z6bnr4FrW6inTImHgnGLEUroVrS2Sg4AQQgVrgjLZ2yLZqxNcZ2iHq4gsLyAHs29P8yD+Fxe6nX+pVb2LqlwyZ9oIFsdwl2ZK2gWDCYXtDI4Q0wSfLhS1VQ+/e4uq0hwW6QhFZfyzMbNzwanhh6QcHdhP9EkQirvg0gjF//F0ixFy31cOx50nRLTh1SEepPhaAIFAX/ObsrY4k2aHhvq66VGqeAanIyQ0pJ5NBuuIrqWHDqqx9Wc2jdPNb8O1FwT3/FZSORM5rlfIFs704hEdM6tdLI0xyKUgUahnlRS8CuqkqqwFiz4WCi2Eut3kekwl37eRufYFphC0TVIG/kTn3y5LYPMmiBPwUjBM750epGzHmbfELwFccJJWxXTSWhggqtveH6D40tNNUsZRzdkPWd7SWXjZ8CjbMFkE6z6ju0Q6kr4jJNdmjVVXWa0z8xUipO+y7rM7ixO15Ps4 GL7uwB/w xZHtJW3Jk9LS6WESbniHG1lMGyArdNBNoBRSKUBH2c4wuUAKrhEJNqvdDWL+fWB/RrYGfIBOVla1x+8TVilRH1kJ0GjdD+o4yde5o/xwXkjE4FqA= 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: List-Subscribe: List-Unsubscribe: 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 Reviewed-by: Oscar Salvador --- 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);