user/dev discussion of public-inbox itself
 help / color / mirror / code / Atom feed
Search results ordered by [date|relevance]  view[summary|nested|Atom feed]
thread overview below | download mbox.gz: |
* [PATCH 1/3] lock: get rid of PID guard
  2024-04-01  6:49  5% [PATCH 0/3] treewide: getpid() syscall reduction Eric Wong
@ 2024-04-01  6:49  7% ` Eric Wong
  0 siblings, 0 replies; 2+ results
From: Eric Wong @ 2024-04-01  6:49 UTC (permalink / raw)
  To: meta

PID guards for OnDestroy will be the default in an upcoming
change.  In the meantime, LeiMirror was the only user and
didn't actually need it.
---
 lib/PublicInbox/LeiMirror.pm | 2 +-
 lib/PublicInbox/Lock.pm      | 8 ++++----
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/lib/PublicInbox/LeiMirror.pm b/lib/PublicInbox/LeiMirror.pm
index 5353ae61..4e3e1d1c 100644
--- a/lib/PublicInbox/LeiMirror.pm
+++ b/lib/PublicInbox/LeiMirror.pm
@@ -856,7 +856,7 @@ sub v2_done { # called via OnDestroy
 	my $dst = $self->{cur_dst} // $self->{dst};
 	require PublicInbox::Lock;
 	my $lk = PublicInbox::Lock->new("$dst/inbox.lock");
-	my $lck = $lk->lock_for_scope($$);
+	my $lck = $lk->lock_for_scope;
 	_write_inbox_config($self);
 	require PublicInbox::MultiGit;
 	my $mg = PublicInbox::MultiGit->new($dst, 'all.git', 'git');
diff --git a/lib/PublicInbox/Lock.pm b/lib/PublicInbox/Lock.pm
index ddaf3312..2a5a0f30 100644
--- a/lib/PublicInbox/Lock.pm
+++ b/lib/PublicInbox/Lock.pm
@@ -41,9 +41,9 @@ sub lock_release {
 
 # caller must use return value
 sub lock_for_scope {
-	my ($self, @single_pid) = @_;
+	my ($self) = @_;
 	lock_acquire($self) or return; # lock_path not set
-	PublicInbox::OnDestroy->new(@single_pid, \&lock_release, $self);
+	PublicInbox::OnDestroy->new(\&lock_release, $self);
 }
 
 sub lock_acquire_fast {
@@ -58,9 +58,9 @@ sub lock_release_fast {
 
 # caller must use return value
 sub lock_for_scope_fast {
-	my ($self, @single_pid) = @_;
+	my ($self) = @_;
 	lock_acquire_fast($self) or return; # lock_path not set
-	PublicInbox::OnDestroy->new(@single_pid, \&lock_release_fast, $self);
+	PublicInbox::OnDestroy->new(\&lock_release_fast, $self);
 }
 
 1;

^ permalink raw reply related	[relevance 7%]

* [PATCH 0/3] treewide: getpid() syscall reduction
@ 2024-04-01  6:49  5% Eric Wong
  2024-04-01  6:49  7% ` [PATCH 1/3] lock: get rid of PID guard Eric Wong
  0 siblings, 1 reply; 2+ results
From: Eric Wong @ 2024-04-01  6:49 UTC (permalink / raw)
  To: meta

Nowadays, getpid() isn't cached on glibc and CPU vulnerability
mitigations make syscalls slower than before.  This makes strace
slower and more noisy, so introduce some fairly large changes
to reduce getpid() syscalls.  Maybe more coming soon...  I
noticed the noisyness while debugging a different problem a
while ago.

Eric Wong (3):
  lock: get rid of PID guard
  treewide: avoid getpid() for OnDestroy checks
  treewide: avoid getpid for more ownership checks

 lib/PublicInbox/CodeSearchIdx.pm  | 29 +++++++++++------------
 lib/PublicInbox/DS.pm             |  9 ++++----
 lib/PublicInbox/DSKQXS.pm         |  7 +++---
 lib/PublicInbox/Daemon.pm         | 38 ++++++++++++-------------------
 lib/PublicInbox/Git.pm            |  8 +++----
 lib/PublicInbox/IO.pm             | 12 ++++++----
 lib/PublicInbox/IPC.pm            | 12 ++++++----
 lib/PublicInbox/LEI.pm            |  8 +++----
 lib/PublicInbox/LeiALE.pm         |  7 +++---
 lib/PublicInbox/LeiMirror.pm      | 27 ++++++++++------------
 lib/PublicInbox/LeiP2q.pm         |  2 +-
 lib/PublicInbox/LeiStore.pm       |  3 ++-
 lib/PublicInbox/LeiTag.pm         |  8 +++----
 lib/PublicInbox/Lock.pm           |  8 +++----
 lib/PublicInbox/MHreader.pm       |  4 ++--
 lib/PublicInbox/MboxLock.pm       |  6 ++---
 lib/PublicInbox/OnDestroy.pm      | 27 ++++++++++++++--------
 lib/PublicInbox/SearchIdxShard.pm |  2 +-
 lib/PublicInbox/SpawnPP.pm        |  5 ++--
 lib/PublicInbox/TestCommon.pm     |  4 ++--
 lib/PublicInbox/Umask.pm          |  2 +-
 lib/PublicInbox/ViewVCS.pm        |  5 ++--
 lib/PublicInbox/Watch.pm          |  4 ++--
 lib/PublicInbox/WwwCoderepo.pm    |  2 +-
 lib/PublicInbox/XapClient.pm      |  2 +-
 lib/PublicInbox/XapHelper.pm      |  2 +-
 lib/PublicInbox/Xapcmd.pm         |  2 +-
 script/public-inbox-init          |  2 +-
 t/lei-sigpipe.t                   |  4 +---
 t/mbox_lock.t                     |  7 +++---
 t/mh_reader.t                     |  1 -
 t/on_destroy.t                    | 25 ++++++++++++--------
 t/spawn.t                         |  3 ++-
 xt/net_writer-imap.t              |  4 ++--
 34 files changed, 150 insertions(+), 141 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 --
2024-04-01  6:49  5% [PATCH 0/3] treewide: getpid() syscall reduction Eric Wong
2024-04-01  6:49  7% ` [PATCH 1/3] lock: get rid of PID guard 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).