svn commit: r245255 - head/sys/vm

Sergey Kandaurov pluknet at gmail.com
Thu Jan 10 14:03:39 UTC 2013


On 10 January 2013 16:43, Andrey Zonov <zont at freebsd.org> wrote:
> Author: zont
> Date: Thu Jan 10 12:43:58 2013
> New Revision: 245255
> URL: http://svnweb.freebsd.org/changeset/base/245255
>
> Log:
>   - Reduce kernel size by removing unnecessary pointer indirections.
>
>   GENERIC kernel size reduced in 16 bytes and RACCT kernel in 336 bytes.
>
>   Suggested by: alc
>   Reviewed by:  alc
>   Approved by:  kib (mentor)
>   MFC after:    1 week
>
> Modified:
>   head/sys/vm/vm_map.c
>   head/sys/vm/vm_mmap.c
>   head/sys/vm/vm_unix.c
>
> Modified: head/sys/vm/vm_map.c
> ==============================================================================
> --- head/sys/vm/vm_map.c        Thu Jan 10 12:30:58 2013        (r245254)
> +++ head/sys/vm/vm_map.c        Thu Jan 10 12:43:58 2013        (r245255)
[...]
> @@ -3505,8 +3504,7 @@ Retry:
>                 grow_amount = limit - ctob(vm->vm_ssize);
>  #endif
>         if (!old_mlock && map->flags & MAP_WIREFUTURE) {
> -               if (ptoa(vmspace_wired_count(p->p_vmspace)) + grow_amount >
> -                   lmemlim) {
> +               if (ptoa(pmap_wired_count(map->pmap)) + grow_amount > lmemlim) {
>                         vm_map_unlock_read(map);
>                         rv = KERN_NO_SPACE;
>                         goto out;
> @@ -3514,7 +3512,7 @@ Retry:
>  #ifdef RACCT
>                 PROC_LOCK(p);
>                 if (racct_set(p, RACCT_MEMLOCK,
> -                   ptoa(vmspace_wired_count(p->p_vmspace)) + grow_amount)) {
> +                   ptoa(pmap_wired_count(map->pmap)) + grow_amount)) {
>                         PROC_UNLOCK(p);
>                         vm_map_unlock_read(map);
>                         rv = KERN_NO_SPACE;
> @@ -3645,7 +3643,7 @@ out:
>                 KASSERT(error == 0, ("decreasing RACCT_VMEM failed"));
>                 if (!old_mlock) {
>                         error = racct_set(p, RACCT_MEMLOCK,
> -                           ptoa(vmspace_wired_count(p->p_vmspace)));
> +                           ptoa(pmap_wired_count(map->pmap)));
>                         KASSERT(error == 0, ("decreasing RACCT_MEMLOCK failed"));
>                 }
>                 error = racct_set(p, RACCT_STACK, ctob(vm->vm_ssize));
>

Hi,
although vm_fault_hold() is the only caller of vm_map_growstack()
and it passes curproc as a process argument, this is a public function
and more callers can grow theoretically with !curproc. For the reason,
shouldn't vmspace be used with vmspace_acquire_ref()/vmspace_free() ?
Just nitpicking..

-- 
wbr,
pluknet


More information about the svn-src-all mailing list