From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.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 2947435CBB7 for ; Mon, 12 Jan 2026 14:08:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768226902; cv=none; b=kmN0n5+qpadFF67tQ1toCnAOxmrsmPPHOCGQgJhJ2htHgg5m89l+pDqIg4/y8ixpBmUpNIf6htzEtI1N52pIT74cBjrS3Cak24Cg4odKpFFqb0F803pLFACAzN/wszpoXC80umTgdupm+tnenyE3qyC05ttUsHHs7sa25QJ0W7w= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768226902; c=relaxed/simple; bh=GKvx/1ooBKBcUVjPLmQrzQL3r3xI5Pp++pamyt5l+xI=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=dx0n+VW5zDLoyb/DQxr2xSkyoW9VM2Ep/HEbgI6hcbug9qW87DJ9yuOfHGpESnt9eu5RDlB/YylBVS/2rU3EXHooeL+zp+Mq1ItA/4PytTLXLcxay5GhLdA/OR662QwlVGYB8yrq0hvAOJ5wvGiaqQYSXV9ZcqWC9uVutLr53bU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine 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=WeX9gRCw; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b=BwJFCwfJ; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="WeX9gRCw"; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b="BwJFCwfJ" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1768226900; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=d5E7sq9k7DMQGsacG+F/JxI7pmnfHnE90xymu2cg9dU=; b=WeX9gRCwd03Nt8CLNS2ZNMrWgQwQnXc2K5E1nojJIYUzWkG4l5vheJpgl26jpv3zUrY2oH 55l7yl/nNcEQZgcW6rz+6xZoXYas+sXhD2MFfSa12kZcd+dtT7sJF3nxTlAyyfxzQ2Jg0o 0XOA/gVBIx5ELEi5kgPhDG+woocd9b4= Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-113-LPnGQX32OAOLjV_9f8RHQw-1; Mon, 12 Jan 2026 09:08:10 -0500 X-MC-Unique: LPnGQX32OAOLjV_9f8RHQw-1 X-Mimecast-MFC-AGG-ID: LPnGQX32OAOLjV_9f8RHQw_1768226889 Received: by mail-wm1-f72.google.com with SMTP id 5b1f17b1804b1-47788165c97so36140055e9.0 for ; Mon, 12 Jan 2026 06:08:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1768226889; x=1768831689; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=d5E7sq9k7DMQGsacG+F/JxI7pmnfHnE90xymu2cg9dU=; b=BwJFCwfJem6coQD1TwibLTPyES5aolTKDn7+uDR48U2UVSCv0cmH9BTgK8lDLW1PCn gWgQx2kNe2daPhqRggid1DK5a52exJJ//p0cUVLU40lzJIzmMh222GwcptcXSkraLNx/ YvQpXfcrGEeR5f5MFXKYWA6Qomh65uluDBTjWY3gRXJ8FAJA6zaxOrblgXPBUNPbjrAL pgWWRxpGkccJAxzVEjoWeAaK0krDY8bDPRmvk2sqzd0ophMSAJGVCK7i7UtPihOVJA9t 3bgpn91/5q19NhrXDi++vUZCJ+DgQRHiIE9kClFte+I3jkXd0KX+EYXqCKZhol59riyW ZmWg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1768226889; x=1768831689; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-gg:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=d5E7sq9k7DMQGsacG+F/JxI7pmnfHnE90xymu2cg9dU=; b=l+LscrK0QxVKYtq409JFrgbFwaqnh2RuXM00fzI7yyCfvucApuj05Q8uJh+7xeaBin lyBhcfxVke4Js22xJ1TDYC8QBXraPg8scJoX1iCcCJz9abc9Am7sH/gVL47Esowa6fw0 d0yKznfWVN2+BrLtir79oAouWqipNZyNDVz2AHkCRgAt/wLHpdKB6Kw6H31gVwa79d/y b6Qd+nSpvTiisajEGetJocG3AMBXRSZk/uKfMgiF2c9d907MdA8C7dFjw0JY/yfJa9fj gV38XY8ZLlshHJkI5nplfY4k7muo88IVCxQzcF/cgiZMm2CAkgCklWvthp1eQXJc8Z/t hvrQ== X-Forwarded-Encrypted: i=1; AJvYcCX1alZMVjoYkc075/I458dQZGInMdXyeM2DnZtGRitX+KUOQRUd8e6LAKjwqGMJrA/cBNEsqhNZ3Gkn6RY=@vger.kernel.org X-Gm-Message-State: AOJu0Yy+7ensFpJXS6PppWwFdPvwGlnmT0M/BRdi4tlftY5dKeklxvPF so0t67ZEgUJYWwuUdR+u7dlgf0NoXA8D38qa7x/KCD4zjDluLuwiXcUMh2MkgTJQ29V5KvLSPui D3xCOPSrrVUOH7Z85j7hA6BpvGqBHxd6P+lZS7ayHxyDZHR5O0GZ7cfRKsJU5LjCgU7UUaRwcQw == X-Gm-Gg: AY/fxX5JadVBy3VxSSpyVahK/xYGeFYvAltOtRN/2YcLZ55/p3G5/tOEex8rG30/2bE P1yP81ONhU2Mj09fAH2JIGx2QqjEnTgnCxYzEApG2+bgXAEHWA3H0WpEpsAJlE7KfRJ110xHE2A NwOF83TwAG86EsZCvE0vVANToCx+anTJTH8O2nA4QNMSPr13mXIkk7ngZRacCXiB8azWUG+iLNW WelB5hYNw0sjSCB6/u+XfI7C9RGv2Ism7/IiHH1XHcD5zhlC73+4Yttl/2cAP5Wej998HL1IFf/ OvzywQhXnk2AfC07DlxcRfxARFr3SpQN1VG6x5hPTHH+lGtvOtskxKLWl5ESxLtfFNafxIkhX9A 4wjHKx/gy6FQPOX/PSs+IbWX3Flqd0UEW7fZs4ETzSrUXG/taU2qrYmwULbBiOw== X-Received: by 2002:a05:600c:a10a:b0:47d:92bb:2723 with SMTP id 5b1f17b1804b1-47d92bb28a9mr88376255e9.3.1768226888775; Mon, 12 Jan 2026 06:08:08 -0800 (PST) X-Google-Smtp-Source: AGHT+IFSA8MeLEwBc5V/8h9ZTRtoroYd4ri8KOUDoLboqzGTL/mHH9z1of/NksaN4ZE17gxAdWjfFQ== X-Received: by 2002:a05:600c:a10a:b0:47d:92bb:2723 with SMTP id 5b1f17b1804b1-47d92bb28a9mr88375885e9.3.1768226888223; Mon, 12 Jan 2026 06:08:08 -0800 (PST) Received: from sgarzare-redhat (host-87-12-25-233.business.telecomitalia.it. [87.12.25.233]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-432bd0dacd1sm38203341f8f.4.2026.01.12.06.08.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Jan 2026 06:08:07 -0800 (PST) Date: Mon, 12 Jan 2026 15:07:58 +0100 From: Stefano Garzarella To: Michal Luczaj Cc: "Michael S. Tsirkin" , Jason Wang , Xuan Zhuo , Eugenio =?utf-8?B?UMOpcmV6?= , Stefan Hajnoczi , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Simon Horman , Arseniy Krasnov , kvm@vger.kernel.org, virtualization@lists.linux.dev, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 1/2] vsock/virtio: Coalesce only linear skb Message-ID: References: <20260108-vsock-recv-coalescence-v1-0-26f97bb9a99b@rbox.co> <20260108-vsock-recv-coalescence-v1-1-26f97bb9a99b@rbox.co> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: On Sun, Jan 11, 2026 at 11:59:44AM +0100, Michal Luczaj wrote: >On 1/9/26 17:18, Stefano Garzarella wrote: >> On Thu, Jan 08, 2026 at 10:54:54AM +0100, Michal Luczaj wrote: >... >>> @@ -1375,7 +1375,8 @@ virtio_transport_recv_enqueue(struct vsock_sock *vsk, >>> * of a new message. >>> */ >>> if (skb->len < skb_tailroom(last_skb) && >>> - !(le32_to_cpu(last_hdr->flags) & VIRTIO_VSOCK_SEQ_EOM)) { >>> + !(le32_to_cpu(last_hdr->flags) & VIRTIO_VSOCK_SEQ_EOM) && >>> + !skb_is_nonlinear(skb)) { >> >> Why here? I mean we can do the check even early, something like this: >> >> --- a/net/vmw_vsock/virtio_transport_common.c >> +++ b/net/vmw_vsock/virtio_transport_common.c >> @@ -1361,7 +1361,8 @@ virtio_transport_recv_enqueue(struct vsock_sock *vsk, >> * to avoid wasting memory queueing the entire buffer with a small >> * payload. >> */ >> - if (len <= GOOD_COPY_LEN && !skb_queue_empty(&vvs->rx_queue)) { >> + if (len <= GOOD_COPY_LEN && !skb_queue_empty(&vvs->rx_queue) && >> + !skb_is_nonlinear(skb)) { >> struct virtio_vsock_hdr *last_hdr; >> struct sk_buff *last_skb; > >Right, can do. I've assumed skb being non-linear is the least likely in >this context. Yeah, but it's a very simple check, so IMHO the code is more readable if we put it in the first conditions, where we check if the current packet has the requisites, rather than in the nested conditions, where we check that the packet already queued can receive the new payload. > >> I would also add the reason in the comment before that to make it clear. > >OK, sure. > Thanks, Stefano