public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Madars Vitolins <m@silodev.com>
To: <linux-kernel@vger.kernel.org>
Subject: epoll and multiple processes - eliminate unneeded process wake-ups
Date: Mon, 13 Jul 2015 15:34:12 +0300	[thread overview]
Message-ID: <fa3a5e68bef72dbc03ed7d4f036205a2@silodev.com> (raw)

Hi Folks,

I am developing kind of open systems application, which uses multiple 
processes/executables where each of them monitors some set of resources 
(in this case POSIX Queues) via epoll interface. For example when 10 
processes on same queue are in state of epoll_wait() and one message 
arrives, all 10 processes gets woken up and all of them tries to read 
the message from Q. One succeeds, the others gets EAGAIN error. The 
problem is with those others, which generates extra context switches - 
useless CPU usage. With more processes inefficiency gets higher.

I tried to use EPOLLONESHOT, but no help. Seems this is suitable for 
multi-threaded application and not for multi-process application.

Ideal mechanism for this would be:
1. If multiple epoll sets in kernel matches same event and one or more 
processes are in state of epoll_wait() - then send event only to one 
waiter.
2. If none of processes are in wait state, then send the event to all 
epoll sets (as it is currently). Then the first free process will grab 
the event.

How do you think, would it be real to implement this? How about 
concurrency?
Can you please give me some hints from which points in code to start to 
implement these changes?


Thanks a lot in advance,
Madars

             reply	other threads:[~2015-07-13 12:42 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-13 12:34 Madars Vitolins [this message]
2015-07-15 13:07 ` epoll and multiple processes - eliminate unneeded process wake-ups Madars Vitolins
2015-08-03 23:48 ` Eric Wong
2015-08-04 15:02   ` Jason Baron
2015-08-05 11:06     ` Madars Vitolins
2015-08-05 13:32       ` Jason Baron
  -- strict thread matches above, loose matches on Subject: below --
2015-11-28 22:54 Madars Vitolins
2015-11-30 19:45 ` Jason Baron
2015-11-30 21:28   ` Madars Vitolins
2015-12-01 20:11     ` Jason Baron
2015-12-05 11:47       ` Madars Vitolins

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=fa3a5e68bef72dbc03ed7d4f036205a2@silodev.com \
    --to=m@silodev.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox