* [PATCH 3/3] git+gcf2client: switch to level-triggered wakeups
2023-09-30 15:20 5% [PATCH 0/3] git: use Unix stream sockets for --batch* Eric Wong
@ 2023-09-30 15:20 7% ` Eric Wong
0 siblings, 0 replies; 2+ results
From: Eric Wong @ 2023-09-30 15:20 UTC (permalink / raw)
To: meta
Instead of using ->requeue to emulate level-triggered wakeups in
userspace, just use level-triggered wakeups in the kernel to
save some user time at the expense of system (kernel) time. Of
course, the ready list implementation in the kernel via C is
faster than a Perl one on our end.
We must still use requeue if we've got buffered data, however.
Followup-to: 1181a7e6a853 (listener: switch to level-triggered epoll)
---
lib/PublicInbox/Gcf2Client.pm | 4 ++--
lib/PublicInbox/Git.pm | 7 ++++---
2 files changed, 6 insertions(+), 5 deletions(-)
diff --git a/lib/PublicInbox/Gcf2Client.pm b/lib/PublicInbox/Gcf2Client.pm
index 8f442787..8ac44a5e 100644
--- a/lib/PublicInbox/Gcf2Client.pm
+++ b/lib/PublicInbox/Gcf2Client.pm
@@ -9,7 +9,7 @@ use PublicInbox::Git;
use PublicInbox::Gcf2; # fails if Inline::C or libgit2-dev isn't available
use PublicInbox::Spawn qw(spawn);
use Socket qw(AF_UNIX SOCK_STREAM);
-use PublicInbox::Syscall qw(EPOLLIN EPOLLET);
+use PublicInbox::Syscall qw(EPOLLIN);
use PublicInbox::ProcessPipe;
# fields:
@@ -35,7 +35,7 @@ sub new {
my $sock = PublicInbox::ProcessPipe->maybe_new($pid, $s1);
$self->{inflight} = [];
$self->{epwatch} = \undef; # for Git->cleanup
- $self->SUPER::new($sock, EPOLLIN|EPOLLET);
+ $self->SUPER::new($sock, EPOLLIN);
}
sub gcf2_async ($$$;$) {
diff --git a/lib/PublicInbox/Git.pm b/lib/PublicInbox/Git.pm
index 3062f293..5003be53 100644
--- a/lib/PublicInbox/Git.pm
+++ b/lib/PublicInbox/Git.pm
@@ -650,15 +650,16 @@ sub event_step {
if ($inflight && @$inflight) {
$self->cat_async_step($inflight);
return $self->close unless $self->{sock};
- # more to do? requeue for fairness:
- $self->requeue if @$inflight || exists($self->{rbuf});
+ # don't loop here to keep things fair, but we must requeue
+ # if there's already-read data in rbuf
+ $self->requeue if exists($self->{rbuf});
}
}
# idempotently registers with DS epoll/kqueue/select/poll
sub watch_async ($) {
$_[0]->{epwatch} //= do {
- $_[0]->SUPER::new($_[0]->{sock}, EPOLLIN|EPOLLET);
+ $_[0]->SUPER::new($_[0]->{sock}, EPOLLIN);
\undef;
}
}
^ permalink raw reply related [relevance 7%]
* [PATCH 0/3] git: use Unix stream sockets for --batch*
@ 2023-09-30 15:20 5% Eric Wong
2023-09-30 15:20 7% ` [PATCH 3/3] git+gcf2client: switch to level-triggered wakeups Eric Wong
0 siblings, 1 reply; 2+ results
From: Eric Wong @ 2023-09-30 15:20 UTC (permalink / raw)
To: meta
This simplifies git process management greatly, and the diffstat
makes me happy.
Eric Wong (3):
git: decouple cat_async_retry from POSIX pipe semantics
git: use Unix stream sockets for `cat-file --batch-*'
git+gcf2client: switch to level-triggered wakeups
lib/PublicInbox/Gcf2Client.pm | 59 ++------
lib/PublicInbox/Git.pm | 269 +++++++++++++++++----------------
lib/PublicInbox/GitAsyncCat.pm | 98 +-----------
lib/PublicInbox/LeiToMail.pm | 2 +-
lib/PublicInbox/ViewVCS.pm | 2 +-
5 files changed, 158 insertions(+), 272 deletions(-)
^ permalink raw reply [relevance 5%]
Results 1-2 of 2 | reverse | options above
-- pct% links below jump to the message on this page, permalinks otherwise --
2023-09-30 15:20 5% [PATCH 0/3] git: use Unix stream sockets for --batch* Eric Wong
2023-09-30 15:20 7% ` [PATCH 3/3] git+gcf2client: switch to level-triggered wakeups 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).