sleepy_penguin RubyGem user+dev discussion/patches/pulls/bugs/help
 help / color / mirror / code / Atom feed
From: Eric Wong <normalperson@yhbt.net>
To: sleepy.penguin@librelist.org
Subject: [sleepy.penguin] [PATCH 0/6] epoll wrapper cleanups
Date: Thu, 11 Apr 2013 04:17:29 +0000	[thread overview]
Message-ID: <1365653855-1101-1-git-send-email-normalperson@yhbt.net> (raw)
In-Reply-To: <1365653855-1101-1-git-send-email-normalperson@yhbt.net>

I've decided to provide lower-level access to epoll users without the
extra overhead of automatic GC marking and Epoll#set management.

The normal Epoll class is now implemented in Ruby, while the low-level
Epoll::IO class is a lightweight C wrapper.  This should make code
easier to maintain, and folks that really want good concurrency can
use Epoll::IO directly (without the GC-safety normal Epoll provides).

I'm also deprecating the Epoll#set and Epoll#delete APIs, since
they're expensive to maintain.  They will be removed in
sleepy_penguin 4.0 (probably 12 months or so).

I've also made Epoll thread-safe for Rubinius, as Rubinius C extensions
do not (or will not) hold any global lock, so the @marks array must be
protected.  Epoll::IO does not need additional locking to be
thread-safe, it uses thread-local storage and the kernel eventpoll
struct is already protected by its internal locking.

Most of these changes have been my experiences in using epoll in recent
years (mostly outside of Ruby) and also close inspection (and some
hacking :) of the epoll implementation in Linux.

I'll document these patches more, later, and push.

 ext/sleepy_penguin/epoll.c       | 633 ++++++---------------------------------
 ext/sleepy_penguin/epoll_green.h |   8 +-
 ext/sleepy_penguin/inotify.c     |  11 +-
 lib/sleepy_penguin.rb            |   1 +
 lib/sleepy_penguin/epoll.rb      | 266 ++++++++++++++++
 test/test_epoll.rb               |  31 +-
 test/test_epoll_io.rb            |  24 ++
 test/test_epoll_optimizations.rb |   2 +-
 8 files changed, 418 insertions(+), 558 deletions(-)


       reply	other threads:[~2013-04-11  4:18 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-11  4:17 Eric Wong [this message]
2013-04-11  4:17 ` [sleepy.penguin] [PATCH 1/6] test_epoll: fix timing error in test Eric Wong
2013-04-11  4:17 ` [sleepy.penguin] [PATCH 2/6] test_epoll: synchronize writes to the pipe array Eric Wong
2013-04-11  4:17 ` [sleepy.penguin] [PATCH 3/6] split Epoll and Epoll::IO, rewrite Epoll in Ruby Eric Wong
2013-04-12 20:38   ` Eric Wong
2013-04-11  4:17 ` [sleepy.penguin] [PATCH 4/6] epoll: implement thread-safety for mark/flag arrays Eric Wong
2013-04-12 21:18   ` Eric Wong
2013-04-11  4:17 ` [sleepy.penguin] [PATCH 5/6] epoll: cache alignment for per-thread structure Eric Wong
2013-04-11  4:17 ` [sleepy.penguin] [PATCH 6/6] avoid ENOMEM checking in common code paths Eric Wong

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

  List information: https://yhbt.net/sleepy_penguin/

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

  git send-email \
    --in-reply-to=1365653855-1101-1-git-send-email-normalperson@yhbt.net \
    --to=normalperson@yhbt.net \
    --cc=sleepy.penguin@librelist.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.
Code repositories for project(s) associated with this public inbox

	https://yhbt.net/sleepy_penguin.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).