From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out-180.mta1.migadu.com (out-180.mta1.migadu.com [95.215.58.180]) (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 4DC3133EAED for ; Wed, 8 Jul 2026 13:38:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.180 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783517934; cv=none; b=WNg0IuaJSBuWCZ97mGgej/tVFPmMp1ivfNFpuEdnS87d26gAFRyn2xWKLVzfZCTOnqAq4cD5TrUqpm9BV2bm7aiU7sEQo/sJjeullZsMHME3NSkPhEew0DKS++hG/D5T8zUuyr2B4KxyTXvp0b26Rj7gsCIxnp9tcNYM6pu7qEM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783517934; c=relaxed/simple; bh=8x59uWo+vOBAmbBpCRrHvxUBCJ1Z7mHDLdZzdTN389M=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=pwILQ7ayoiDCf+IPjxNO+L/rVdknpy5DYB4IlKcbLl4/nWyka1GDsuNTc9My781slRRF1cmNy0OxRD1EVY+22jkiWpgQYAH4iq1e5y++l7zTg1/XQoFqcZjeeGMmghQEs4j4cLDPO1pkMZs612Wn9NHfBvobQnMFXRNt6zj2pN8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=W81e0/UJ; arc=none smtp.client-ip=95.215.58.180 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="W81e0/UJ" X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1783517921; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=qG1YA7kIP6qYbdRqQAeeSPUuuJTJjj8sPfJa3wtyOFw=; b=W81e0/UJkOUNpofzmj9jhWBEe9h9MYyosQmMi5pVgdUJZEyOuPEoBabjb3AMLr+YA/Mw2p QN4ce4F7zgNJTjOTBxHZqf0B1az/gWquWMXHRm1Zs9EVLIj7FUX3erLdPXM6EQpDeLm1co dgKO5VDA2qP56ygF8wy0hCuqIdHPQUk= From: Usama Arif To: davem@davemloft.net, edumazet@google.com, horms@kernel.org, kuba@kernel.org, kuniyu@google.com, linux-kernel@vger.kernel.org, netdev@vger.kernel.org, pabeni@redhat.com, willemb@google.com, shakeel.butt@linux.dev, hannes@cmpxchg.org, riel@surriel.com, kernel-team@meta.com Cc: Usama Arif Subject: [PATCH] net: use sync wakeups for socket error reports Date: Wed, 8 Jul 2026 06:38:15 -0700 Message-ID: <20260708133815.3419465-1-usama.arif@linux.dev> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Migadu-Flow: FLOW_OUT sock_def_readable() and sock_def_write_space() pass WF_SYNC to their waitqueue wakeups, switch sock_def_error_report() to wake_up_interruptible_sync_poll() so EPOLLERR waiters get the same hint. ep_poll_callback() forwards it through to try_to_wake_up() / select_task_rq_fair(), where wake_affine() can prefer the waker CPU and skip a cross-CPU wakelist IPI when its heuristics agree. WF_SYNC matches the choice already made for readable/write_space. Some error reports have the same producer/consumer shape: the waker has queued an skb on sk->sk_error_queue, and the wakee is about to dequeue and copy it out. Other reports publish sk_err/socket state directly, but still wake a task likely to consume that socket state immediately. Measured on a 176-core EPYC 9D64 host running a Meta production workload, bpftrace on tracepoint:ipi:ipi_send_cpu with a kstack filter attributed the sock_def_error_report -> ep_poll_callback -> try_to_wake_up -> ttwu_queue_wakelist -> __smp_call_single_queue chain to 16,326 IPIs/min. Switching to wake_up_interruptible_sync_poll() will help reduce those IPIs. Signed-off-by: Usama Arif --- net/core/sock.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/core/sock.c b/net/core/sock.c index 8a59bfaa8096..c724f1442987 100644 --- a/net/core/sock.c +++ b/net/core/sock.c @@ -3639,7 +3639,7 @@ static void sock_def_error_report(struct sock *sk) rcu_read_lock(); wq = rcu_dereference(sk->sk_wq); if (skwq_has_sleeper(wq)) - wake_up_interruptible_poll(&wq->wait, EPOLLERR); + wake_up_interruptible_sync_poll(&wq->wait, EPOLLERR); sk_wake_async_rcu(sk, SOCK_WAKE_IO, POLL_ERR); rcu_read_unlock(); } -- 2.53.0-Meta