Date: Wed, 22 Jun 2016 07:26:52 -0700 From: Maxim Sobolev <sobomax@freebsd.org> To: Konstantin Belousov <kostikbel@gmail.com> Cc: John Baldwin <jhb@freebsd.org>, Adrian Chadd <adrian@freebsd.org>, Alan Somers <asomers@freebsd.org>, Alan Cox <alc@rice.edu>, Alan Cox <alc@freebsd.org>, freebsd-current <freebsd-current@freebsd.org>, performance@freebsd.org, "current@freebsd.org" <current@freebsd.org> Subject: Re: PostgreSQL performance on FreeBSD Message-ID: <CAH7qZfvy46wWcrjz-ihA%2B%2BEYktm7PqGoJhj1a7hdYWssiEXFuA@mail.gmail.com> In-Reply-To: <20160622100241.GM38613@kib.kiev.ua> References: <20140627125613.GT93733@kib.kiev.ua> <CAJ-Vmom-M=R=FaBfHE5c2%2BYxW0SLmJTdFJD8tW4_aOD7MDNwzA@mail.gmail.com> <CAJ-Vmomt=WYjct%2BzsTbHuryxqYp7ELyS52LOb4NEsfENQ1yj1w@mail.gmail.com> <1603235.2ShtoCfSqO@ralph.baldwin.cx> <CAH7qZfuAtHtUG92wEjPhOZ=BGgyFS728uigjJoD0pG%2B-mtUSww@mail.gmail.com> <20160622100241.GM38613@kib.kiev.ua>
next in thread | previous in thread | raw e-mail | index | archive | help
Konstantin, Not if you do sem_unlink() immediately, AFAIK. And that's what PG does. So the window of opportunity for the leakage is quite small, much smaller than for SYSV primitives. Sorry for missing your status update message, I've missed it somehow. ---- mySem = sem_open(semname, O_CREAT | O_EXCL, (mode_t) IPCProtection, (unsigned) 1); #ifdef SEM_FAILED if (mySem != (sem_t *) SEM_FAILED) break; #else if (mySem != (sem_t *) (-1)) break; #endif /* Loop if error indicates a collision */ if (errno == EEXIST || errno == EACCES || errno == EINTR) continue; /* * Else complain and abort */ elog(FATAL, "sem_open(\"%s\") failed: %m", semname); } /* * Unlink the semaphore immediately, so it can't be accessed externally. * This also ensures that it will go away if we crash. */ sem_unlink(semname); return mySem; ---- -Max On Wed, Jun 22, 2016 at 3:02 AM, Konstantin Belousov <kostikbel@gmail.com> wrote: > On Tue, Jun 21, 2016 at 12:48:00PM -0700, Maxim Sobolev wrote: > > Thanks, Konstantin for the great work, we are definitely looking forward > to > > get all those improvements to be part of the default FreeBSD kernel/port. > > Would be nice if you can post an update some day later as to what's > > integrated and what's not. > I did posted the update several days earlier. Since you replying to this > thread, it would be not unreasonable to read recent messages that were > sent. > > > > > Just in case, I've opened #14206 with PG to switch us to using POSIX > > semaphores by default. Apart from the mentioned performance benefits, > SYSV > > semaphores are PITA to deal with as they come in very limited quantities > by > > default. Also they might stay around if PG dies/gets nuked and prevent it > > from starting again due to overflow. We've got some quite ugly code to > > clean up those using ipcrm(1) in our build scripts to deal with just > that. > > I am happy that code could be retired now. > > Named semaphores also stuck around if processes are killed without cleanup. > >
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAH7qZfvy46wWcrjz-ihA%2B%2BEYktm7PqGoJhj1a7hdYWssiEXFuA>