From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.3 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 373B0C3A59E for ; Mon, 26 Aug 2019 07:44:56 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 099472080C for ; Mon, 26 Aug 2019 07:44:56 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="bknznGjJ"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="bdX927/h" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 099472080C Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=Jjc8BlL1mXRJm3uEHiho1wpvQqUgDglJon1h2Nq5n7o=; b=bknznGjJm2ft3P UCrrXjUMDVJRewvVcv62hOjB3fpiklxa5UtpqKfmbKrHNIMdq1NQD8qbz0SUX5slmAyoY3l+w/7ZX kixAZDkExLZzHIJ7LU2FNd2Drbui61KV7r+R61M6RkUo5mcqTybYjkwSBnu3+grIqY3nDemtqd5n1 hZDLawv6y4CbLCznfahXAlkNbBFrlQUbDWnTH3rOZrEQaVcy7lzp+TfWoBxa8h8ioAdIRS999PHXr AKP0CjJ0ItsGJYwYTsVVskvKhcBmFxZygBbWgDkCqd/CF4VO9XmpH17jD4C2oOQh6bCuP/PuPkadF TzCrltruwtuGMRK0io3A==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1i29gI-0007IK-8G; Mon, 26 Aug 2019 07:44:50 +0000 Received: from merlin.infradead.org ([2001:8b0:10b:1231::1]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1i29gG-00079c-1s; Mon, 26 Aug 2019 07:44:48 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=FqJ6xvyn0LHQ16MKsazT2HhX3KxiVzyDvsY2B23Ctso=; b=bdX927/h7yS5b1qg30jd4ATTN X998dcLFf2XLF3GhMdnEPUlpSbM/iRxAGrhpx+yvAcP6BXLmbwDijPz2wcP/JwkDHBUjSbZxoDB+3 YQ57G9VNts3H7N7la3on6VnVzaxdmSveaKRWl58IAtaq38KY9/FnISbhc9828VnPKrpWSuveuwCsf LLkKN5ECiFgMtCQvCGf3g2FcMbmezoDuCh0pBTcRFNTS/Q3Cy+gP7YmApuR0lGoAMiLT59cXHHtB4 IueRhEqDIVavy7Y4upqvIZAVIkf6Nx08E5ArJ5fpMQa79c0XUnLbHIWxJnMajZebul2t7vd6teTi+ wxeuxTAhA==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=noisy.programming.kicks-ass.net) by merlin.infradead.org with esmtpsa (Exim 4.92 #3 (Red Hat Linux)) id 1i29g9-00028n-7H; Mon, 26 Aug 2019 07:44:41 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id 4A7803070F4; Mon, 26 Aug 2019 09:44:04 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id A84BA20B33552; Mon, 26 Aug 2019 09:44:37 +0200 (CEST) Date: Mon, 26 Aug 2019 09:44:37 +0200 From: Peter Zijlstra To: Changbin Du Subject: Re: [PATCH 05/11] ftrace: create memcache for hash entries Message-ID: <20190826074437.GM2369@hirez.programming.kicks-ass.net> References: <20190825132330.5015-1-changbin.du@gmail.com> <20190825132330.5015-6-changbin.du@gmail.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20190825132330.5015-6-changbin.du@gmail.com> User-Agent: Mutt/1.10.1 (2018-07-13) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-arch@vger.kernel.org, linux-s390@vger.kernel.org, linux-parisc@vger.kernel.org, Jonathan Corbet , linux-sh@vger.kernel.org, x86@kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, Steven Rostedt , linux-mips@vger.kernel.org, Ingo Molnar , Jessica Yu , sparclinux@vger.kernel.org, linux-kbuild@vger.kernel.org, Thomas Gleixner , linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, linux-arm-kernel@lists.infradead.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Sun, Aug 25, 2019 at 09:23:24PM +0800, Changbin Du wrote: > When CONFIG_FTRACE_FUNC_PROTOTYPE is enabled, thousands of > ftrace_func_entry instances are created. So create a dedicated > memcache to enhance performance. > > Signed-off-by: Changbin Du > --- > kernel/trace/ftrace.c | 17 ++++++++++++++++- > 1 file changed, 16 insertions(+), 1 deletion(-) > > diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c > index a314f0768b2c..cfcb8dad93ea 100644 > --- a/kernel/trace/ftrace.c > +++ b/kernel/trace/ftrace.c > @@ -94,6 +94,8 @@ struct ftrace_ops *function_trace_op __read_mostly = &ftrace_list_end; > /* What to set function_trace_op to */ > static struct ftrace_ops *set_function_trace_op; > > +struct kmem_cache *hash_entry_cache; > + > static bool ftrace_pids_enabled(struct ftrace_ops *ops) > { > struct trace_array *tr; > @@ -1169,7 +1171,7 @@ static int add_hash_entry(struct ftrace_hash *hash, unsigned long ip, > { > struct ftrace_func_entry *entry; > > - entry = kmalloc(sizeof(*entry), GFP_KERNEL); > + entry = kmem_cache_alloc(hash_entry_cache, GFP_KERNEL); > if (!entry) > return -ENOMEM; > > @@ -6153,6 +6155,15 @@ void __init ftrace_init(void) > if (ret) > goto failed; > > + hash_entry_cache = kmem_cache_create("ftrace-hash", > + sizeof(struct ftrace_func_entry), > + sizeof(struct ftrace_func_entry), > + 0, NULL); > + if (!hash_entry_cache) { > + pr_err("failed to create ftrace hash entry cache\n"); > + goto failed; > + } Wait what; you already have then in the binary image, now you're allocating extra memory for each of them? Did you look at what ORC does? Is the binary search really not fast enough? _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel