* [PATCH 0/4] lei: prioritize signals
@ 2021-10-16 9:29 7% Eric Wong
2021-10-16 9:29 6% ` [PATCH 1/4] wqworker: favor level-triggered epoll for fairness Eric Wong
0 siblings, 1 reply; 2+ results
From: Eric Wong @ 2021-10-16 9:29 UTC (permalink / raw)
To: meta
We drop Edge-Triggered kevent/epoll in nearly all places
to give signalfd / EVFILT_SIGNAL priority.
Eric Wong (4):
wqworker: favor level-triggered epoll for fairness
pkt_op: favor level-triggered epoll for fairness
input_pipe: do not loop in ->event_step for fairness
lei sockets: favor level-triggered epoll for fairness
lib/PublicInbox/InputPipe.pm | 17 +++++-----
lib/PublicInbox/LEI.pm | 20 +++++-------
lib/PublicInbox/LeiSelfSocket.pm | 27 +++++++---------
lib/PublicInbox/PktOp.pm | 53 +++++++++++++++-----------------
lib/PublicInbox/WQWorker.pm | 18 +++++------
5 files changed, 60 insertions(+), 75 deletions(-)
^ permalink raw reply [relevance 7%]
* [PATCH 1/4] wqworker: favor level-triggered epoll for fairness
2021-10-16 9:29 7% [PATCH 0/4] lei: prioritize signals Eric Wong
@ 2021-10-16 9:29 6% ` Eric Wong
0 siblings, 0 replies; 2+ results
From: Eric Wong @ 2021-10-16 9:29 UTC (permalink / raw)
To: meta
Sigfd->event_step needs priority over WQWorkers (and everything
else). Do that by running once per event_loop iteration rather
than looping inside event_step. This lowers throughput since it
requires more syscalls, but that's the price of fairness.
---
lib/PublicInbox/WQWorker.pm | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/lib/PublicInbox/WQWorker.pm b/lib/PublicInbox/WQWorker.pm
index 48b901bb139f..950bd17052a5 100644
--- a/lib/PublicInbox/WQWorker.pm
+++ b/lib/PublicInbox/WQWorker.pm
@@ -6,7 +6,7 @@ package PublicInbox::WQWorker;
use strict;
use v5.10.1;
use parent qw(PublicInbox::DS);
-use PublicInbox::Syscall qw(EPOLLIN EPOLLEXCLUSIVE EPOLLET);
+use PublicInbox::Syscall qw(EPOLLIN EPOLLEXCLUSIVE);
use Errno qw(EAGAIN ECONNRESET);
use IO::Handle (); # blocking
@@ -14,19 +14,19 @@ sub new {
my ($cls, $wq, $sock) = @_;
$sock->blocking(0);
my $self = bless { sock => $sock, wq => $wq }, $cls;
- $self->SUPER::new($sock, EPOLLEXCLUSIVE|EPOLLIN|EPOLLET);
+ $self->SUPER::new($sock, EPOLLEXCLUSIVE|EPOLLIN);
$self;
}
sub event_step {
my ($self) = @_;
- my $n;
- do {
- $n = $self->{wq}->recv_and_run($self->{sock});
- } while ($n);
- return if !defined($n) && $! == EAGAIN; # likely
- warn "wq worker error: $!\n" if !defined($n) && $! != ECONNRESET;
- $self->{wq}->wq_atexit_child if $self->{sock} == $self->{wq}->{-wq_s2};
+ my $n = $self->{wq}->recv_and_run($self->{sock}) and return;
+ unless (defined $n) {
+ return if $! == EAGAIN;
+ warn "recvmsg: $!" if $! != ECONNRESET;
+ }
+ $self->{sock} == $self->{wq}->{-wq_s2} and
+ $self->{wq}->wq_atexit_child;
$self->close; # PublicInbox::DS::close
}
^ permalink raw reply related [relevance 6%]
Results 1-2 of 2 | reverse | options above
-- pct% links below jump to the message on this page, permalinks otherwise --
2021-10-16 9:29 7% [PATCH 0/4] lei: prioritize signals Eric Wong
2021-10-16 9:29 6% ` [PATCH 1/4] wqworker: favor level-triggered epoll for fairness Eric Wong
Code repositories for project(s) associated with this public inbox
https://80x24.org/public-inbox.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).