Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp38343747rwd; Wed, 12 Jul 2023 06:32:26 -0700 (PDT) X-Google-Smtp-Source: APBJJlFXp2XcqN6ZIDHUbVUHQ+9h6bnEB1RakkLYSlyHzpIquSjzBbcSltS6mpyJuQtp2K0qs7NN X-Received: by 2002:a05:6a20:7f90:b0:12e:c041:b652 with SMTP id d16-20020a056a207f9000b0012ec041b652mr26001725pzj.40.1689168745867; Wed, 12 Jul 2023 06:32:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689168745; cv=none; d=google.com; s=arc-20160816; b=peXjwYecEEFJNf+YXRy2ZpiyDYOxO5Y/AibnXnMYHMv+bbT8Mc4ik3MRtyIH24FUqO pubOix9VHfvJ6JIEcHe7D6hIUElZZK3cvYIkAaVG0PfEe3upnI8wLIKU2hpRw7xITwJb w5laMdOPr/iyElmyFsd+qnQTkHMppxfCDeEBhcOY1t5A8jYnokeeLYeVFFND/EMg8BrM PStu67g82toLVz2iEyMtjHSXockd06XvlflCH6+14jLwoJ6oQ9gTqcJj8D+PN8R2DxAK 2OfXXn4ARVPVHDLgLIvWiAhhbSGBskkJA3f70xo01k9yUgxCx3PKluqanAv4QCzJHEyk 0yiw== 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:subject:cc:to:from:date; bh=5DzhuavlFy7GTdmhY+/dhZF0LwsNOTaMtUy9MIQ64H8=; fh=5QhtmWoGPmMG6fXCxQGGdg28R6Txb/Jl7PkzwTrRF6w=; b=P9t8jAa2xfdIXgrSED9MRh94BIyMFLjjr1DlM/a1i4wcM90zZsF5pqLwdX5+RnOI/m raaGpTUt8moMpBCY/Y7rVNgCKDj8zUuFh3xpUSTR0W9t0KIW5vXbIRRvysheCZ50AbGx S6eXO1+17ZVO1q61vo1MWmi3TPogoYgex4ITouDDC+8BF6Epz1enCEw1OfYepHwncAfu h/6NTJxZ1YYFaB56iEJl9SZ9o6RnTkEn122pg1onn6cDNeC9YUNK6idAiXguIaBV/Or1 3kez6hqc63a9gdbo/yDzMeNV2OD3qq7Dup/ulwjbX3AXGNucIZOMMxg+Z2kBZfuI20Oe bVMg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q10-20020a056a00150a00b00682d2ab09dbsi3337053pfu.306.2023.07.12.06.32.13; Wed, 12 Jul 2023 06:32:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231889AbjGLMhf (ORCPT + 99 others); Wed, 12 Jul 2023 08:37:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53182 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231608AbjGLMhc (ORCPT ); Wed, 12 Jul 2023 08:37:32 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 555FF1718; Wed, 12 Jul 2023 05:37:31 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id E7C21617BF; Wed, 12 Jul 2023 12:37:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C5E45C433C7; Wed, 12 Jul 2023 12:37:29 +0000 (UTC) Date: Wed, 12 Jul 2023 08:37:27 -0400 From: Steven Rostedt To: Zheng Yejian Cc: , , Subject: Re: [PATCH v5] ftrace: Fix possible warning on checking all pages used in ftrace_process_locs() Message-ID: <20230712083727.405920c4@gandalf.local.home> In-Reply-To: <20230712060452.3175675-1-zhengyejian1@huawei.com> References: <20230711095802.71406422@gandalf.local.home> <20230712060452.3175675-1-zhengyejian1@huawei.com> X-Mailer: Claws Mail 3.19.1 (GTK+ 2.24.33; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=no 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: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 12 Jul 2023 14:04:52 +0800 Zheng Yejian wrote: > --- a/kernel/trace/ftrace.c > +++ b/kernel/trace/ftrace.c > @@ -3305,6 +3305,22 @@ static int ftrace_allocate_records(struct ftrace_page *pg, int count) > return cnt; > } > > +static void ftrace_free_pages(struct ftrace_page *pages) > +{ > + struct ftrace_page *pg = pages; > + > + while (pg) { > + if (pg->records) { > + free_pages((unsigned long)pg->records, pg->order); > + ftrace_number_of_pages -= 1 << pg->order; > + } > + pages = pg->next; > + kfree(pg); > + pg = pages; > + ftrace_number_of_groups--; > + } > +} > + > static struct ftrace_page * > ftrace_allocate_pages(unsigned long num_to_init) > { > @@ -3343,17 +3359,7 @@ ftrace_allocate_pages(unsigned long num_to_init) > return start_pg; > > free_pages: > - pg = start_pg; > - while (pg) { > - if (pg->records) { > - free_pages((unsigned long)pg->records, pg->order); > - ftrace_number_of_pages -= 1 << pg->order; > - } > - start_pg = pg->next; > - kfree(pg); > - pg = start_pg; > - ftrace_number_of_groups--; > - } > + ftrace_free_pages(start_pg); > pr_info("ftrace: FAILED to allocate memory for functions\n"); > return NULL; > } Nice little clean up. I had already started testing your previous patch, but due to my test machine running out of disk space (perf doesn't clean up its .debug directory :-p), I have to rerun it. I'll apply this one for the new testing. Thanks! -- Steve