From patchwork Tue Aug 29 17:11:12 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: 13369231 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 A969CC83F12 for ; Tue, 29 Aug 2023 17:11:44 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 2067E8E002E; Tue, 29 Aug 2023 13:11:40 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 1B6E48E002F; Tue, 29 Aug 2023 13:11:40 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E37918E002E; Tue, 29 Aug 2023 13:11:39 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id C4A4C8E002E for ; Tue, 29 Aug 2023 13:11:39 -0400 (EDT) Received: from smtpin06.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 9585F801E1 for ; Tue, 29 Aug 2023 17:11:39 +0000 (UTC) X-FDA: 81177783918.06.489F274 Received: from out-246.mta1.migadu.com (out-246.mta1.migadu.com [95.215.58.246]) by imf21.hostedemail.com (Postfix) with ESMTP id DA8031C0027 for ; Tue, 29 Aug 2023 17:11:37 +0000 (UTC) Authentication-Results: imf21.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b=FMOUlvJx; spf=pass (imf21.hostedemail.com: domain of andrey.konovalov@linux.dev designates 95.215.58.246 as permitted sender) smtp.mailfrom=andrey.konovalov@linux.dev; dmarc=pass (policy=none) header.from=linux.dev ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1693329098; a=rsa-sha256; cv=none; b=DX8+n9o+Q7jlYAYQvX6G08w5p5qW3TJ1Fhd9UDMt0XKzOjNfU95xkPb0dAH38LJc6g3XsX gUX+NwqFAF3sRu+mp9yohexvW0IcUbRVg3CZTeTrS82AgqWyVN/Os9LYVEG+PfODLCz6FW RJM2FI1SLh731GaJyOW/R0+xjj52QTo= ARC-Authentication-Results: i=1; imf21.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b=FMOUlvJx; spf=pass (imf21.hostedemail.com: domain of andrey.konovalov@linux.dev designates 95.215.58.246 as permitted sender) smtp.mailfrom=andrey.konovalov@linux.dev; dmarc=pass (policy=none) header.from=linux.dev ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1693329098; 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=Opt9t2Sh3BPQLxjav3raWw4j3L9ASrpPJpFprr4WIwg=; b=JnbOx9J9wyObtCblZLKuuXpr3dF937ve0syZSFq57kkdmLv9KZC5br+TDSrBms3CdmNOYp PkcTZok8PRk35GKX9r55mq7JxpF2j8VjjajUVcKPgmTuR6I/YRVU5olLtCL/H6PZ+VGEUO weiUke9hVheVWROQ7wQL64DMWxyz1V4= 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=1693329096; 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=Opt9t2Sh3BPQLxjav3raWw4j3L9ASrpPJpFprr4WIwg=; b=FMOUlvJxgMB5WpKRQ7t3KX2aGQnwsNKzQ2ccI31MOspuXDov1WZjg8f3zBxS9aiip16KLg QsPLydt7gf0VxZWrz0MHedBxpNNjUHO1AeoE3D3p5RwVNU7SOLfTAhOveTf+35NDZNtujl ResgGbrFAGlj6khMSxwabRc53OkvSPc= From: andrey.konovalov@linux.dev To: Marco Elver , Alexander Potapenko Cc: Andrey Konovalov , Dmitry Vyukov , Vlastimil Babka , kasan-dev@googlegroups.com, Evgenii Stepanov , Andrew Morton , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Andrey Konovalov Subject: [PATCH 02/15] stackdepot: simplify __stack_depot_save Date: Tue, 29 Aug 2023 19:11:12 +0200 Message-Id: <20dbc3376fccf2e7824482f56a75d6670bccd8ff.1693328501.git.andreyknvl@google.com> In-Reply-To: References: MIME-Version: 1.0 X-Migadu-Flow: FLOW_OUT X-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: DA8031C0027 X-Stat-Signature: x4f969xzz1puoyme5us4zsaaozrwxuw6 X-Rspam-User: X-HE-Tag: 1693329097-494968 X-HE-Meta: U2FsdGVkX1+npRKnIHwx1v9QC+zrDcveDgBrnlQ3E9IjbWRpQpdefwLqNczVFyvNGDoHEMvBo1FuSg3nUM4DbpEQPTauoEmcChQN33VzXQHrkfbHk1yG9D/9xV96SVv1yA88bvaDEyM5IakccIjIZi6WH9GU7POg8pXvndthoycegb+qHWc8abK5ZwUVBHbf1/JqBZCs0ILO5fXhc06YPiySR33tAW1CDN97wqAGRmeRYV70+gDHygrwNzPruIfsxJTYO+YD1cM8bMMMxQs/TbF7qaI++H8aWKo6dszAa9oeYVS1Y9lL7QwOnoMY0BqLfrMxyzws8Q2KIO/JtQsEmBJ1ImsCwEf9N9Y6bBBBDFAy3PE10g+wyyQM5hMloBReakWmql3EAyGjqT1RPmaPESxSiFLDeAOtawF9KV7RZ5dKDUBeRk01+/DHtjIlg3ELh0ayw1j3En6xBTfn9VOVc/fo+AQsdThgxGIz6r1TR75rcs9V//Li4Bdh0PRQuSZ++qLdkDJqFUbpjyIAc4ltS2rZDbiJwMLKXvkUj6TB/eNwRVC80c1ZN/RToa00cBsMy4v1n0ESYc+4ucSFZUKzWDgFNoy7Y26p1M74NHRvcXv2NcPH7GhVOi1dW55WWkGOFn8eCZzp/lwCkLAflqj2zVWCGwUiCLCl9golyvD8BZ9MGvx0wO5tZkJ8EQdZfjXPwXuAFYFiHL6i2ecoVlmtmHJ/wpb4RGDQ3Uf0alIv+PR2iSdmsJh3U7VwLHKJvnKZvOBBCTHu/n1gh10tWswbjh63QJHyzFf6vv5lUqXFj+hhoQAh8p9AFfsoVrpjTVxQiSCxnPe5DI8Vv+fIZh7Ojr6TYicK+JOF0hHQtWxqqz/RXo3qBEWvrN9Ip3Xvpangh3D792h02t+cQ8Zp5WDnV2vRHr7PQghBvw7OpF8fV9Nb5u1R658wSgcWE894/FNhR6kHv/Y7sAOH0CmA6X3 oMb0EtQd Yd1B40IA9WhUDcjujKYQrRS7rm0D4rO5pYOOEWdwxRrj7ZiIrzfbPNU5oBGJY3+d7xa4PJMw4zAUvGxlSIUFBJA50f8Nt3omhNav5EyMxR+EV4/O2SHKHL5RsFvn1nxZXeBKJBUB20gfPj04yvqZ6r1g1Cg== 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. Signed-off-by: Andrey Konovalov Reviewed-by: Alexander Potapenko --- 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);