From nobody Fri May 17 06:43:23 2024 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 37A70C05027 for ; Wed, 8 Feb 2023 10:29:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231449AbjBHK3H (ORCPT ); Wed, 8 Feb 2023 05:29:07 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37578 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231322AbjBHK2r (ORCPT ); Wed, 8 Feb 2023 05:28:47 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 093C246726 for ; Wed, 8 Feb 2023 02:27:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1675852079; 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=+0bdW2lu7gvPActE9FfmWhTe4s3T0qdSQp6cZIX9NGg=; b=VuLI0VxCQNd1W6zSY9dbE6CGiF4CgHcisgFdNToUNPKFwImM70jixfAkNdYNSwu1sSFStT H88EBPcdqT1dNPUJYpXj83Z4d6K4fPshH5iZ4eduejASLOWK2ure3Rtn8eWe57wUVFODIQ uXkmRucJ9GPe0hZZ0XKmfTUxkeoriY4= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-184-gxQTpNX-MGWQGk9aSn4jHg-1; Wed, 08 Feb 2023 05:27:56 -0500 X-MC-Unique: gxQTpNX-MGWQGk9aSn4jHg-1 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 90659800B23; Wed, 8 Feb 2023 10:27:55 +0000 (UTC) Received: from warthog.procyon.org.uk (unknown [10.33.36.24]) by smtp.corp.redhat.com (Postfix) with ESMTP id 769EB492C3F; Wed, 8 Feb 2023 10:27:54 +0000 (UTC) From: David Howells To: netdev@vger.kernel.org Cc: David Howells , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Marc Dionne , linux-afs@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH net-next 1/4] rxrpc: Use consume_skb() rather than kfree_skb_reason() Date: Wed, 8 Feb 2023 10:27:47 +0000 Message-Id: <20230208102750.18107-2-dhowells@redhat.com> In-Reply-To: <20230208102750.18107-1-dhowells@redhat.com> References: <20230208102750.18107-1-dhowells@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.9 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Use consume_skb() rather than kfree_skb_reason(). Reported-by: Paolo Abeni Signed-off-by: David Howells cc: Marc Dionne cc: linux-afs@lists.infradead.org --- net/rxrpc/skbuff.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/net/rxrpc/skbuff.c b/net/rxrpc/skbuff.c index 944320e65ea8..3bcd6ee80396 100644 --- a/net/rxrpc/skbuff.c +++ b/net/rxrpc/skbuff.c @@ -63,7 +63,7 @@ void rxrpc_free_skb(struct sk_buff *skb, enum rxrpc_skb_t= race why) if (skb) { int n =3D atomic_dec_return(select_skb_count(skb)); trace_rxrpc_skb(skb, refcount_read(&skb->users), n, why); - kfree_skb_reason(skb, SKB_CONSUMED); + consume_skb(skb); } } =20 @@ -78,6 +78,6 @@ void rxrpc_purge_queue(struct sk_buff_head *list) int n =3D atomic_dec_return(select_skb_count(skb)); trace_rxrpc_skb(skb, refcount_read(&skb->users), n, rxrpc_skb_put_purge); - kfree_skb_reason(skb, SKB_CONSUMED); + consume_skb(skb); } } From nobody Fri May 17 06:43:23 2024 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4BEE1C05027 for ; Wed, 8 Feb 2023 10:29:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231474AbjBHK3L (ORCPT ); Wed, 8 Feb 2023 05:29:11 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37594 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231341AbjBHK2v (ORCPT ); Wed, 8 Feb 2023 05:28:51 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 329454671F for ; Wed, 8 Feb 2023 02:28:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1675852081; 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=8H/UOjisVXBilIHmQJZBTMReWmL632uxgSQLNraANrg=; b=NrZCAawdgBxoweLqgfjjsWg5tWodAX8dzt06uVrswMEi4mt2ZIChyqLEaP+9bD3EGJwpnz Ql7712Fu5vsgNTDjcqIkM42+UgC+meNP94aXENnA7lXTM/SDWtgPFV+6GtRGIy6dV86mZg lRUO/ZmY9MRgu5GORwPQA1BIsDtjqC8= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-331-89VE2ZaEMQWKDxwI5X3Y8Q-1; Wed, 08 Feb 2023 05:27:57 -0500 X-MC-Unique: 89VE2ZaEMQWKDxwI5X3Y8Q-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 4D97085A588; Wed, 8 Feb 2023 10:27:57 +0000 (UTC) Received: from warthog.procyon.org.uk (unknown [10.33.36.24]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2D21B2026D4B; Wed, 8 Feb 2023 10:27:56 +0000 (UTC) From: David Howells To: netdev@vger.kernel.org Cc: David Howells , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Marc Dionne , linux-afs@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH net-next 2/4] rxrpc: Fix overwaking on call poking Date: Wed, 8 Feb 2023 10:27:48 +0000 Message-Id: <20230208102750.18107-3-dhowells@redhat.com> In-Reply-To: <20230208102750.18107-1-dhowells@redhat.com> References: <20230208102750.18107-1-dhowells@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.4 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" If an rxrpc call is given a poke, it will get woken up unconditionally, even if there's already a poke pending (for which there will have been a wake) or if the call refcount has gone to 0. Fix this by only waking the call if it is still referenced and if it doesn't already have a poke pending. Fixes: 15f661dc95da ("rxrpc: Implement a mechanism to send an event notific= ation to a call") Signed-off-by: David Howells cc: Marc Dionne cc: linux-afs@lists.infradead.org --- net/rxrpc/call_object.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/net/rxrpc/call_object.c b/net/rxrpc/call_object.c index 6eaffb0d8fdc..e9f1f49d18c2 100644 --- a/net/rxrpc/call_object.c +++ b/net/rxrpc/call_object.c @@ -54,12 +54,14 @@ void rxrpc_poke_call(struct rxrpc_call *call, enum rxrp= c_call_poke_trace what) spin_lock_bh(&local->lock); busy =3D !list_empty(&call->attend_link); trace_rxrpc_poke_call(call, busy, what); + if (!busy && !rxrpc_try_get_call(call, rxrpc_call_get_poke)) + busy =3D true; if (!busy) { - rxrpc_get_call(call, rxrpc_call_get_poke); list_add_tail(&call->attend_link, &local->call_attend_q); } spin_unlock_bh(&local->lock); - rxrpc_wake_up_io_thread(local); + if (!busy) + rxrpc_wake_up_io_thread(local); } } From nobody Fri May 17 06:43:23 2024 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 81B32C636CC for ; Wed, 8 Feb 2023 10:29:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231403AbjBHK3l (ORCPT ); Wed, 8 Feb 2023 05:29:41 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37646 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231190AbjBHK2z (ORCPT ); Wed, 8 Feb 2023 05:28:55 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 271DB46738 for ; Wed, 8 Feb 2023 02:28:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1675852083; 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=5w/Gjj7DW5ecxl8zA3551kkbDeon6m1PThZoUo8b6x8=; b=VBBkpO3Dq5kcMp9/0BOZ8OnCAgO17m3CNknXhz0XrFC/kNn+2HLD+9xjQdvPPgQRj+0jnJ /IbnoPaVW30pWokmu4EkogWux4R4nUMkay/dOsUHU93x510xZz8EO+k0yQGSn4/zJWuZwV 7POxWZAYNvVHHV+Uc5c7Zs7RFeeRJLM= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-615-Ppae9fkXOSCdYx20j-_rMQ-1; Wed, 08 Feb 2023 05:27:59 -0500 X-MC-Unique: Ppae9fkXOSCdYx20j-_rMQ-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 23DB9101A521; Wed, 8 Feb 2023 10:27:59 +0000 (UTC) Received: from warthog.procyon.org.uk (unknown [10.33.36.24]) by smtp.corp.redhat.com (Postfix) with ESMTP id 08F4E140EBF4; Wed, 8 Feb 2023 10:27:57 +0000 (UTC) From: David Howells To: netdev@vger.kernel.org Cc: David Howells , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Marc Dionne , linux-afs@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH net-next 3/4] rxrpc: Trace ack.rwind Date: Wed, 8 Feb 2023 10:27:49 +0000 Message-Id: <20230208102750.18107-4-dhowells@redhat.com> In-Reply-To: <20230208102750.18107-1-dhowells@redhat.com> References: <20230208102750.18107-1-dhowells@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.7 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Log ack.rwind in the rxrpc_tx_ack tracepoint. This value is useful to see as it represents flow-control information to the peer. Signed-off-by: David Howells cc: Marc Dionne cc: linux-afs@lists.infradead.org --- include/trace/events/rxrpc.h | 11 +++++++---- net/rxrpc/conn_event.c | 2 +- net/rxrpc/output.c | 10 +++++++--- 3 files changed, 15 insertions(+), 8 deletions(-) diff --git a/include/trace/events/rxrpc.h b/include/trace/events/rxrpc.h index d7bb4acf4580..c3c0b0aa8381 100644 --- a/include/trace/events/rxrpc.h +++ b/include/trace/events/rxrpc.h @@ -1118,9 +1118,9 @@ TRACE_EVENT(rxrpc_tx_data, TRACE_EVENT(rxrpc_tx_ack, TP_PROTO(unsigned int call, rxrpc_serial_t serial, rxrpc_seq_t ack_first, rxrpc_serial_t ack_serial, - u8 reason, u8 n_acks), + u8 reason, u8 n_acks, u16 rwind), =20 - TP_ARGS(call, serial, ack_first, ack_serial, reason, n_acks), + TP_ARGS(call, serial, ack_first, ack_serial, reason, n_acks, rwind), =20 TP_STRUCT__entry( __field(unsigned int, call) @@ -1129,6 +1129,7 @@ TRACE_EVENT(rxrpc_tx_ack, __field(rxrpc_serial_t, ack_serial) __field(u8, reason) __field(u8, n_acks) + __field(u16, rwind) ), =20 TP_fast_assign( @@ -1138,15 +1139,17 @@ TRACE_EVENT(rxrpc_tx_ack, __entry->ack_serial =3D ack_serial; __entry->reason =3D reason; __entry->n_acks =3D n_acks; + __entry->rwind =3D rwind; ), =20 - TP_printk(" c=3D%08x ACK %08x %s f=3D%08x r=3D%08x n=3D%u", + TP_printk(" c=3D%08x ACK %08x %s f=3D%08x r=3D%08x n=3D%u rw=3D%u", __entry->call, __entry->serial, __print_symbolic(__entry->reason, rxrpc_ack_names), __entry->ack_first, __entry->ack_serial, - __entry->n_acks) + __entry->n_acks, + __entry->rwind) ); =20 TRACE_EVENT(rxrpc_receive, diff --git a/net/rxrpc/conn_event.c b/net/rxrpc/conn_event.c index 44414e724415..95f4bc206b3d 100644 --- a/net/rxrpc/conn_event.c +++ b/net/rxrpc/conn_event.c @@ -163,7 +163,7 @@ void rxrpc_conn_retransmit_call(struct rxrpc_connection= *conn, trace_rxrpc_tx_ack(chan->call_debug_id, serial, ntohl(pkt.ack.firstPacket), ntohl(pkt.ack.serial), - pkt.ack.reason, 0); + pkt.ack.reason, 0, rxrpc_rx_window_size); break; =20 default: diff --git a/net/rxrpc/output.c b/net/rxrpc/output.c index 6b2022240076..5e53429c6922 100644 --- a/net/rxrpc/output.c +++ b/net/rxrpc/output.c @@ -80,7 +80,8 @@ static void rxrpc_set_keepalive(struct rxrpc_call *call) */ static size_t rxrpc_fill_out_ack(struct rxrpc_connection *conn, struct rxrpc_call *call, - struct rxrpc_txbuf *txb) + struct rxrpc_txbuf *txb, + u16 *_rwind) { struct rxrpc_ackinfo ackinfo; unsigned int qsize, sack, wrap, to; @@ -124,6 +125,7 @@ static size_t rxrpc_fill_out_ack(struct rxrpc_connectio= n *conn, jmax =3D rxrpc_rx_jumbo_max; qsize =3D (window - 1) - call->rx_consumed; rsize =3D max_t(int, call->rx_winsize - qsize, 0); + *_rwind =3D rsize; ackinfo.rxMTU =3D htonl(rxrpc_rx_mtu); ackinfo.maxMTU =3D htonl(mtu); ackinfo.rwind =3D htonl(rsize); @@ -190,6 +192,7 @@ int rxrpc_send_ack_packet(struct rxrpc_call *call, stru= ct rxrpc_txbuf *txb) rxrpc_serial_t serial; size_t len, n; int ret, rtt_slot =3D -1; + u16 rwind; =20 if (test_bit(RXRPC_CALL_DISCONNECTED, &call->flags)) return -ECONNRESET; @@ -205,7 +208,7 @@ int rxrpc_send_ack_packet(struct rxrpc_call *call, stru= ct rxrpc_txbuf *txb) if (txb->ack.reason =3D=3D RXRPC_ACK_PING) txb->wire.flags |=3D RXRPC_REQUEST_ACK; =20 - n =3D rxrpc_fill_out_ack(conn, call, txb); + n =3D rxrpc_fill_out_ack(conn, call, txb, &rwind); if (n =3D=3D 0) return 0; =20 @@ -217,7 +220,8 @@ int rxrpc_send_ack_packet(struct rxrpc_call *call, stru= ct rxrpc_txbuf *txb) txb->wire.serial =3D htonl(serial); trace_rxrpc_tx_ack(call->debug_id, serial, ntohl(txb->ack.firstPacket), - ntohl(txb->ack.serial), txb->ack.reason, txb->ack.nAcks); + ntohl(txb->ack.serial), txb->ack.reason, txb->ack.nAcks, + rwind); =20 if (txb->ack.reason =3D=3D RXRPC_ACK_PING) rtt_slot =3D rxrpc_begin_rtt_probe(call, serial, rxrpc_rtt_tx_ping); From nobody Fri May 17 06:43:23 2024 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C1469C636CC for ; Wed, 8 Feb 2023 10:29:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231477AbjBHK3R (ORCPT ); Wed, 8 Feb 2023 05:29:17 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37638 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230203AbjBHK2w (ORCPT ); Wed, 8 Feb 2023 05:28:52 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 67A0B4672A for ; Wed, 8 Feb 2023 02:28:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1675852082; 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=AIbGFXSEGrcouEuIniWxwMqD+I+3i7zmAP6fRARvEuo=; b=eZ89A7DBEH3V/4ue2J/8UWZfrBsfAX5tAEkVdpTxpUfxim6AHPS8dOwvgGU93kxXFjcVKQ fitwXOX7TFKr+njnXy5gTG0KDkJ4Sfxvbh+Vz1+oP5cvEbaJgBrQdEEPuSoaQQIfbFmkJI MAT4EuaxJ2aknCOEpRhJ1Qt0p4Ltrj8= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-670-_iwab9PJNXWBQVklYDQKwA-1; Wed, 08 Feb 2023 05:28:01 -0500 X-MC-Unique: _iwab9PJNXWBQVklYDQKwA-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id D773D8030D0; Wed, 8 Feb 2023 10:28:00 +0000 (UTC) Received: from warthog.procyon.org.uk (unknown [10.33.36.24]) by smtp.corp.redhat.com (Postfix) with ESMTP id B71542166B2B; Wed, 8 Feb 2023 10:27:59 +0000 (UTC) From: David Howells To: netdev@vger.kernel.org Cc: David Howells , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Marc Dionne , linux-afs@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH net-next 4/4] rxrpc: Reduce unnecessary ack transmission Date: Wed, 8 Feb 2023 10:27:50 +0000 Message-Id: <20230208102750.18107-5-dhowells@redhat.com> In-Reply-To: <20230208102750.18107-1-dhowells@redhat.com> References: <20230208102750.18107-1-dhowells@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" rxrpc_recvmsg_data() schedules an ACK to be transmitted every time at least two packets have been consumed and any time it runs out of data and would return -EAGAIN to the caller. Both events may occur within a single loop, however, and if the I/O thread is quick enough it may send duplicate ACKs. The ACKs are sent to inform the peer that more space has been made in the local Rx window, but the I/O thread is going to send an ACK every couple of DATA packets anyway, so we end up sending a lot more ACKs than we really need to. So reduce the rate at which recvmsg() schedules ACKs, such that if the I/O thread sends ACKs at its normal faster rate, recvmsg() won't actually schedule ACKs until the Rx flow stops (call->rx_consumed is cleared any time we transmit an ACK for that call, resetting the counter used by recvmsg). Signed-off-by: David Howells cc: Marc Dionne cc: linux-afs@lists.infradead.org --- net/rxrpc/recvmsg.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/rxrpc/recvmsg.c b/net/rxrpc/recvmsg.c index 50d263a6359d..76eb2b9cd936 100644 --- a/net/rxrpc/recvmsg.c +++ b/net/rxrpc/recvmsg.c @@ -137,7 +137,7 @@ static void rxrpc_rotate_rx_window(struct rxrpc_call *c= all) /* Check to see if there's an ACK that needs sending. */ acked =3D atomic_add_return(call->rx_consumed - old_consumed, &call->ackr_nr_consumed); - if (acked > 2 && + if (acked > 8 && !test_and_set_bit(RXRPC_CALL_RX_IS_IDLE, &call->flags)) rxrpc_poke_call(call, rxrpc_call_poke_idle); }