From nobody Thu Apr 9 10:53:34 2026 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EED23413251 for ; Mon, 9 Mar 2026 19:59:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773086367; cv=none; b=vBzoyIDTLPcPoGvJDLraGkUUR2HA+g61oBVLTG7BV3mJouAGhl1CAjKbwD32wy4QTNkKkFvgJ3peCPW0vAVJ5ALn0H7sZV54CzwyrQMiNELK4H7Yef/kg+RlEMqXF+EjfkHrdDeV3CvB1Ba8hDmdKWiKsWT9PaC48OWO8Ze3PSQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773086367; c=relaxed/simple; bh=fg5z2+qe9wyG/Hf1+Ta4lurRlNZxB/n9wfYQjvyek5Y=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=LIoU+FAcFhQfAHZb5X/Bt84edl9LbX02iFUveE2h7VsuR/c8G6LNl2x8Si3cVsnB7vNX439AgRljyMTMorEbb3FQk4dtN3Bzh8I34bnPCUOXrw5k9kSV86D1tl3ozrqmmvjJVaWCkOb7aJcHOt65IsfeWGZTrxqraxrqy1Z12ro= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=Jbegk75s; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="Jbegk75s" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1773086365; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=6xISGNj8SaU6nn8k+kl4N6Sj6+gFLEndGrAKZOLGnLE=; b=Jbegk75s4aqDeMrAxKZDWMMDfX66vGmOR9ty8fKuyZrHzamyZvXQwGSrcDdI2nGwxf/u3w ctRhMxKHDmSgqoB9UhvnfGcVr6OK40n3DFLK0NnHUumFZaAre0kkNPDr7jJJ6TZfFb/DAt FA5Qpyk0GDZP/KginO1IpH5mRb7+BYI= Received: from mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-154-nwjDyO0GOi6XrTqi4Y1vHQ-1; Mon, 09 Mar 2026 15:59:21 -0400 X-MC-Unique: nwjDyO0GOi6XrTqi4Y1vHQ-1 X-Mimecast-MFC-AGG-ID: nwjDyO0GOi6XrTqi4Y1vHQ_1773086359 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 7BEC61800464; Mon, 9 Mar 2026 19:59:19 +0000 (UTC) Received: from fedora.redhat.com (unknown [10.22.81.10]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id B3C4230001A2; Mon, 9 Mar 2026 19:59:14 +0000 (UTC) From: Wander Lairson Costa To: Steven Rostedt , Tomas Glozar , Wander Lairson Costa , Ivan Pravdin , Crystal Wood , Costa Shulyupin , John Kacur , Tiezhu Yang , Daniel Bristot de Oliveira , Daniel Wagner , linux-trace-kernel@vger.kernel.org (open list:Real-time Linux Analysis (RTLA) tools), linux-kernel@vger.kernel.org (open list:Real-time Linux Analysis (RTLA) tools), bpf@vger.kernel.org (open list:BPF [MISC]:Keyword:(?:\b|_)bpf(?:\b|_)) Subject: [PATCH v4 14/18] rtla/timerlat: Simplify RTLA_NO_BPF environment variable check Date: Mon, 9 Mar 2026 16:46:27 -0300 Message-ID: <20260309195040.1019085-15-wander@redhat.com> In-Reply-To: <20260309195040.1019085-1-wander@redhat.com> References: <20260309195040.1019085-1-wander@redhat.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 Content-Type: text/plain; charset="utf-8" The code that checks the RTLA_NO_BPF environment variable calls getenv() twice and uses strncmp() with a length of 2 to compare against the single-character string "1". This is inefficient and the comparison length is unnecessarily long. Store the result of getenv() in a local variable to avoid the redundant call, and replace strncmp() with strncmp_static() for the exact match comparison. This follows the same pattern established in recent commits that improved string comparison consistency throughout the rtla codebase. Signed-off-by: Wander Lairson Costa --- tools/tracing/rtla/src/timerlat.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/tracing/rtla/src/timerlat.c b/tools/tracing/rtla/src/tim= erlat.c index 84577daadd668..91f15f86e78d4 100644 --- a/tools/tracing/rtla/src/timerlat.c +++ b/tools/tracing/rtla/src/timerlat.c @@ -28,12 +28,13 @@ int timerlat_apply_config(struct osnoise_tool *tool, struct timerlat_params *p= arams) { int retval; + const char *const rtla_no_bpf =3D getenv("RTLA_NO_BPF"); =20 /* * Try to enable BPF, unless disabled explicitly. * If BPF enablement fails, fall back to tracefs mode. */ - if (getenv("RTLA_NO_BPF") && strncmp(getenv("RTLA_NO_BPF"), "1", 2) =3D= =3D 0) { + if (rtla_no_bpf && strncmp_static(rtla_no_bpf, "1") =3D=3D 0) { debug_msg("RTLA_NO_BPF set, disabling BPF\n"); params->mode =3D TRACING_MODE_TRACEFS; } else if (!tep_find_event_by_name(tool->trace.tep, "osnoise", "timerlat_= sample")) { --=20 2.53.0