MAXCPU preparations

Joshua Neal jdneal at gmail.com
Mon Sep 27 23:56:11 UTC 2010


I hit this bug at one point, and had to bump MEMSTAT_MAXCPU.  It's
already asking the kernel for the max number and throwing an error if
it doesn't agree:

       if (sysctlbyname("kern.smp.maxcpus", &maxcpus, &size, NULL, 0) < 0) {

[...]

        if (maxcpus > MEMSTAT_MAXCPU) {
                list->mtl_error = MEMSTAT_ERROR_TOOMANYCPUS;
                return (-1);
        }

I was thinking a more future-proof fix would be to get rid of the
static allocations and allocate the library's internal structures
based on the value of kern.smp.maxcpus.

- Joshua

On Mon, Sep 27, 2010 at 2:42 PM, Robert Watson <rwatson at freebsd.org> wrote:
>
> On Mon, 27 Sep 2010, John Baldwin wrote:
>
>> Also, I think we should either fix MAXCPU to export the SMP value to
>> userland, or hide it from userland completely.  Exporting the UP value is
>> Just Wrong (tm).
>
> Well, it's useful in the sense that it tells you what the maximum number of
> CPUs a kernel can support is, which is helpful, especially if you're futzing
> with MAXCPU as a kernel option :-).
>
> But, more generally, many things that use MAXCPU should probably use either
> mp_maxid or DPCPU.  Not everything, but most things.
>
> Robert
> _______________________________________________
> freebsd-current at freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-current
> To unsubscribe, send any mail to "freebsd-current-unsubscribe at freebsd.org"
>


More information about the freebsd-current mailing list