svn commit: r245255 - head/sys/vm

Konstantin Belousov kostikbel at gmail.com
Thu Jan 10 18:18:25 UTC 2013


On Thu, Jan 10, 2013 at 05:03:31PM +0300, Sergey Kandaurov wrote:
> 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..
> 
No, vm_map_growstack() is not a public interface. It is indeed exposed,
but this is due to the lack of the formal KBI and KPI definitions, and
not by intent.

Adding vmspace reference there is pointless, it adds two atomics for the
path for no use.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 834 bytes
Desc: not available
URL: <http://lists.freebsd.org/pipermail/svn-src-head/attachments/20130110/223c0ecb/attachment.sig>


More information about the svn-src-head mailing list