From patchwork Mon Mar 4 08:43:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Howells X-Patchwork-Id: 209419 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:fa17:b0:10a:f01:a869 with SMTP id ju23csp1293193dyc; Mon, 4 Mar 2024 00:46:19 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUGbUiXqFaQ8B0OLeV+NAMwefKIUcVHs+O7BuQt4ec8b0VcQGTEq6KdbpFztcgz4YfNR4M3Rd7mZ3PYDvqbs3jZt113kA== X-Google-Smtp-Source: AGHT+IHQvffFS2L/H0oTd9DFTFYyV6UxpN3c0XYuFeHObir77aw4OXArDeya1GXdDg5tWudnWtXQ X-Received: by 2002:a05:6a21:182:b0:1a1:4d7a:116 with SMTP id le2-20020a056a21018200b001a14d7a0116mr4352172pzb.21.1709541979005; Mon, 04 Mar 2024 00:46:19 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709541978; cv=pass; d=google.com; s=arc-20160816; b=ctQ+xOmvpw2x4OqeMSCDDkxnEClQjzT8UfS0k+9SEIrhibEBEfwWSjv7aAeiODDqPl wfAHssETYADNOALd8jAHviAxoMOmgceSHYpMm+mPJRn0ow7P4sdnjvKbUOwLvnBwOEXr BkXcYc5j3cFRD3kbxXZ1H7ZHEZZih1LInWR/PcrOOq+TJanLO4I+eoDpy3qliiHXhwbI CX7j5rRAn21I3/r4hUl3YLpJQ2u/MUnEErDnS0QgfYUtkejCFpsvvqzpCeH5p2dl5zlT TmsVGCIqajntbJ2A3kv9ksHBu7189cC/1SsNNKD5cpvTzzS6q6qME+y0RoKjYMgu4puO pnoA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=Ol9Zm5BaokJG1LA5SA9PnxgRsE5CFPeI5pD0RB5to08=; fh=icnuzcdbhXgwjK0pgvJXK7xplE+Och0jvyZv2PxZJ18=; b=AVpIxGUbjRDA6F34UP0ywM+t3Uq3whonL3dFZWE8CaEU+JP3Xyh9b+2TFmSUqpmTqW +XMWR89x2Iv4YJQi+bDRM3cWtTbxgZtvoorLo2uKtfEnaAzho6pT/2GP8UeMKvZygnYh Bmbra9YNiExZTekmt3WLkRr3jA6EQRBFo4cZRRTDpdYBZySxdEhs0PkWP/OjNgTFxesx pEwJYD8VhmMnIbra1HsS+743BrZyMF31NIGdzYKR4Vbrf3ZXOO/0HtDotBIvpmie6ou8 EK3G02KPwk6CrhdIwjz+dIlHT0TNmlRFRPbCtKagLW8lb65xQXqUXfRj4keHbpzP4O9R amHA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=ac+vlo2M; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-90223-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-90223-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id il3-20020a17090b164300b0029b388e6066si3208732pjb.102.2024.03.04.00.46.18 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Mar 2024 00:46:18 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-90223-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=ac+vlo2M; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-90223-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-90223-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 251F3B20A09 for ; Mon, 4 Mar 2024 08:46:12 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id DC74F20300; Mon, 4 Mar 2024 08:43:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="ac+vlo2M" 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 598FF224E6 for ; Mon, 4 Mar 2024 08:43:42 +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=1709541824; cv=none; b=ua5WKHT9Rtl5kN8GDUg9uqL34BFdJAjHpncZsaijnW2d8vDFlS6bm6BZVGRHeFDf8lDSDjJXAy+1hFf8fTliPXFsnYJCi4W1LWrRidqkp5oNbT/xGrNwZgECsegctsRkiVH3Q1I4yE17hhxZSOjaWm8C2nFSpf2CRLS5xYYumlA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709541824; c=relaxed/simple; bh=0raf8PRlraWnPhbn6SRbKPcBod2VJHcvfxva3reVfio=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=o3ac5LIEqkV9TKtf1PpRI83rfkM/0lmBes6Zl1zF+n3PE9645G79d7GiFYQ+ibR8PNmxxRLlGb6FFsHX60SmMgxgzlk2pnKphX1j6LQgaouuYjeYl5yY9B4jrNGOxSa3Sh0B2XMbTru7jporQghUmullTLz0aq1oRAMHdkvf8gU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none 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=ac+vlo2M; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1709541821; 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: in-reply-to:in-reply-to:references:references; bh=Ol9Zm5BaokJG1LA5SA9PnxgRsE5CFPeI5pD0RB5to08=; b=ac+vlo2MKfzoe/Q7ZnTtAUGADSrT54eIhC9T8NXDajgCRiWXsg3P+81kJKqY1dyj2T9h95 8If2klLgayNW3SMgj7KzL4sZ4mZGDGQeklY8QxUw8igfYD7UCrW0wZtibL1RuMIoP6q1SW fZujmyYctpGHfazIVRm2cuxstG6cwo0= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-138-Lx9SgLAkNySWxjizXIlCoQ-1; Mon, 04 Mar 2024 03:43:37 -0500 X-MC-Unique: Lx9SgLAkNySWxjizXIlCoQ-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.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 mimecast-mx02.redhat.com (Postfix) with ESMTPS id E1BC78489A0; Mon, 4 Mar 2024 08:43:36 +0000 (UTC) Received: from warthog.procyon.org.com (unknown [10.42.28.114]) by smtp.corp.redhat.com (Postfix) with ESMTP id C271120229A4; Mon, 4 Mar 2024 08:43:35 +0000 (UTC) From: David Howells To: netdev@vger.kernel.org Cc: David Howells , Marc Dionne , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , linux-afs@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH net-next v2 06/21] rxrpc: Remove atomic handling on some fields only used in I/O thread Date: Mon, 4 Mar 2024 08:43:03 +0000 Message-ID: <20240304084322.705539-7-dhowells@redhat.com> In-Reply-To: <20240304084322.705539-1-dhowells@redhat.com> References: <20240304084322.705539-1-dhowells@redhat.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.4 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1792584689880361577 X-GMAIL-MSGID: 1792584689880361577 call->tx_transmitted and call->acks_prev_seq don't need to be managed with cmpxchg() and barriers as it's only used within the singular I/O thread. Signed-off-by: David Howells cc: Marc Dionne cc: "David S. Miller" cc: Eric Dumazet cc: Jakub Kicinski cc: Paolo Abeni cc: linux-afs@lists.infradead.org cc: netdev@vger.kernel.org --- net/rxrpc/call_event.c | 10 ++++------ net/rxrpc/output.c | 8 +++----- 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/net/rxrpc/call_event.c b/net/rxrpc/call_event.c index 84eedbb49fcb..1184518dcdb8 100644 --- a/net/rxrpc/call_event.c +++ b/net/rxrpc/call_event.c @@ -115,7 +115,7 @@ void rxrpc_resend(struct rxrpc_call *call, struct sk_buff *ack_skb) struct rxrpc_skb_priv *sp; struct rxrpc_txbuf *txb; unsigned long resend_at; - rxrpc_seq_t transmitted = READ_ONCE(call->tx_transmitted); + rxrpc_seq_t transmitted = call->tx_transmitted; ktime_t now, max_age, oldest, ack_ts; bool unacked = false; unsigned int i; @@ -184,16 +184,14 @@ void rxrpc_resend(struct rxrpc_call *call, struct sk_buff *ack_skb) * seen. Anything between the soft-ACK table and that point will get * ACK'd or NACK'd in due course, so don't worry about it here; here we * need to consider retransmitting anything beyond that point. - * - * Note that ACK for a packet can beat the update of tx_transmitted. */ - if (after_eq(READ_ONCE(call->acks_prev_seq), READ_ONCE(call->tx_transmitted))) + if (after_eq(call->acks_prev_seq, call->tx_transmitted)) goto no_further_resend; list_for_each_entry_from(txb, &call->tx_buffer, call_link) { - if (before_eq(txb->seq, READ_ONCE(call->acks_prev_seq))) + if (before_eq(txb->seq, call->acks_prev_seq)) continue; - if (after(txb->seq, READ_ONCE(call->tx_transmitted))) + if (after(txb->seq, call->tx_transmitted)) break; /* Not transmitted yet */ if (ack && ack->reason == RXRPC_ACK_PING_RESPONSE && diff --git a/net/rxrpc/output.c b/net/rxrpc/output.c index 2386b01b2231..1e039b6f4494 100644 --- a/net/rxrpc/output.c +++ b/net/rxrpc/output.c @@ -397,12 +397,10 @@ int rxrpc_send_data_packet(struct rxrpc_call *call, struct rxrpc_txbuf *txb) /* Track what we've attempted to transmit at least once so that the * retransmission algorithm doesn't try to resend what we haven't sent - * yet. However, this can race as we can receive an ACK before we get - * to this point. But, OTOH, if we won't get an ACK mentioning this - * packet unless the far side received it (though it could have - * discarded it anyway and NAK'd it). + * yet. */ - cmpxchg(&call->tx_transmitted, txb->seq - 1, txb->seq); + if (txb->seq == call->tx_transmitted + 1) + call->tx_transmitted = txb->seq; /* send the packet with the don't fragment bit set if we currently * think it's small enough */