Subject: Re: deadlock with sched_lock in SA code
To: None <chuq@chuq.com>
From: YAMAMOTO Takashi <yamt@mwd.biglobe.ne.jp>
List: tech-kern
Date: 09/20/2005 20:00:50
> > Maybe we could free it to a private free list, and when upcalls are  
> > allocated, we can just check the free list before calling pool_get 
> > ().  That way we could actually use the straggler.
> 
> we could, but that would need either an extra lock, or some dance with
> sched_lock if we would try to protect it with that, or some per-CPU list.
> it doesn't seem worth the complexity.

i don't think it's so complex.
holding a single sau should be enough.

in ltsleep:
	if (curcpu()->ci_data.ci_sau == NULL) {
		curcpu()->ci_data.ci_sau = sadata_upcall_alloc(0);
	}

in sa_switch:
	instead of sadata_upcall_alloc:
		sau = curcpu()->ci_data.ci_sau;
		curcpu()->ci_data.ci_sau = NULL;

	instead of sadata_upcall_free:
		curcpu()->ci_data.ci_sau = sau;

ideally, sa lwp cache can be per-cpu as well, i think.

YAMAMOTO Takashi