From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1761862Ab0J2UJE (ORCPT ); Fri, 29 Oct 2010 16:09:04 -0400 Received: from x35.xmailserver.org ([64.71.152.41]:33533 "EHLO x35.xmailserver.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756869Ab0J2UJC (ORCPT ); Fri, 29 Oct 2010 16:09:02 -0400 X-AuthUser: davidel@xmailserver.org Date: Fri, 29 Oct 2010 13:08:34 -0700 (PDT) From: Davide Libenzi X-X-Sender: davide@davide-lnx1 To: Eric Dumazet cc: Alban Crequy , "David S. Miller" , Stephen Hemminger , Cyrill Gorcunov , Alexey Dobriyan , netdev@vger.kernel.org, Linux Kernel Mailing List , Pauli Nieminen , Rainer Weikusat Subject: Re: [PATCH 0/1] RFC: poll/select performance on datagram sockets In-Reply-To: <1288380431.2680.3.camel@edumazet-laptop> Message-ID: References: <20101029191857.5f789d56@chocolatine.cbg.collabora.co.uk> <1288380431.2680.3.camel@edumazet-laptop> User-Agent: Alpine 2.00 (DEB 1167 2008-08-23) X-GPG-FINGRPRINT: CFAE 5BEE FD36 F65E E640 56FE 0974 BF23 270F 474E X-GPG-PUBLIC_KEY: http://www.xmailserver.org/davidel.asc MIME-Version: 1.0 Content-Type: MULTIPART/MIXED; BOUNDARY="8323329-1085891600-1288382915=:8517" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. --8323329-1085891600-1288382915=:8517 Content-Type: TEXT/PLAIN; charset=UTF-8 Content-Transfer-Encoding: 8BIT On Fri, 29 Oct 2010, Eric Dumazet wrote: > Le vendredi 29 octobre 2010 à 19:18 +0100, Alban Crequy a écrit : > > Hi, > > > > When a process calls the poll or select, the kernel calls (struct > > file_operations)->poll on every file descriptor and returns a mask of > > events which are ready. If the process is only interested by POLLIN > > events, the mask is still computed for POLLOUT and it can be expensive. > > For example, on Unix datagram sockets, a process running poll() with > > POLLIN will wakes-up when the remote end call read(). This is a > > performance regression introduced when fixing another bug by > > 3c73419c09a5ef73d56472dbfdade9e311496e9b and > > ec0d215f9420564fc8286dcf93d2d068bb53a07e. > > > > The attached program illustrates the problem. It compares the > > performance of sending/receiving data on an Unix datagram socket and > > select(). When the datagram sockets are not connected, the performance > > problem is not triggered, but when they are connected it becomes a lot > > slower. On my computer, I have the following time: > > > > Connected datagram sockets: >4 seconds > > Non-connected datagram sockets: <1 second > > > > The patch attached in the next email fixes the performance problem: it > > becomes <1 second for both cases. I am not suggesting the patch for > > inclusion; I would like to change the prototype of (struct > > file_operations)->poll instead of adding ->poll2. But there is a lot of > > poll functions to change (grep tells me 337 functions). > > > > Any opinions? > > My opinion would be to use epoll() for this kind of workload. Yeah, epoll does check for event hints coming with the callback wakeup, and avoid waking up epoll_wait() waiters, for non matching events. Most of the devices we care about, have been modified to report the event mask with the wakeup call. - Davide --8323329-1085891600-1288382915=:8517--