[PATCH:xscope] Greatly reduce xscope's bss pages

Mark Kettenis mark.kettenis at xs4all.nl
Sat Feb 26 04:12:31 PST 2011


> From: Alan Coopersmith <alan.coopersmith at oracle.com>
> Date: Fri, 25 Feb 2011 23:28:24 -0800
> 
> xscope had several static arrays of StaticMaxFD structures, which ended up
> in .bss sections.   StaticMaxFD was initialized to FD_SETSIZE.
> 
> On 32-bit Solaris, the default value FD_SETSIZE is 1024.
> On 64-bit Solaris, the FD_SETSIZE is 64k, due to the SPARCv9 ABI.
> 
> One of the structures allocated included the 32k data buffer for each FD.
> This resulted in the highly excessive mapping of 2gb of .bss when building
> 64-bit binaries on Solaris, and 32mb for 32-bit binaries.
> 
> After this patch, only 52k of .bss is mapped.
> (Actual RSS pages for xscope were barely changed.)
> 
> To reduce this, the static tables were replaced with callocs of MaxFD
> tables, where MaxFD is now the smaller of StaticMaxFD or the current
> fd limit.   StaticMaxFD is reduced by default to 256, since xscope is
> rarely used with large numbers of clients (it can be recompiled with a
> larger StaticMaxFD when needed).

Sorry, but the combination of your statements here and the actual
patch doesn't completely make sense to me.  Is reducing StaticMaxFD
really necessary now that you have made the allocations more
dynamical?  Most people will run with ulimit -n set to something sane,
so the allocations won't be excessive.  You'll probably still want to
clamp at FD_SETSIZE though, given how 32-bit Solaris switches around
the select(2) and poll(2) implementations if the user sets FD_SETSIZE
to a value larger than 1024.

If you do decide that the number of file descriptors should be clamped
at 256, please leave the warning about recompiling the code with a
larger value for StaticMaxFD.

Cheers,

Mark


More information about the xorg-devel mailing list