From patchwork Mon Jul 25 08:13:23 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arseniy Krasnov X-Patchwork-Id: 12927857 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 3C9FCC433EF for ; Mon, 25 Jul 2022 08:13:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233825AbiGYIN4 (ORCPT ); Mon, 25 Jul 2022 04:13:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34208 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233764AbiGYINw (ORCPT ); Mon, 25 Jul 2022 04:13:52 -0400 Received: from mail.sberdevices.ru (mail.sberdevices.ru [45.89.227.171]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A530C13DD2; Mon, 25 Jul 2022 01:13:45 -0700 (PDT) Received: from s-lin-edge02.sberdevices.ru (localhost [127.0.0.1]) by mail.sberdevices.ru (Postfix) with ESMTP id 190835FD0B; Mon, 25 Jul 2022 11:13:44 +0300 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sberdevices.ru; s=mail; t=1658736824; bh=0VolYYzByKFenHk7cNZW+B/GD/dVG5AI5iMaU934WLI=; h=From:To:Subject:Date:Message-ID:Content-Type:MIME-Version; b=pl/k/J4dr5/K2zhWjDqsI3QB4a9FNrML10R9GEmttN+XJjuttiEBF7ZMyhqPbFTP7 T3wvE53MGKHiFk8A8n+VdPOdRT+HH8hkJKz1cJGNxM1xgEZkgA2N18fqkT0lhJJa6R 5ofF5p6KrQxgDMabyrgHjD+AUDQRY4b7kWuw7G9NhObGiXkW/HZ/mnLJEhwZOT1NJA u789hjNHVfSntbLj7RIAOI5RyP5F2psxIpA2HUY5ylq0cPMPdo0WMwC1ytffQH0YVJ Mv/tAicXkZ813BF655eNtgdGCFn9Cq/xBdDWB5PFxZgk3F9f3aWyPhFRQ8GYMsmk3X k3OxeFJPcx5ug== Received: from S-MS-EXCH02.sberdevices.ru (S-MS-EXCH02.sberdevices.ru [172.16.1.5]) by mail.sberdevices.ru (Postfix) with ESMTP; Mon, 25 Jul 2022 11:13:42 +0300 (MSK) From: Arseniy Krasnov To: Stefano Garzarella , "David S. Miller" , "edumazet@google.com" , "Jakub Kicinski" , Paolo Abeni , "kys@microsoft.com" , "haiyangz@microsoft.com" , "sthemmin@microsoft.com" , "wei.liu@kernel.org" , Dexuan Cui , Stefan Hajnoczi , Arseniy Krasnov , Krasnov Arseniy CC: "virtualization@lists.linux-foundation.org" , "linux-kernel@vger.kernel.org" , "linux-hyperv@vger.kernel.org" , "netdev@vger.kernel.org" , "kvm@vger.kernel.org" , kernel Subject: [RFC PATCH v2 9/9] vmci/vsock: check SO_RCVLOWAT before wake up reader Thread-Topic: [RFC PATCH v2 9/9] vmci/vsock: check SO_RCVLOWAT before wake up reader Thread-Index: AQHYn/5oY29w5nBisUCpLo7sMc0FdQ== Date: Mon, 25 Jul 2022 08:13:23 +0000 Message-ID: <664ce269-ba46-926e-9c34-070079a7ae3e@sberdevices.ru> In-Reply-To: <19e25833-5f5c-f9b9-ac0f-1945ea17638d@sberdevices.ru> Accept-Language: en-US, ru-RU Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [172.16.1.12] Content-ID: <1F5A3AF0531B954A9BA3E54B91976C95@sberdevices.ru> MIME-Version: 1.0 X-KSMG-Rule-ID: 4 X-KSMG-Message-Action: clean X-KSMG-AntiSpam-Status: not scanned, disabled by settings X-KSMG-AntiSpam-Interceptor-Info: not scanned X-KSMG-AntiPhishing: not scanned, disabled by settings X-KSMG-AntiVirus: Kaspersky Secure Mail Gateway, version 1.1.2.30, bases: 2022/07/25 03:52:00 #19956163 X-KSMG-AntiVirus-Status: Clean, skipped Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-State: RFC This adds extra condition to wake up data reader: do it only when number of readable bytes >= SO_RCVLOWAT. Otherwise, there is no sense to kick user,because it will wait until SO_RCVLOWAT bytes will be dequeued. Signed-off-by: Arseniy Krasnov --- net/vmw_vsock/vmci_transport_notify.c | 2 +- net/vmw_vsock/vmci_transport_notify_qstate.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/net/vmw_vsock/vmci_transport_notify.c b/net/vmw_vsock/vmci_transport_notify.c index 1684b85b0660..ab42d73ab3da 100644 --- a/net/vmw_vsock/vmci_transport_notify.c +++ b/net/vmw_vsock/vmci_transport_notify.c @@ -307,7 +307,7 @@ vmci_transport_handle_wrote(struct sock *sk, struct vsock_sock *vsk = vsock_sk(sk); PKT_FIELD(vsk, sent_waiting_read) = false; #endif - sk->sk_data_ready(sk); + vsock_data_ready(sk); } static void vmci_transport_notify_pkt_socket_init(struct sock *sk) diff --git a/net/vmw_vsock/vmci_transport_notify_qstate.c b/net/vmw_vsock/vmci_transport_notify_qstate.c index a40407872b53..41dca5fbea5e 100644 --- a/net/vmw_vsock/vmci_transport_notify_qstate.c +++ b/net/vmw_vsock/vmci_transport_notify_qstate.c @@ -84,7 +84,7 @@ vmci_transport_handle_wrote(struct sock *sk, bool bottom_half, struct sockaddr_vm *dst, struct sockaddr_vm *src) { - sk->sk_data_ready(sk); + vsock_data_ready(sk); } static void vsock_block_update_write_window(struct sock *sk) @@ -282,7 +282,7 @@ vmci_transport_notify_pkt_recv_post_dequeue( /* See the comment in * vmci_transport_notify_pkt_send_post_enqueue(). */ - sk->sk_data_ready(sk); + vsock_data_ready(sk); } return err;