tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: semaphores options



At Mon, 8 Apr 2019 21:19:32 +0300, Dima Veselov <kab00m%lich.phys.spbu.ru@localhost> wrote:
Subject: semaphores options
>
> Greetings!
> Sorry for posting so many questions recently, but my production
> server failed to start PostgreSQL after system upgrade (8-STABLE).
>
> This was caused by semaphores, which I like to set in kernel options,
> which now are not working. Better say some are working, some are
> not.
>
> I solved the problem setting them via sysctl but I wonder what happened
> with options(4)?
> It seems that SEMMNI, SEMMNS, SEMMNU, NOFILE and CHILD_MAX do not
> work anymore, but SHMSEG and NMBCLUSTERS are good. I beleive they
> were always working because the system worked long time and had
> sysctl.conf empty. Any recent changes?

Indeed, something seems to have changed, and the problem continues with
-current as of late January (8.99.32).

I think the culprit was this change, which somehow didn't have an
accompanying change to any documentation (most notably options(4) still
documents all the removed settings):

RCS file: /cvs/master/m-NetBSD/main/src/sys/conf/param.c,v
----------------------------
revision 1.65
date: 2015-05-12 19:06:25 -0700;  author: pgoyette;  state: Exp;  lines: +4 -2;  commitid: G8nWAd1qbrsX8ely;
Create a new sysv_ipc module to contain the SYSVSHM, SYSVSEM, and
SYSVMSG options.  Move associated variables out of param.c and into
the module's source file.
----------------------------

This commit adds a great big ugly "#if XXX_PRG" around all the related
SysV IPC settings in sys/conf/param.c, i.e. it entirely removes all
support for "options SEMMNI=NNN" and related.

Perhaps this only affects kernels which have the SysV IPC code baked in,
though I've no idea how the so-called modular world is supposed to work
for pre-set definitions -- I guess it doesn't, though perhaps there's
still some hook for config(1)?.

The real underlying problem may be that none of the SysV IPC options
from options(4) where ever properly set up with "defflag" or "defparam"
in the appropriate "files" file (sys/kern/files.kern probably), or as we
used to say, they were never "defopt'ed" for config.  See config(5).

Having "options FOO=1234" worked without "defparam" if the use was in
sys/conf/param.c, but it doesn't seem to work with the new regime.
Maybe it would work again if "defparam" lines were added to the right
place.

FYI, I have had the following in my kernel configs (in this particular
case edited into XEN3_DOMU) since a very long time ago (before 1.6), and
they continued to work up to and including 5.2_STABLE:

# System V compatible IPC subsystem.  (msgctl(2), semctl(2), and shmctl(2))
#
# Note: SysV IPC parameters could be changed dynamically, see sysctl(8).
#
options 	SYSVMSG		# System V-like message queues
#
options 	MSGMNI=200	# max number of message queue identifiers (default 40)
options 	MSGMNB=32768	# max size of a message queue (default 2048)
options 	MSGTQL=512	# max number of messages in the system (default 40)
options 	MSGSSZ=128	# size of a message segment (must be 2^n, n>4) (default 8)
options 	MSGSEG=16384	# max number of message segments in the system
				# (must be less than 32767) (default 2048)
#
options 	SYSVSEM		# System V-like semaphores
options 	SEMMNI=200	# max number of semaphore identifiers in system (def=10)
options 	SEMMNS=600	# max number of semaphores in system (def=60)
options 	SEMMNU=300	# number of undo structures in system (def=30)
options 	SEMUME=100	# max number of undo entries per process (def=10)
#
options 	SYSVSHM		# System V-like memory sharing
options 	SHMMAXPGS=16384	# Size of shared memory map (def=2048)



But on my 8.99.32 XEN3_DOMU kernel these only give me:

# sysctl kern.ipc
kern.ipc.sysvmsg = 1
kern.ipc.sysvsem = 1
kern.ipc.sysvshm = 1
kern.ipc.shmmax = 2097152000
kern.ipc.shmmni = 128
kern.ipc.shmseg = 128
kern.ipc.shmmaxpgs = 512000
kern.ipc.shm_use_phys = 0
kern.ipc.msgmni = 200
kern.ipc.msgseg = 16384
kern.ipc.semmni = 10
kern.ipc.semmns = 60
kern.ipc.semmnu = 30


FYI, to show it did/does work on an older system:

23:02 [0.185] # uname -a
NetBSD central 5.2_STABLE NetBSD 5.2_STABLE (XEN3_DOMU) #0: Sun Jun  5 16:33:15 PDT 2016  woods@building:/build/woods/building/netbsd-5-amd64-amd64-obj/work/woods/m-NetBSD-5/sys/arch/amd64/compile/XEN3_DOMU amd64
23:02 [0.186] # sysctl kern.ipc
kern.ipc.sysvmsg = 1
kern.ipc.sysvsem = 1
kern.ipc.sysvshm = 1
kern.ipc.shmmax = 67108864
kern.ipc.shmmni = 128
kern.ipc.shmseg = 128
kern.ipc.shmmaxpgs = 16384
kern.ipc.shm_use_phys = 0
kern.ipc.msgmni = 200
kern.ipc.msgseg = 16384
kern.ipc.semmni = 200
kern.ipc.semmns = 600
kern.ipc.semmnu = 300


--
					Greg A. Woods <gwoods%acm.org@localhost>

+1 250 762-7675                           RoboHack <woods%robohack.ca@localhost>
Planix, Inc. <woods%planix.com@localhost>     Avoncote Farms <woods%avoncote.ca@localhost>

Attachment: pgpckM3Iq3yzO.pgp
Description: OpenPGP Digital Signature



Home | Main Index | Thread Index | Old Index