From patchwork Tue Jul 15 00:40:20 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wang Nan X-Patchwork-Id: 33629 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 691642061E for ; Tue, 15 Jul 2014 00:50:20 +0000 (UTC) Received: by mail-pd0-f199.google.com with SMTP id r10sf32217035pdi.2 for ; Mon, 14 Jul 2014 17:50:19 -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=NEhaEjEntXajpj+uN0G9CoEWSlRTZpqp4TqJkAdtwmo=; b=M1SO0D46AJqSZUJXu9zZuMQMiq28ARy4eDvzHv75gfZq9lRIAO6zwzwSuKEK52uNAg VUA/g4xOMnh+gbFwFdYxMxwNl2Ty9B7vYh/uY+3omhGcpChPx8XT8cpSgmjqgN3f1ovE uSDD9lhsaC3PP721gIXzcFDZPvrABc7/zM7c1s0+FnUj8LCN8zjc45LaJtHX/O8bwl93 YLRbpKH7csIEbSYlm3fmCiCwuEtjVvNuEnUhgtC+17G3ExPYwxavZi1Lxlb/x6nA/Rye xN9vMV9H8dyQxWvwATXxgwD13wXp41eorAbwu1Cf+nxENLFSwOUIsMo2nMxDkKv7BkEZ g9Ew== X-Gm-Message-State: ALoCoQkDy7cX8zznFsB5EGdkck7VVO3PWCyH0JHZMxTO90FLvCcdeHISGm3CXDof3epvz2kUKBoE X-Received: by 10.66.65.108 with SMTP id w12mr4588544pas.46.1405385419617; Mon, 14 Jul 2014 17:50:19 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.105.54 with SMTP id b51ls1244718qgf.48.gmail; Mon, 14 Jul 2014 17:50:19 -0700 (PDT) X-Received: by 10.58.12.73 with SMTP id w9mr19462128veb.13.1405385419505; Mon, 14 Jul 2014 17:50:19 -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 cj20si2265928vdb.54.2014.07.14.17.50.19 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 14 Jul 2014 17:50:19 -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 la4so2080842vcb.23 for ; Mon, 14 Jul 2014 17:50:19 -0700 (PDT) X-Received: by 10.220.177.133 with SMTP id bi5mr5665982vcb.26.1405385419409; Mon, 14 Jul 2014 17:50:19 -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 tc5csp175005vcb; Mon, 14 Jul 2014 17:50:19 -0700 (PDT) X-Received: by 10.70.118.5 with SMTP id ki5mr12018517pdb.104.1405385418517; Mon, 14 Jul 2014 17:50:18 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id ce14si5214971pdb.130.2014.07.14.17.50.17; Mon, 14 Jul 2014 17:50:17 -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 S1754763AbaGOAuH (ORCPT + 28 others); Mon, 14 Jul 2014 20:50:07 -0400 Received: from szxga01-in.huawei.com ([119.145.14.64]:52990 "EHLO szxga01-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752255AbaGOAuD (ORCPT ); Mon, 14 Jul 2014 20:50:03 -0400 Received: from 172.24.2.119 (EHLO lggeml417-hub.china.huawei.com) ([172.24.2.119]) by szxrg01-dlp.huawei.com (MOS 4.3.7-GA FastPath queued) with ESMTP id BYT30207; Tue, 15 Jul 2014 08:49:59 +0800 (CST) Received: from kernel-host.huawei (10.107.197.247) by lggeml417-hub.china.huawei.com (10.72.61.112) with Microsoft SMTP Server id 14.3.158.1; Tue, 15 Jul 2014 08:49:52 +0800 From: Wang Nan To: Steven Rostedt , Ingo Molnar CC: , Subject: [PATCH v2] ftrace: Do not copy old hash when resetting. Date: Tue, 15 Jul 2014 08:40:20 +0800 Message-ID: <1405384820-48837-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. Change from v1: - if statement is swapped to make condition positive. 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..aa61d01 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_ftrace_hash(FTRACE_HASH_DEFAULT_BITS); + else + hash = alloc_and_copy_ftrace_hash(FTRACE_HASH_DEFAULT_BITS, *orig_hash); + 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;