Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 3 Mar 2008 21:37:07 -1000 (HST)
From:      Jeff Roberson <jroberson@chesapeake.net>
To:        David Xu <davidxu@FreeBSD.org>
Cc:        cvs-src@FreeBSD.org, Jeff Roberson <jeff@FreeBSD.org>, src-committers@FreeBSD.org, cvs-all@FreeBSD.org
Subject:   Re: cvs commit: src/sys/kern init_sysent.c syscalls.c systrace_args.c src/sys/sys syscall.h syscall.mk sysproto.h
Message-ID:  <20080303213630.D920@desktop>
In-Reply-To: <47CCBD78.5040708@freebsd.org>
References:  <200803020741.m227fAoJ039644@repoman.freebsd.org> <47CB6FB0.9040602@freebsd.org> <20080302183513.P920@desktop> <47CCAF49.20903@freebsd.org> <20080303164227.S920@desktop> <47CCBD78.5040708@freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help

On Tue, 4 Mar 2008, David Xu wrote:

> Jeff Roberson wrote:
>> 
>> On Tue, 4 Mar 2008, David Xu wrote:
>> 
>>> Jeff Roberson wrote:
>>> 
>>>>> One question is how I can determine the size of cpuset the kernel is
>>>>> using ?
>>>> 
>>>> I wrote it to tolerate user masks that were much larger than the kernel 
>>>> mask.  I set the default CPU_SETSIZE in userspace to 128 and in kernel 
>>>> it's MAXCPU.  So in practice an application shouldn't have to redefine 
>>>> CPU_SETSIZE.  If your set is too small the kernel will return ERANGE 
>>>> however.  Unfortunately, if your set is larger than the kernel's 
>>>> CPU_MAXSIZE it'll also return ERANGE.  Maybe I should use different 
>>>> errnos for those cases.
>>>> 
>>> 
>>> From my point, userland has to write some urgly code to guess what
>>> kernel code wants, it is rather frustrate.
>> 
>> You can use sysctl kern.smp.maxcpus to get the precise size.
>> 
>
> if kern.smp.maxcpus is a stable ABI, I may use it, can it be guaranteed?
> I saw following code in kern_cpuset.c, obviously, maxcpus is not
> respected.
>
> if (uap->cpusetsize < CPU_SETSIZE || uap->cpusetsize > CPU_MAXSIZE)
>    return (ERANGE);
>
>

CPU_SETSIZE in the kernel is defined to MAXCPU.  We can consider 
kern.smp.maxcpus a stable abi.  I can make a note next to it and put it in 
the cpuset man page.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20080303213630.D920>