Message ID | 3b0763c8057a1cf2f200ff250a5f9580ee36a28c.1700502145.git.andreyknvl@google.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2b07:b0:403:3b70:6f57 with SMTP id io7csp105872vqb; Mon, 20 Nov 2023 09:48:20 -0800 (PST) X-Google-Smtp-Source: AGHT+IGpWpZMi0mVX0TEmWn/fvXFubrMJACZB+wKfxQF++8yI/Ga0UY38yMlTCylF4ua4c1d+tFK X-Received: by 2002:a05:6a20:12ca:b0:187:1165:c665 with SMTP id v10-20020a056a2012ca00b001871165c665mr6694755pzg.58.1700502499915; Mon, 20 Nov 2023 09:48:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700502499; cv=none; d=google.com; s=arc-20160816; b=gwqNOyXn1uMX6dimio/qSrfJu+1JTzh5NBStmVyoiqF3qtLLvt8iAOrlZpih66EIKB DVNBfK+zTZ+2mUCMcZAGByyTGujnRZDBsM1KmG9JHBKm6Nuzbt0cvCI4uc/kp42Y/hpD JLQcG92xnj5+jLCkS2VC49GZHhwcaf5/NMoc1d0eiyQKG7SAIeC+Z5EfffGShFLDz1H+ HZgJLlr+z31vicT2xoPB/WJ4qWkwDOP4S+AFDPILNf9mZ1SH6tZHTh8mNZYARZhp1AJj TfQrjpwsTTgOkn91XvJ4CnqCAvv20tIu3hq97W15bqFYlsCTb+bS+L9IiBSyGwKRpY6C reiA== 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=VQKv8ipVyqmLqtwmF3tWarfk+ElO5xq6wgwn4qj22hY=; fh=qWoxmPN1zRqnLSoCWGpfFsDtzJsx/SGdqx98lbP+Uho=; b=Y73Ivh/LoyfPCDmAV0H9fNIpvESBU8z+pJKa2nYKIxRPeWnBS2/9WrKRO5Wy2Z7JFW GFvkcOx9cakZtfDn/JsH4A9GU15rhMJFfknLJraaDgU+E9ZX+IUfet+LjMsHn1YhGj8C gozbxz3b7NrLY8/97TvnyFx0teyQYEG765Nxmwz8uCcU1ZsrSRcQFih4is4269ppQyLZ dh8QC0FIYQ9Ftn+ObHlFwbh06j8hnO62Ma4fBXF7qqKTJSVHf14KHh4F1vodHWKTPZka ui2lTURYel/1HMhGUy5ABqEdEQPdwC2YvG+QEXIBRKHv14UVQuZdR98htsWtPZUSw+BA nCnA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=DpwTRKlG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 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 snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id fd23-20020a056a002e9700b0068ff741579fsi8981499pfb.318.2023.11.20.09.48.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Nov 2023 09:48:19 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=DpwTRKlG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 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 snail.vger.email (Postfix) with ESMTP id 7E2C080DECF0; Mon, 20 Nov 2023 09:47:55 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233971AbjKTRrn (ORCPT <rfc822;heyuhang3455@gmail.com> + 27 others); Mon, 20 Nov 2023 12:47:43 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51272 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232734AbjKTRrd (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Mon, 20 Nov 2023 12:47:33 -0500 Received: from out-172.mta1.migadu.com (out-172.mta1.migadu.com [IPv6:2001:41d0:203:375::ac]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3E65411C for <linux-kernel@vger.kernel.org>; Mon, 20 Nov 2023 09:47:30 -0800 (PST) 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 <akpm@linux-foundation.org> Cc: Andrey Konovalov <andreyknvl@gmail.com>, Marco Elver <elver@google.com>, Alexander Potapenko <glider@google.com>, Dmitry Vyukov <dvyukov@google.com>, Vlastimil Babka <vbabka@suse.cz>, kasan-dev@googlegroups.com, Evgenii Stepanov <eugenis@google.com>, Oscar Salvador <osalvador@suse.de>, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Andrey Konovalov <andreyknvl@google.com> 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: <cover.1700502145.git.andreyknvl@google.com> References: <cover.1700502145.git.andreyknvl@google.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Migadu-Flow: FLOW_OUT X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Mon, 20 Nov 2023 09:47:55 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1783106109720650604 X-GMAIL-MSGID: 1783106109720650604 |
Series |
stackdepot: allow evicting stack traces
|
|
Commit Message
andrey.konovalov@linux.dev
Nov. 20, 2023, 5:47 p.m. UTC
From: Andrey Konovalov <andreyknvl@google.com> 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 <glider@google.com> Signed-off-by: Andrey Konovalov <andreyknvl@google.com> --- lib/stackdepot.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)
Comments
On Mon, Nov 20, 2023 at 06:47:01PM +0100, andrey.konovalov@linux.dev wrote: > From: Andrey Konovalov <andreyknvl@google.com> > > 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 <glider@google.com> > Signed-off-by: Andrey Konovalov <andreyknvl@google.com> Reviewed-by: Oscar Salvador <osalvador@suse.de>
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);