svn commit: r242655 - head/sys/kern

Garrett Cooper yanegomi at gmail.com
Tue Nov 6 21:13:52 UTC 2012


On Mon, Nov 5, 2012 at 8:10 PM, Alfred Perlstein <alfred at freebsd.org> wrote:

> Author: alfred
> Date: Tue Nov  6 04:10:32 2012
> New Revision: 242655
> URL: http://svnweb.freebsd.org/changeset/base/242655
>
> Log:
>   export VM_MIN_KERNEL_ADDRESS and VM_MAX_KERNEL_ADDRESS via sysctl.
>
>   On several platforms the are determined by too many nested #defines to be
>   easily discernible.  This will aid in development of auto-tuning.
>
> Modified:
>   head/sys/kern/kern_malloc.c
>

This should be vm_offset


> Modified: head/sys/kern/kern_malloc.c
>
> ==============================================================================
> --- head/sys/kern/kern_malloc.c Tue Nov  6 02:43:41 2012        (r242654)
> +++ head/sys/kern/kern_malloc.c Tue Nov  6 04:10:32 2012        (r242655)
> @@ -186,6 +186,14 @@ struct {
>   */
>  static uma_zone_t mt_zone;
>
> +static u_long vm_min_kernel_address = VM_MIN_KERNEL_ADDRESS;
> +SYSCTL_ULONG(_vm, OID_AUTO, min_kernel_address, CTLFLAG_RD,
> +    &vm_min_kernel_address, 0, "Min kernel address");
> +
> +static u_long vm_max_kernel_address = VM_MAX_KERNEL_ADDRESS;
> +SYSCTL_ULONG(_vm, OID_AUTO, max_kernel_address, CTLFLAG_RD,
> +    &vm_max_kernel_address, 0, "Max kernel address");
> +
>  u_long vm_kmem_size;
>  SYSCTL_ULONG(_vm, OID_AUTO, kmem_size, CTLFLAG_RDTUN, &vm_kmem_size, 0,
>      "Size of kernel memory");
>

    This should probably be vm_offset_t for both values and there's already
some goo in the arch specific portion of sparc64 which handles this with
different type width (as noted by the tinderbox failures).
    Typechecking in this case per-platform should be ok with u_long outside
of sparc64:

/sys/amd64/include/_types.h:typedef     __uint64_t      __vm_offset_t;
/sys/arm/include/_types.h:typedef       __uint32_t      __vm_offset_t;
/sys/i386/include/_types.h:typedef      __uint32_t      __vm_offset_t;
/sys/ia64/include/_types.h:typedef      __uint64_t      __vm_offset_t;
/sys/mips/include/_types.h:typedef      __uint64_t      __vm_offset_t;
/sys/mips/include/_types.h:typedef      __uint32_t      __vm_offset_t;
/sys/powerpc/include/_types.h:typedef   __uint64_t      __vm_offset_t;
/sys/powerpc/include/_types.h:typedef   __uint32_t      __vm_offset_t;
/sys/sparc64/include/_types.h:typedef   __uint64_t      __vm_offset_t;
$ for i in `ls /sys/*/*/*machdep*.c | xargs dirname | xargs dirname | sort
-u`; do egrep -qr 'vm_(min|max)_kernel_address' $i && echo "${i##*/} derp"
|| echo "${i##*/} ok"; done
amd64 ok
arm ok
dev ok
i386 ok
ia64 ok
mips ok
pc98 ok
powerpc ok
sparc64 derp
x86 ok

    So maybe talking to Marius about consolidating that would be a good
idea (or just applying a simple sed hack to rename the variable and move
on).
Thanks,
-Garrett


More information about the svn-src-head mailing list