Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp1649057ybt; Sat, 11 Jul 2020 18:12:29 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwVpnGd5DG5mhHYGjNsb2qI4P7ono4XyYBKE8OuZgt49PHkn0PBibwphSBmO88GaN1VkqjG X-Received: by 2002:a50:eac5:: with SMTP id u5mr20247045edp.6.1594516349379; Sat, 11 Jul 2020 18:12:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594516349; cv=none; d=google.com; s=arc-20160816; b=oVRFHjm1gAGMeZ/GcHo7Y1vpMtFmPHmw2Wwy8IlVMIAqfen5dFkzPULEni2g5EuRMm pRADrzukzAKWheJq5Q9lz9NOiZxYWJFaE2pAUHBCJRO8IULU9sdh4TTLkRYs69P0hXzv 3H9OYS1zHj1F+WayIP6RGAq0UwY27P9sYjBUJsRTLwME0bbSw7M4rjWuJ1VTklp1jqDc LodbFdtu9q1ahOhp94gV8KRpqOSjuxKpdhY/HuNTCHGzW9kfkWGPCjf0FN92tmimWEJ2 Vb7p7sGA823rbl3YkM5hCg2IT/s0I/uZZDMlqx4gqQqSwUzypA9TQ5SyMumjUND1GWBq Wksw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=eUHfGqzYJ1hQgwiIi60gaVANPb9oiytH7v3g2yuJOio=; b=OYWNS/X7VARLNehSFjLMvR8BeCBRS6xPL+NE9Kgwq2ZO65elZTq6K5WDFV0tTsZYIr 0C6KDSf40Hby36Gm6Xbtry80RJGlD4X/s/hZB7JR6xT866O/z6EvdBUxlbpL7+VLwkun ZTJqc8l0TW2FZboVKsYYnB4MRjaw7N3n6XPayguuqdo95UARugc6mrui0dMn3Kwpx9Wu KglSKOlUByBvQAy/uvsqTN4paAcikTiiLyqnU7hhA9TqF/8pfpZZAUIOmswKPxom0oxT nitggWHPKA1VEw5uT/PygNT0QxPgES1reJsKW4mzP1zcgtb5Op/kM4REmOrFvi4HhFAe EIRA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v21si6962061ejg.127.2020.07.11.18.11.44; Sat, 11 Jul 2020 18:12:29 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728093AbgGLBLg (ORCPT + 99 others); Sat, 11 Jul 2020 21:11:36 -0400 Received: from out30-56.freemail.mail.aliyun.com ([115.124.30.56]:48635 "EHLO out30-56.freemail.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726948AbgGLBLg (ORCPT ); Sat, 11 Jul 2020 21:11:36 -0400 X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R121e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01e01419;MF=richard.weiyang@linux.alibaba.com;NM=1;PH=DS;RN=4;SR=0;TI=SMTPD_---0U2PF1Lq_1594516293; Received: from localhost(mailfrom:richard.weiyang@linux.alibaba.com fp:SMTPD_---0U2PF1Lq_1594516293) by smtp.aliyun-inc.com(127.0.0.1); Sun, 12 Jul 2020 09:11:33 +0800 From: Wei Yang To: rostedt@goodmis.org, mingo@redhat.com Cc: linux-kernel@vger.kernel.org, Wei Yang Subject: [Patch v2 1/4] tracing: simplify the logic by defining next to be "lasst + 1" Date: Sun, 12 Jul 2020 09:10:33 +0800 Message-Id: <20200712011036.70948-2-richard.weiyang@linux.alibaba.com> X-Mailer: git-send-email 2.20.1 (Apple Git-117) In-Reply-To: <20200712011036.70948-1-richard.weiyang@linux.alibaba.com> References: <20200712011036.70948-1-richard.weiyang@linux.alibaba.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The value to be used and compared in trace_search_list() is "last + 1". Let's just define next to be "last + 1" instead of doing the addition each time. Signed-off-by: Wei Yang --- kernel/trace/trace_output.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/kernel/trace/trace_output.c b/kernel/trace/trace_output.c index 73976de7f8cc..a35232d61601 100644 --- a/kernel/trace/trace_output.c +++ b/kernel/trace/trace_output.c @@ -675,11 +675,11 @@ static LIST_HEAD(ftrace_event_list); static int trace_search_list(struct list_head **list) { struct trace_event *e; - int last = __TRACE_LAST_TYPE; + int next = __TRACE_LAST_TYPE + 1; if (list_empty(&ftrace_event_list)) { *list = &ftrace_event_list; - return last + 1; + return next; } /* @@ -687,17 +687,17 @@ static int trace_search_list(struct list_head **list) * lets see if somebody freed one. */ list_for_each_entry(e, &ftrace_event_list, list) { - if (e->type != last + 1) + if (e->type != next) break; - last++; + next++; } /* Did we used up all 65 thousand events??? */ - if ((last + 1) > TRACE_EVENT_TYPE_MAX) + if (next > TRACE_EVENT_TYPE_MAX) return 0; *list = &e->list; - return last + 1; + return next; } void trace_event_read_lock(void) -- 2.20.1 (Apple Git-117)