From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753895AbdL1Qci (ORCPT ); Thu, 28 Dec 2017 11:32:38 -0500 Received: from mail.kernel.org ([198.145.29.99]:56540 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753369AbdL1Qch (ORCPT ); Thu, 28 Dec 2017 11:32:37 -0500 DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0A8A6217C3 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=goodmis.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=rostedt@goodmis.org Date: Thu, 28 Dec 2017 11:32:34 -0500 From: Steven Rostedt To: Jessica Yu Cc: Namit Gupta , mingo@redhat.com, linux-kernel@vger.kernel.org, pankaj.m@samsung.com, a.sahrawat@samsung.com, rusty@rustcorp.com.au Subject: Re: [PATCH v2] ftrace/module: Move ftrace_release_mod to ddebug_cleanup label Message-ID: <20171228113234.5d0a8829@gandalf.local.home> In-Reply-To: <1513079672-13652-1-git-send-email-gupta.namit@samsung.com> References: <1513079672-13652-1-git-send-email-gupta.namit@samsung.com> X-Mailer: Claws Mail 3.14.0 (GTK+ 2.24.31; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Jessica, Can you take this patch. You can add: Reviewed-by: Steven Rostedt (VMware) Thanks! -- Steve On Tue, 12 Dec 2017 17:24:32 +0530 Namit Gupta wrote: > ftrace_module_init happen after dynamic_debug_setup, it is desired that > cleanup should be called after this label however in current implementation > it is called in free module label,ie:even though ftrace in not initialized, > from so many fail case ftrace_release_mod() will be called and unnecessary > traverse the whole list. > In below patch we moved ftrace_release_mod() from free_module label to > ddebug_cleanup label. that is the best possible location, other solution > is to make new label to ftrace_release_mod() but since ftrace_module_init() > is not return with minimum changes it should be in ddebug_cleanup label. > > > Signed-off-by: Namit Gupta > > --- > kernel/module.c | 7 +------ > 1 file changed, 1 insertion(+), 6 deletions(-) > > diff --git a/kernel/module.c b/kernel/module.c > index 0d1cb8d..4be966a 100644 > --- a/kernel/module.c > +++ b/kernel/module.c > @@ -3523,6 +3523,7 @@ static int load_module(struct load_info *info, const char __user *uargs, > unset_module_core_ro_nx(mod); > > ddebug_cleanup: > + ftrace_release_mod(mod); > dynamic_debug_remove(info->debug); > synchronize_sched(); > kfree(mod->args); > @@ -3541,12 +3542,6 @@ static int load_module(struct load_info *info, const char __user *uargs, > synchronize_rcu(); > mutex_unlock(&module_mutex); > free_module: > - /* > - * Ftrace needs to clean up what it initialized. > - * This does nothing if ftrace_module_init() wasn't called, > - * but it must be called outside of module_mutex. > - */ > - ftrace_release_mod(mod); > /* Free lock-classes; relies on the preceding sync_rcu() */ > lockdep_free_key_range(mod->module_core, mod->core_size); >