Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp5815989ybc; Wed, 27 Nov 2019 09:51:54 -0800 (PST) X-Google-Smtp-Source: APXvYqy3hS5nV/k3WKPk0r6cee4pIHzzkZurEn+IAMa9w15aJjGG93aPadrhYCMo7Klm501oO7Ht X-Received: by 2002:a05:6402:2042:: with SMTP id bc2mr33441030edb.167.1574877114792; Wed, 27 Nov 2019 09:51:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574877114; cv=none; d=google.com; s=arc-20160816; b=eCacYHK8y1sgChPq9NFvSCIUXTqkrc2eRAs+Dj799pp+HguvAWkEEcpkGU/zl5Y1MJ 0ZFqET07s+KicCewecnptPQZ1AUnYzOURqDgvAbbtW1rfhyqwdMexrlq8TvkPK2l/Wp6 dZ8fXhw4oHa37erNBgZZerj2QfJ+UtgmX2utgB1s8rf/gilYXEBkDf+B+lGjxl4hMrM1 6sYNQbcobEmIEJ59GHHnPxPpH0xLuoueOKWbEMNRHbhCxd1lbFTyLwuT9MnRTg6NWwor 8y4mVj37qJsgeCicH0q0kl2uxlORLH0xVhYh6hQ8DdUMCJyluAcdxJuS+8I0E+0AA//8 c96g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:date:cc:to:from:subject :message-id:dkim-signature; bh=+MB6N9uP3ORAGIaepwpg/1bmdyKasKWZBIfVHjugW8k=; b=HTVpylyoir0OZJNm5cBIaYuo9cNeQJjtMlFAw7xXU0PtiO48chP+LzOdiAI6ti00Dx J/jR8+Ybtv9N/DD8TDOiQUuIE3F88/PIkJZ3rJNFRTarKKoDGk2+v9ONH2tG3DMo8cVj sE1y9ZGgNB/t9bDiskuXKMzgCJXTLigWviWpprHIINJLdBWcU9lo2tM5El3hP1VsCviS nrfYQ1bx8GeXr2CLALibCf3waVfHtbsQzita/9wRR+qjYXqKyrsV/e9zlxF7bVBvRpXw 7rjn4lcDYRMXeEubd9wogJ/Y5DF76qYLMt8AHNZQHIW2vUwu4hudFWK7dnPaUUkje3aq qfug== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=I2JndIzL; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c5si9705076ejr.128.2019.11.27.09.51.30; Wed, 27 Nov 2019 09:51:54 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=I2JndIzL; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727092AbfK0RuS (ORCPT + 99 others); Wed, 27 Nov 2019 12:50:18 -0500 Received: from us-smtp-1.mimecast.com ([205.139.110.61]:42192 "EHLO us-smtp-delivery-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726984AbfK0RuS (ORCPT ); Wed, 27 Nov 2019 12:50:18 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1574877017; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=+MB6N9uP3ORAGIaepwpg/1bmdyKasKWZBIfVHjugW8k=; b=I2JndIzL5W8rKGE+au/M4Hw07CSzq5+ZCGdCalYKbyQ3LwmAkeXHW5WCdi+VxDvxK3sFhm rtFYTBRVmFoLfyQyPeKUbZFCIuARyxh37rtNIz8CzyFRUFSo4wVcDg3G1PxoJnmfOKbWnl oxWedz40OXSZiuYnVNvJsk16kdMERyU= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-138-WxIffqC8PO-3iffa3IjJpw-1; Wed, 27 Nov 2019 12:50:13 -0500 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 89C75800D5A; Wed, 27 Nov 2019 17:50:12 +0000 (UTC) Received: from ovpn-118-152.ams2.redhat.com (unknown [10.36.118.152]) by smtp.corp.redhat.com (Postfix) with ESMTP id 755345C28D; Wed, 27 Nov 2019 17:50:03 +0000 (UTC) Message-ID: <26e9b84bef24d46da9504aae2ca444d0d258c621.camel@redhat.com> Subject: Re: epoll_wait() performance From: Paolo Abeni To: David Laight , Jesper Dangaard Brouer Cc: 'Marek Majkowski' , linux-kernel , network dev , kernel-team Date: Wed, 27 Nov 2019 18:50:02 +0100 In-Reply-To: <2f1635d9300a4bec8a0422e9e9518751@AcuMS.aculab.com> References: <5f4028c48a1a4673bd3b38728e8ade07@AcuMS.aculab.com> <20191127164821.1c41deff@carbon> <0b8d7447e129539aec559fa797c07047f5a6a1b2.camel@redhat.com> <2f1635d9300a4bec8a0422e9e9518751@AcuMS.aculab.com> User-Agent: Evolution 3.32.4 (3.32.4-1.fc30) MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-MC-Unique: WxIffqC8PO-3iffa3IjJpw-1 X-Mimecast-Spam-Score: 0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, Thanks for the additional details. On Wed, 2019-11-27 at 17:30 +0000, David Laight wrote: > From: Paolo Abeni > > Sent: 27 November 2019 16:27 > ... > > @David: If I read your message correctly, the pkt rate you are dealing > > with is quite low... are we talking about tput or latency? I guess > > latency could be measurably higher with recvmmsg() in respect to other > > syscall. How do you measure the releative performances of recvmmsg() > > and recv() ? with micro-benchmark/rdtsc()? Am I right that you are > > usually getting a single packet per recvmmsg() call? > > The packet rate per socket is low, typically one packet every 20ms. > This is RTP, so telephony audio. > However we have a lot of audio channels and hence a lot of sockets. > So there are can be 1000s of sockets we need to receive the data from. > The test system I'm using has 16 E1 TDM links each of which can handle > 31 audio channels. > Forwarding all these to/from RTP (one of the things it might do) is 496 > audio channels - so 496 RTP sockets and 496 RTCP ones. > Although the test I'm doing is pure RTP and doesn't use TDM. Oks, I think this is not exactly the preferred recvmmsg() use case ;) > What I'm measuring is the total time taken to receive all the packets > (on all the sockets) that are available to be read every 10ms. > So poll + recv + add_to_queue. > (The data processing is done by other threads.) > I use the time difference (actually CLOCK_MONOTONIC - from rdtsc) > to generate a 64 entry (self scaling) histogram of the elapsed times. > Then look for the histograms peak value. > (I need to work on the max value, but that is a different (more important!) problem.) > Depending on the poll/recv method used this takes 1.5 to 2ms > in each 10ms period. > (It is faster if I run the cpu at full speed, but it usually idles along > at 800MHz.) > > If I use recvmmsg() I only expect to see one packet because there > is (almost always) only one packet on each socket every 20ms. > However there might be more than one, and if there is they > all need to be read (well at least 2 of them) in that block of receives. I would wild guess that recvmmsg() would be faster than 2 recv() when there are exactly 2 pkts to read and the user-space provides exactly 2 msg entries, but likely non very relevant for the overall scenario. Sorry, I don't have any good suggestion here. Cheers, Paolo