svn commit: r214409 - head/sys/kern

Garrett Cooper gcooper at freebsd.org
Wed Oct 27 16:07:41 UTC 2010


On Wed, Oct 27, 2010 at 6:33 AM, Kostik Belousov <kostikbel at gmail.com> wrote:
> On Wed, Oct 27, 2010 at 04:37:38PM +0000, David Xu wrote:
>> Pawel Jakub Dawidek wrote:
>> >On Wed, Oct 27, 2010 at 10:49:12AM +0000, David Xu wrote:
>> >>I really hate to see such a problem that userland can not figure out
>> >>what kernel is using, I try hardly to guess, but still can not find
>> >>what it is using. yes, I think the doc may need to be fixed or
>> >>another syscall is needed.
>> >
>> >Maybe you could just add sysctl and eventually put it into sysconf(3)?
>> >
>>
>> I just found a dirty method, use sizeof(long) and kern.smp.maxcpus
>> 32 to figure out the size the kernel is using, because it is how
>> cpuset_t is constructed, wish it will never be changed. ;-)
>>
> I think that sysctl is the way forward, but you may add non-portable
> FreeBSD function to get the value, and use an ELF aux vector interface
> to avoid sysctl most of the time.

    How about this patch? I implemented this as a readonly tunable and
sysconf tunable, because (AFAIK) the value that is being tested
shouldn't change during runtime after the system has been booted up,
and figuring that the value wasn't going to change it was better to
lose 4/8 bytes on the kernel stack instead of having to recompute the
value every time in a function call, with the associated lost heap /
stack memory in the process, as the assumption is that this libcall
was going to be called frequently by some programs.
Thanks!
-Garrett
-------------- next part --------------
A non-text attachment was scrubbed...
Name: cpuset_t-size-sysctl-and-sysconf-value.patch
Type: text/x-patch
Size: 1762 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/svn-src-all/attachments/20101027/679650e3/cpuset_t-size-sysctl-and-sysconf-value.bin


More information about the svn-src-all mailing list