From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-Status: No, score=-2.8 required=3.0 tests=AWL,BAYES_00, DKIM_ADSP_CUSTOM_MED,FORGED_GMAIL_RCVD,FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_PASS,UNPARSEABLE_RELAY shortcircuit=no autolearn=no autolearn_force=no version=3.4.2 Received: from neon.ruby-lang.org (neon.ruby-lang.org [221.186.184.75]) by dcvr.yhbt.net (Postfix) with ESMTP id 543711F66E for ; Sun, 16 Aug 2020 21:08:15 +0000 (UTC) Received: from neon.ruby-lang.org (localhost [IPv6:::1]) by neon.ruby-lang.org (Postfix) with ESMTP id F114B1208FA; Mon, 17 Aug 2020 06:07:40 +0900 (JST) Received: from xtrwkhkc.outbound-mail.sendgrid.net (xtrwkhkc.outbound-mail.sendgrid.net [167.89.16.28]) by neon.ruby-lang.org (Postfix) with ESMTPS id EF9BB1208F9 for ; Mon, 17 Aug 2020 06:07:38 +0900 (JST) Received: by filterdrecv-p3iad2-5c98798b7-v5sth with SMTP id filterdrecv-p3iad2-5c98798b7-v5sth-17-5F39A036-41 2020-08-16 21:08:06.722365546 +0000 UTC m=+275916.011863385 Received: from herokuapp.com (unknown) by geopod-ismtpd-3-3 (SG) with ESMTP id qCnlztbGRV-u9DpWvwN6jw for ; Sun, 16 Aug 2020 21:08:06.688 +0000 (UTC) Date: Sun, 16 Aug 2020 21:08:06 +0000 (UTC) From: dsh0416@gmail.com Message-ID: References: Mime-Version: 1.0 X-Redmine-MailingListIntegration-Message-Ids: 75431 X-Redmine-Project: ruby-master X-Redmine-Issue-Tracker: Feature X-Redmine-Issue-Id: 17059 X-Redmine-Issue-Author: dsh0416 X-Redmine-Sender: dsh0416 X-Mailer: Redmine X-Redmine-Host: bugs.ruby-lang.org X-Redmine-Site: Ruby Issue Tracking System X-Auto-Response-Suppress: All Auto-Submitted: auto-generated X-SG-EID: =?us-ascii?Q?JfUq2S2D3Hy6+ijZravGPs29zhqXCTJcgd4jfmDsi8ryf7kMRfa0Lak9NRcu8Q?= =?us-ascii?Q?04wOuRZLHClV9F91y+2=2FFPfPTHpZeNBgQTxkAS2?= =?us-ascii?Q?YOzZaOb6xjxHvGRg7PMlhh2VUzOxtl+sJaW5XdA?= =?us-ascii?Q?7M=2FRmTgzPityIxIid6nFYscSV=2FrP2iSkI10X9YO?= =?us-ascii?Q?BDF3hFBv8Eh5GYvjYOz=2FiGW1goRhm3njT+pMU7F?= =?us-ascii?Q?Ys7L=2FQkDw=2F0afMkXw=3D?= To: ruby-core@ruby-lang.org X-ML-Name: ruby-core X-Mail-Count: 99603 Subject: [ruby-core:99603] [Ruby master Feature#17059] epoll as the backend of IO.select on Linux X-BeenThere: ruby-core@ruby-lang.org X-Mailman-Version: 2.1.15 Precedence: list Reply-To: Ruby developers List-Id: Ruby developers List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ruby-core-bounces@ruby-lang.org Sender: "ruby-core" Issue #17059 has been updated by dsh0416 (Delton Ding). File epoll.h added Update the WIP implementation ---------------------------------------- Feature #17059: epoll as the backend of IO.select on Linux https://bugs.ruby-lang.org/issues/17059#change-87082 * Author: dsh0416 (Delton Ding) * Status: Open * Priority: Normal ---------------------------------------- Current Ruby's `IO.select` method calls POSIX `select` API directly. With the new non-blocking scheduler, this may be the bottleneck of the I/O scheduling. For keeping the backward compatibilty of the current `IO.select` methods, a proposal may be to create a "duck" `select` which uses the `epoll_wait` as the backend. One tricky part is that the `fd_set` described in POSIX is write-only, which means it is impossible to iterate for generating the `epoll_event` argument for `epoll_wait`. But similar to the large-size select situation, we could define our own `rb_fdset_t` struct in this case, and implement the following APIs. ``` void rb_fd_init(rb_fdset_t *); void rb_fd_term(rb_fdset_t *); void rb_fd_zero(rb_fdset_t *); void rb_fd_set(int, rb_fdset_t *); void rb_fd_clr(int, rb_fdset_t *); int rb_fd_isset(int, const rb_fdset_t *); void rb_fd_copy(rb_fdset_t *, const fd_set *, int); void rb_fd_dup(rb_fdset_t *dst, const rb_fdset_t *src); int rb_fd_select(int, rb_fdset_t *, rb_fdset_t *, rb_fdset_t *, struct timeval *); ``` TODO: 1. Implement the fd_set with dynamic allocated fds. 2. Implement the epoll with select API. 3. Edit io.c to use the customized fd_set struct. I'm trying to work on a branch for this. Any suggestions for this? ---Files-------------------------------- epoll.h (3.62 KB) epoll.h (6.44 KB) -- https://bugs.ruby-lang.org/