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: 13433182 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 50B47C001E0 for ; Mon, 23 Oct 2023 16:23:05 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 9C4C56B00F6; Mon, 23 Oct 2023 12:23:02 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 926C56B00F7; Mon, 23 Oct 2023 12:23:02 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6B4666B00F8; Mon, 23 Oct 2023 12:23:02 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 5DF536B00F6 for ; Mon, 23 Oct 2023 12:23:02 -0400 (EDT) Received: from smtpin10.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 16C1580369 for ; Mon, 23 Oct 2023 16:23:02 +0000 (UTC) X-FDA: 81377245404.10.E9BAD3D Received: from out-198.mta0.migadu.com (out-198.mta0.migadu.com [91.218.175.198]) by imf21.hostedemail.com (Postfix) with ESMTP id 33C341C001C for ; Mon, 23 Oct 2023 16:22:59 +0000 (UTC) Authentication-Results: imf21.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b=BwPbMNBq; dmarc=pass (policy=none) header.from=linux.dev; spf=pass (imf21.hostedemail.com: domain of andrey.konovalov@linux.dev designates 91.218.175.198 as permitted sender) smtp.mailfrom=andrey.konovalov@linux.dev ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1698078180; a=rsa-sha256; cv=none; b=O57KPqxdSmhNK7WYamfhMT7+Mcj+vRy4JhiwJitVt53/eTc4ZeDq7LpPMqcaSpxSMDwS3w 0Fet+dV/KQH/ZvEgZg559/XKRpfXTz5Tve48TpXErMjLdUFBRo8+BcooDy8b6mRQyaj2QS JFdnYLvxd4Cxr2k8xnWKe9gxn7JG5Kk= ARC-Authentication-Results: i=1; imf21.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b=BwPbMNBq; dmarc=pass (policy=none) header.from=linux.dev; spf=pass (imf21.hostedemail.com: domain of andrey.konovalov@linux.dev designates 91.218.175.198 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=1698078180; 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=6Ee2X4hrG7yRKQgkpyuruJHhSkWD0xROiPzJZkJqjQ7FipkMacAwqWRyNi9etGwjpRyms9 z/vlqGo13dAtdkJIjJdJeJWDnJyu3n2awo9H1hAMPkwvZ3k2PqcsVW1LzILlDLkVqujUSn ICqkj62kOTiB8d2X/2qNyZXwlt/I8go= 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-Rspam-User: X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: 33C341C001C X-Stat-Signature: cxhdim89rxmezgnoyssuceqk87rob7ir X-HE-Tag: 1698078179-407099 X-HE-Meta: U2FsdGVkX1/pNABn2p0KehIWRJ6vJBWalCW1+qHDtibPFTCCqQnYR2LnQ5EtKVy+ueYPd2gefJskX5P2mGeH1Jte5298nnoGYu5lK/3ZwAEBkgPnRGnSyEb9/4slJbH6eHjKz+XFyRSaDyPjHvYkGtINE/ejg5iQdH+qI7+lomEPvjfVSta/DDKAbmbAzc/I+di4nR7h1v8nCkG39qqefT/Z9xivF6mgmJD/i34j1H+nu4z9vjwUu9qIG/UZrluBD4/1S+kBzozzV2jMyNovFbTwSIjb15YKr0FMkSpcKPUVR8b0/Q1jZzc+lFtX4NHRzId0BY7hdso1n5nZbi1wm0jcYBsZGnaC8IB33+dp+UTfKJ03Bi7nujMPoPzY78sJx8/44mo2XiEmrqaz9Y8rA2I3SkpCXBZdZNdQdEkWMXOSjzYGDlkGY1h+HbozjjPVdN80WuLFQQmaVUksBWfTdCR8f4fhJ7nN/RiMVFosKWe+U7lWBwG8NeIU7A5esd0aFFivzdggnqkDgYvEbzRPHcQL8Zi6YcOsjwGjCyMrBOYV2jbFkWjyAjQYnZopz0u0HakXiEOcP0Knm1mlWAxJzsL1onwZZASua5GJNzwI0JzFKlUUZyXCL3ReABwn+qDLvMi6mf8dw8cP03qafUSeEiJq0I/x+HWgJ0CAG5ty2rI0x2wkPzPWHlTd6fZncxJiVdfdabjjp+VjLu9rr8VdxNuen400yaaNtAivD1oO0eJhdwLgQbW2GS+umReoLxAiomrNlQlDB0iaYW3OhyIhG+FSrlLz7DwAB1gIIgMWGykYjnmbz698kLXK1VDv+nlxwpUQ8FrTNf/zbPkKaAFZwrwA+chnx0u959uxyDnic7Lnl3pwFc/PPW4nam3mEJC9LvpgLe0ucjfdqZhuc2eWViMjmCHHr6YE2LzGsZDH8vf92IOhDyPTIqRg8CZb+0LV0nAiDQm9PGew0rUUp8E nA7wq0Sr FOkQRBOHQEDN1aGd40Vqun9WCaK6RyT4yyuNmnidRwWW99mQ+MHzvyvzGFrseLaR8ra6yzk/Te9ffV4Uj+6eY852nun0mktKxGmc1xCEPQsKu0XqjWEuqxu1QzErFx/SdkLobxsngeon5A6Cc11fKYP78iw== 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 --- 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);