Re: sparc64 kernel code question..

From: Brian Fundakowski Feldman <green_at_FreeBSD.ORG>
Date: Sun, 09 May 2004 19:58:06 -0400
RJulian Elischer <julian_at_elischer.org> wrote:
> 
> in vm_machdep.c the sparc64  code has
> void
> cpu_sched_exit(struct thread *td)
> {
>         struct vmspace *vm;
>         struct pcpu *pc;
>         struct proc *p;
> 
>         mtx_assert(&sched_lock, MA_OWNED);
>  
>         p = td->td_proc;
>         vm = p->p_vmspace;
>         if (vm->vm_refcnt > 1)
>                 return;
>         SLIST_FOREACH(pc, &cpuhead, pc_allcpu) {
>                 if (pc->pc_vmspace == vm) {
>                         vm->vm_pmap.pm_active &= ~pc->pc_cpumask;
>                         vm->vm_pmap.pm_context[pc->pc_cpuid] = -1;
>                         pc->pc_vmspace = NULL;
>                 }
>         }
> }
> 
> 
> 
> This is thw only architecture that has this..
> What does it do? And what does it have to do with the scheduler?

It would appear to detach the vmspace in question from other executing CPUs. 
This makes no sense -- how would other CPUs be executing on that vmspace if 
it's already single-threaded at that point (also, single-threaded in the 
rfork(2) sense because of the vm_refcnt check)?

-- 
Brian Fundakowski Feldman                           \'[ FreeBSD ]''''''''''\
  <> green_at_FreeBSD.org                               \  The Power to Serve! \
 Opinions expressed are my own.                       \,,,,,,,,,,,,,,,,,,,,,,\
Received on Sun May 09 2004 - 14:58:09 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:37:53 UTC