From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.128.71 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796324431; b=i0YaN7gYZdW/gZpoN8+SN+00p3awpMlszdz6GTQRTUFIESzTRfyTjLZCN7/HkGjqEDpy KuIEKKnjSAWuKGdO9dkpN6IRNTFVmJNBFj/ZGIeecS2oJ4X8YAL1dHpFEh52NgD3JrFxz aSNW+etoueqVPq5BIi/kpglLR/cQn5h9QU5DcUOeSTJ6JMm/OST6ux8LwNLuL+7EmYRlw 0N4GoCoBVAPOOcPEc87YrAmig4yIA/mceEOiD0UhRVLAwxTvU4H6sBp88JzsPT8AlzvTZ fvkBfRsaqWkxXXRausRyuKnRpjqzFmKVhQ0EME96lzcUy3Xc5oKJ/tMiN82QUFWA+fg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796324431; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Forwarded-Encrypted:X-Gm-Message-State:X-Received:Date:In-Reply-To: Mime-Version:References:X-Mailer:Message-ID:Subject:From:To:Cc: Content-Type; bh=MCFwVOml2zF0N+fL2Pe58gr1DXw0JVvAuObZg3f5n/g=; b=4iqFTFVB6a+E9qP8A0ah9ql6QsYmqzhLRPpPEpMEe0XATOD4PSLEldl3p4TzzvqT5tqH +itlwy6JdNl0/yb6Utop9qSRlLLbWDO/fQBTt2JMZ6d29pGi43WM00MxNdDDg5hjfGddl 93to47vS3Ct5qmg0SPw+C+a7wfRlXQwYK6icp9UdXzJrRrdqD4JOh7UoPu94HugADQd1j pNGyGq7euNi5joGKceV6PTZJORIkJeCKvi2nf7tc0Y+3CdcohQ0G3GL9F02cdiJ/fuCai iJKXquJS4Z3JXGjp1NcOwAdmnTl3vooUtxt0//EBR5ADHLRjaWfXiZyAT8z/bly7Yhw== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=google.com; spf=pass smtp.mailfrom=flex--vdonnefort.bounces.google.com; dkim=pass header.d=google.com header.i=@google.com header.a=rsa-sha256 header.s=20260707 header.b="jEJ/4XN9"; arc=none smtp.remote-ip=209.85.128.71 Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B25BC606A681 for ; Thu, 3 Dec 2026 19:00:30 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org B25BC606A681 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--vdonnefort.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.a=rsa-sha256 header.s=20260707 header.b=jEJ/4XN9 Received: by mail-wm1-f71.google.com with SMTP id 5b1f17b1804b1-4a204ac318aso473745e9.2 for ; Thu, 03 Dec 2026 11:00:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20260707; t=1796324429; x=1796929229; darn=vger.kernel.org; h=content-type:cc:to:from:subject:message-id:references:mime-version :in-reply-to:date:from:to:cc:subject:date:message-id:reply-to :content-type; bh=MCFwVOml2zF0N+fL2Pe58gr1DXw0JVvAuObZg3f5n/g=; b=jEJ/4XN9FOmq3ER70UyE3D9YlxXIdCr1U32JGBEiUvGzV9b5Q1Ul/u/iParkh/cbj8 T6ccrMDNXZsMIhi/rqYoRbr3N8UZs1gJ3ROnpcf5Ri5moB1eQOxcquiB8R17HwT/mvXb XxW4EnNzsiN0kSc9ZPPG7RIfUhidXEd4slRxVjJ2/CAPDFrNCYb3vfWjTiX5/Y5BTs/H I4YDDjd/OcHVGU+loQlczFrKk4gEE8+ZceRCKvnYvE4ph9K0VNYVbrVACXULrVu747zs uvotOrW1xqPEODdO6stYNl1gnYAeuBXxNKRmFxyJ+s+ps8Zdd4KVUsAlPw0g0DY2cNZb PLvQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796324429; x=1796929229; h=content-type:cc:to:from:subject:message-id:references:mime-version :in-reply-to:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=MCFwVOml2zF0N+fL2Pe58gr1DXw0JVvAuObZg3f5n/g=; b=nQX2dxqIGPdvLzsP8Z0I99SfYFzay/aaA+BpNMsa7FFsUdY07uPLAfuZBJ3aRJU+cG eKrrFpy+1V5ZxQiueXUfH91fzQshHzso2BJUHPRibq5a73Lx4xxK/jVZ5ZPOEhvKiriJ s5bL+Zhgtni95G6hq/yejMD1uXcG/Lee4VcQrADGm1gXlg315ew+zPnywF4jtTPbBs+6 5seNeibZBB8qEe6HNFta8CBol23JEGIsirP8PlLyna8CDkldgS6D64r21DsfjhD3B8uG 2Ta8tbIR+2LpCBr6Ugh2MwR/48oAcfLj4Zrg+pyQ+EaUmdfikHnyp+8NjMlyw7miBP6b uA1Q== X-Forwarded-Encrypted: i=1; AL+hErH1hUEqRsrLFG5vwRpE9Xa4EAQSAJjenADEwBP1alE5S/jbW/ZYe9gzkPm6wQS2wU0HGkZZsXdu4Z5a7O487x3HhKk=@vger.kernel.org X-Gm-Message-State: APuU4Z/HkYAT/uy0QxmBcw3cEymCdoXJZz9kLHTVdtQHHAGKWxjG4Ml7 yFgOeg+kta1+e8X4kXMwqv3WZ8Nr3At41hEcwjwbRpg7leIYiNo5VZaB0P5SIaJ0SoKocwkiC6t 8zzmGNd2ngwXgG8fywVIytA== X-Received: from wrbfp9.prod.google.com ([2002:a05:6000:2789:b0:4b7:d59f:ebcd]) (user=vdonnefort job=prod-delivery.src-stubby-dispatcher) by 2002:a05:600c:530f:b0:4bb:680f:9a3 with SMTP id 5b1f17b1804b1-4bb887e220emr880601635e9.2.1796324429000; Thu, 03 Dec 2026 11:00:29 -0800 (PST) Date: Thu, 3 Dec 2026 19:00:01 +0000 In-Reply-To: <20261203190007.2431041-1-vdonnefort@google.com> X-Mailing-List: linux-trace-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list Mime-Version: 1.0 References: <20261203190007.2431041-1-vdonnefort@google.com> X-Mailer: git-send-email 2.56.1.915.g69d5ec7298-goog Message-ID: <20261203190007.2431041-14-vdonnefort@google.com> Subject: [PATCH v10 13/19] tracing/remotes: Use ring_buffer_capacity() in trace_remote_has_cpu() From: Vincent Donnefort To: rostedt@goodmis.org, mhiramat@kernel.org, linux-trace-kernel@vger.kernel.org Cc: mathieu.desnoyers@efficios.com, kernel-team@android.com, linux-kernel@vger.kernel.org, Vincent Donnefort Content-Type: text/plain; charset="UTF-8" trace_remote_has_cpu() calls ring_buffer_poll_remote() only to check if a CPU is in the trace_buffer cpumask, needlessly polling the meta-page and waking up readers. Use ring_buffer_capacity() instead to check CPU membership without taking reader_lock or triggering wakeups. Signed-off-by: Vincent Donnefort --- kernel/trace/trace_remote.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/trace/trace_remote.c b/kernel/trace/trace_remote.c index f1ceb1733f45..c9d2e8731fdc 100644 --- a/kernel/trace/trace_remote.c +++ b/kernel/trace/trace_remote.c @@ -351,7 +351,7 @@ static bool trace_remote_has_cpu(struct trace_remote *remote, int cpu) if (cpu == RING_BUFFER_ALL_CPUS) return true; - return ring_buffer_poll_remote(remote->trace_buffer, cpu) == 0; + return ring_buffer_capacity(remote->trace_buffer, cpu) > 0; } static void __free_ring_buffer_iter(struct trace_remote_iterator *iter, int cpu) -- 2.56.1.915.g69d5ec7298-goog