Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759986AbbBIUSL (ORCPT ); Mon, 9 Feb 2015 15:18:11 -0500 Received: from mail-pa0-f48.google.com ([209.85.220.48]:39028 "EHLO mail-pa0-f48.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932408AbbBIUSJ (ORCPT ); Mon, 9 Feb 2015 15:18:09 -0500 Message-ID: <54D915FC.7010003@amacapital.net> Date: Mon, 09 Feb 2015 12:18:04 -0800 From: Andy Lutomirski User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.4.0 MIME-Version: 1.0 To: Jason Baron , peterz@infradead.org, mingo@redhat.com, viro@zeniv.linux.org.uk CC: akpm@linux-foundation.org, normalperson@yhbt.net, davidel@xmailserver.org, mtk.manpages@gmail.com, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org Subject: Re: [PATCH 2/2] epoll: introduce EPOLLEXCLUSIVE and EPOLLROUNDROBIN References: <68a0ad4a99551ea3bfff89da461bb490d63b0ca8.1423509605.git.jbaron@akamai.com> In-Reply-To: <68a0ad4a99551ea3bfff89da461bb490d63b0ca8.1423509605.git.jbaron@akamai.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1717 Lines: 36 On 02/09/2015 12:06 PM, Jason Baron wrote: > Epoll file descriptors that are added to a shared wakeup source are always > added in a non-exclusive manner. That means that when we have multiple epoll > fds attached to a shared wakeup source they are all woken up. This can > lead to excessive cpu usage and uneven load distribution. > > This patch introduces two new 'events' flags that are intended to be used > with EPOLL_CTL_ADD operations. EPOLLEXCLUSIVE, adds the epoll fd to the event > source in an exclusive manner such that the minimum number of threads are > woken. EPOLLROUNDROBIN, which depends on EPOLLEXCLUSIVE also being set, can > also be added to the 'events' flag, such that we round robin around the set > of waiting threads. > > An implementation note is that in the epoll wakeup routine, > 'ep_poll_callback()', if EPOLLROUNDROBIN is set, we return 1, for a successful > wakeup, only when there are current waiters. The idea is to use this additional > heuristic in order minimize wakeup latencies. I don't understand what this is intended to do. If an event has EPOLLONESHOT, then this only one thread should be woken regardless, right? If not, isn't that just a bug that should be fixed? If an event has EPOLLET, then the considerations are similar to EPOLLONESHOT, right? If an event is a normal level-triggered non-one-shot event, then I don't understand how a round-robin wakeup makes any sense. It's level-triggered, after all. --Andy -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/