From patchwork Mon Jul 14 04:10:00 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wang Nan X-Patchwork-Id: 33547 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-pd0-f199.google.com (mail-pd0-f199.google.com [209.85.192.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 90EF120CB3 for ; Mon, 14 Jul 2014 04:20:10 +0000 (UTC) Received: by mail-pd0-f199.google.com with SMTP id r10sf24904571pdi.10 for ; Sun, 13 Jul 2014 21:20:09 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:cc:subject:date:message-id :mime-version:sender:precedence:list-id:x-original-sender :x-original-authentication-results:mailing-list:list-post:list-help :list-archive:list-unsubscribe:content-type; bh=K57mqf6yui3WGArGWjyBX9NlnhSoPKxdMdjwHj62JP4=; b=ISLc9XlzPduSpZz5kO8OHfmn4+LfO2+TSjE5pGPYW7FmSKiuiZ2Jt3MGSXbdca44YE K85sKvimIB7UmL4CxbdLzHyNXvpNxWdfMLKQQF+paFMdFPJGMlE1dmYzjCEG/TBx/at+ N0n4x+t23LjeA4pzMxqRwImg++S2HBuqWcQbwGUjtq/ad6al52X+KO00d0EbRFHxP54j vvsdNYlqBbCGL4BCYnh0FP90GYswdSg7bC1Pa2jh01QFkDy7jeGozRExcgphZyjVUDO/ ze8KJGMJ5cCcAyoh9aoehR1Yw4kKm2hmmn8iG85NxIZqMA+Wk3UMcRR5P7YJWyi0uNYc GEXw== X-Gm-Message-State: ALoCoQkjX/bko4DEMP0HJasIeKNCVG4pexNgLNyHUNphlrYpYwkceaPVshOfB/5GYkZaMAV8mIzg X-Received: by 10.66.144.228 with SMTP id sp4mr6798109pab.5.1405311609441; Sun, 13 Jul 2014 21:20:09 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.108.228 with SMTP id j91ls913384qgf.31.gmail; Sun, 13 Jul 2014 21:20:09 -0700 (PDT) X-Received: by 10.221.55.70 with SMTP id vx6mr4857921vcb.23.1405311609314; Sun, 13 Jul 2014 21:20:09 -0700 (PDT) Received: from mail-vc0-f178.google.com (mail-vc0-f178.google.com [209.85.220.178]) by mx.google.com with ESMTPS id lh5si4945457vdb.33.2014.07.13.21.20.09 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sun, 13 Jul 2014 21:20:09 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.178 as permitted sender) client-ip=209.85.220.178; Received: by mail-vc0-f178.google.com with SMTP id ij19so6163038vcb.23 for ; Sun, 13 Jul 2014 21:20:09 -0700 (PDT) X-Received: by 10.52.117.209 with SMTP id kg17mr3718593vdb.28.1405311609202; Sun, 13 Jul 2014 21:20:09 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.221.37.5 with SMTP id tc5csp104356vcb; Sun, 13 Jul 2014 21:20:08 -0700 (PDT) X-Received: by 10.70.6.98 with SMTP id z2mr4656862pdz.83.1405311608376; Sun, 13 Jul 2014 21:20:08 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id qp5si4102282pdb.454.2014.07.13.21.20.07; Sun, 13 Jul 2014 21:20:07 -0700 (PDT) Received-SPF: none (google.com: linux-kernel-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752410AbaGNET6 (ORCPT + 28 others); Mon, 14 Jul 2014 00:19:58 -0400 Received: from szxga01-in.huawei.com ([119.145.14.64]:19097 "EHLO szxga01-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750703AbaGNETw (ORCPT ); Mon, 14 Jul 2014 00:19:52 -0400 Received: from 172.24.2.119 (EHLO lggeml412-hub.china.huawei.com) ([172.24.2.119]) by szxrg01-dlp.huawei.com (MOS 4.3.7-GA FastPath queued) with ESMTP id BYS34697; Mon, 14 Jul 2014 12:19:48 +0800 (CST) Received: from kernel-host.huawei (10.107.197.247) by lggeml412-hub.china.huawei.com (10.72.61.108) with Microsoft SMTP Server id 14.3.158.1; Mon, 14 Jul 2014 12:19:37 +0800 From: Wang Nan To: Steven Rostedt , Ingo Molnar CC: Subject: [PATCH] ftrace: Do not copy old hash when resetting. Date: Mon, 14 Jul 2014 12:10:00 +0800 Message-ID: <1405311000-75943-1-git-send-email-wangnan0@huawei.com> X-Mailer: git-send-email 1.8.4 MIME-Version: 1.0 X-Originating-IP: [10.107.197.247] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: wangnan0@huawei.com X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.178 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , If we are going to reset hash, we don't need to duplicate old hash and remove every entries right after allocation. Signed-off-by: Wang Nan Cc: Steven Rostedt Cc: Ingo Molnar --- kernel/trace/ftrace.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c index 5b372e3..52d6931 100644 --- a/kernel/trace/ftrace.c +++ b/kernel/trace/ftrace.c @@ -3471,14 +3471,16 @@ ftrace_set_hash(struct ftrace_ops *ops, unsigned char *buf, int len, else orig_hash = &ops->notrace_hash; - hash = alloc_and_copy_ftrace_hash(FTRACE_HASH_DEFAULT_BITS, *orig_hash); + if (!reset) + hash = alloc_and_copy_ftrace_hash(FTRACE_HASH_DEFAULT_BITS, *orig_hash); + else + hash = alloc_ftrace_hash(FTRACE_HASH_DEFAULT_BITS); + if (!hash) { ret = -ENOMEM; goto out_regex_unlock; } - if (reset) - ftrace_filter_reset(hash); if (buf && !ftrace_match_records(hash, buf, len)) { ret = -EINVAL; goto out_regex_unlock;