Hi! Not long ago, POSIX semaphores support was enabled by default as it's becoming more widely used, by e.g. firefox. However, the support for these is still incomplete: we only have systemwide limit of 30 semaphores, and that doesn't seem to be configurable neither online with sysctl, nor at boottime from loader.conf. I only was able to raise semaphore count by changing SEM_MAX in kernel sources. The real appliaction which needs more semaphores is lightspark (graphics/lightspark-devel) flash plugin - it uses ~40 sems for simple clips and ~250 for something like youtube videos. Until there more apps that require proper semaphore support, I guess we need to improve it asap. Given the amount of memory used by ksem, the least can be done is SEM_MAX bumped up to 5120 or so for non-embedded kernels. 5120 semaphores require just 644k of kernel memory (judging by vmstat), and is "ought to be enough for anybody". Another good thing would be to make it configurable at boot-time or even better in runtime. -- Dmitry Marakasov . 55B5 0596 FF1E 8D84 5F56 9510 D35A 80DD F9D2 F77D amdmi3@amdmi3.ru ..: jabber: amdmi3@jabber.ru http://www.amdmi3.ru
On Sun, May 30, 2010 at 06:30:35PM +0400, Dmitry Marakasov wrote:> Hi! > > Not long ago, POSIX semaphores support was enabled by default as it's > becoming more widely used, by e.g. firefox. However, the support > for these is still incomplete: we only have systemwide limit of 30 > semaphores, and that doesn't seem to be configurable neither online with > sysctl, nor at boottime from loader.conf. I only was able to raise > semaphore count by changing SEM_MAX in kernel sources. > > The real appliaction which needs more semaphores is lightspark > (graphics/lightspark-devel) flash plugin - it uses ~40 sems for simple > clips and ~250 for something like youtube videos. > > Until there more apps that require proper semaphore support, I guess > we need to improve it asap. Given the amount of memory used by ksem, > the least can be done is SEM_MAX bumped up to 5120 or so for > non-embedded kernels. 5120 semaphores require just 644k of kernel > memory (judging by vmstat), and is "ought to be enough for anybody". > Another good thing would be to make it configurable at boot-time > or even better in runtime.HEAD contains different implementation. Apparently, it did not made into stable/8 yet, so it will not appear in the 8.1. Try this, I could try to squeeze it into 8.1. diff --git a/sys/kern/posix4_mib.c b/sys/kern/posix4_mib.c index 5242b31..41e28da 100644 --- a/sys/kern/posix4_mib.c +++ b/sys/kern/posix4_mib.c @@ -57,6 +57,9 @@ SYSCTL_DECL(_p1003_1b); #define P1B_SYSCTL(num, name) \ SYSCTL_INT(_p1003_1b, num, \ name, CTLFLAG_RD, facility + num - 1, 0, ""); +#define P1B_SYSCTL_RW(num, name) \ +SYSCTL_INT(_p1003_1b, num, \ + name, CTLFLAG_RW, facility + num - 1, 0, ""); #else @@ -65,6 +68,9 @@ SYSCTL_DECL(_kern_p1003_1b); #define P1B_SYSCTL(num, name) \ SYSCTL_INT(_kern_p1003_1b, OID_AUTO, \ name, CTLFLAG_RD, facility + num - 1, 0, ""); +#define P1B_SYSCTL_RW(num, name) \ +SYSCTL_INT(_kern_p1003_1b, OID_AUTO, \ + name, CTLFLAG_RW, facility + num - 1, 0, ""); SYSCTL_NODE(_kern, OID_AUTO, p1003_1b, CTLFLAG_RW, 0, "P1003.1B"); #endif @@ -91,7 +97,7 @@ P1B_SYSCTL(CTL_P1003_1B_DELAYTIMER_MAX, delaytimer_max); P1B_SYSCTL(CTL_P1003_1B_MQ_OPEN_MAX, mq_open_max); P1B_SYSCTL(CTL_P1003_1B_PAGESIZE, pagesize); P1B_SYSCTL(CTL_P1003_1B_RTSIG_MAX, rtsig_max); -P1B_SYSCTL(CTL_P1003_1B_SEM_NSEMS_MAX, sem_nsems_max); +P1B_SYSCTL_RW(CTL_P1003_1B_SEM_NSEMS_MAX, sem_nsems_max); P1B_SYSCTL(CTL_P1003_1B_SEM_VALUE_MAX, sem_value_max); P1B_SYSCTL(CTL_P1003_1B_SIGQUEUE_MAX, sigqueue_max); P1B_SYSCTL(CTL_P1003_1B_TIMER_MAX, timer_max); -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 196 bytes Desc: not available Url : http://lists.freebsd.org/pipermail/freebsd-stable/attachments/20100530/315b0ee0/attachment.pgp
On Sunday 30 May 2010 11:06:22 am Kostik Belousov wrote:> On Sun, May 30, 2010 at 06:30:35PM +0400, Dmitry Marakasov wrote: > > Hi! > > > > Not long ago, POSIX semaphores support was enabled by default as it's > > becoming more widely used, by e.g. firefox. However, the support > > for these is still incomplete: we only have systemwide limit of 30 > > semaphores, and that doesn't seem to be configurable neither online with > > sysctl, nor at boottime from loader.conf. I only was able to raise > > semaphore count by changing SEM_MAX in kernel sources. > > > > The real appliaction which needs more semaphores is lightspark > > (graphics/lightspark-devel) flash plugin - it uses ~40 sems for simple > > clips and ~250 for something like youtube videos. > > > > Until there more apps that require proper semaphore support, I guess > > we need to improve it asap. Given the amount of memory used by ksem, > > the least can be done is SEM_MAX bumped up to 5120 or so for > > non-embedded kernels. 5120 semaphores require just 644k of kernel > > memory (judging by vmstat), and is "ought to be enough for anybody". > > Another good thing would be to make it configurable at boot-time > > or even better in runtime. > > HEAD contains different implementation. Apparently, it did not made > into stable/8 yet, so it will not appear in the 8.1.The one thing I don't like about this approach is you can write the variable even when sem.ko isn't loaded. The SEM_* values should really only exist when sem.ko is loaded I think, which requires moving them into uipc_sem.c.> Try this, I could try to squeeze it into 8.1. > > diff --git a/sys/kern/posix4_mib.c b/sys/kern/posix4_mib.c > index 5242b31..41e28da 100644 > --- a/sys/kern/posix4_mib.c > +++ b/sys/kern/posix4_mib.c > @@ -57,6 +57,9 @@ SYSCTL_DECL(_p1003_1b); > #define P1B_SYSCTL(num, name) \ > SYSCTL_INT(_p1003_1b, num, \ > name, CTLFLAG_RD, facility + num - 1, 0, ""); > +#define P1B_SYSCTL_RW(num, name) \ > +SYSCTL_INT(_p1003_1b, num, \ > + name, CTLFLAG_RW, facility + num - 1, 0, ""); > > #else > > @@ -65,6 +68,9 @@ SYSCTL_DECL(_kern_p1003_1b); > #define P1B_SYSCTL(num, name) \ > SYSCTL_INT(_kern_p1003_1b, OID_AUTO, \ > name, CTLFLAG_RD, facility + num - 1, 0, ""); > +#define P1B_SYSCTL_RW(num, name) \ > +SYSCTL_INT(_kern_p1003_1b, OID_AUTO, \ > + name, CTLFLAG_RW, facility + num - 1, 0, ""); > SYSCTL_NODE(_kern, OID_AUTO, p1003_1b, CTLFLAG_RW, 0, "P1003.1B"); > > #endif > @@ -91,7 +97,7 @@ P1B_SYSCTL(CTL_P1003_1B_DELAYTIMER_MAX, delaytimer_max); > P1B_SYSCTL(CTL_P1003_1B_MQ_OPEN_MAX, mq_open_max); > P1B_SYSCTL(CTL_P1003_1B_PAGESIZE, pagesize); > P1B_SYSCTL(CTL_P1003_1B_RTSIG_MAX, rtsig_max); > -P1B_SYSCTL(CTL_P1003_1B_SEM_NSEMS_MAX, sem_nsems_max); > +P1B_SYSCTL_RW(CTL_P1003_1B_SEM_NSEMS_MAX, sem_nsems_max); > P1B_SYSCTL(CTL_P1003_1B_SEM_VALUE_MAX, sem_value_max); > P1B_SYSCTL(CTL_P1003_1B_SIGQUEUE_MAX, sigqueue_max); > P1B_SYSCTL(CTL_P1003_1B_TIMER_MAX, timer_max); >-- John Baldwin