Subject: Re: Further works on yamt-idlelwp
To: Andrew Doran <ad@netbsd.org>
From: David Laight <david@l8s.co.uk>
List: tech-kern
Date: 03/06/2007 18:34:46
On Tue, Mar 06, 2007 at 04:51:20PM +0000, Andrew Doran wrote:
> On Mon, Mar 05, 2007 at 10:21:13AM -0800, Jason Thorpe wrote:
> 
> > On Mar 5, 2007, at 7:06 AM, Daniel Sieger wrote:
> > 
> > >cpu_sd_data for struct cpu_data
> > >p_sd_data for struct proc
> > >l_sd_data for struct lwp
> > 
> > Why not use the specificdata API?
> 
> Is it appropriate here? Every kernel has to be built with a scheduler.
> 
> The problem I originally saw was that it requires grabbing a lock each
> time a reference is required. For something like the scheduler that's
> too expensive, but now I notice that there is an unlocked method. Hrm.

I was wondering whether the lwp structure could contain a small area
that the scheduler could use for 'private data'. If the area wan't large
enough then the scheduler would either have to dynamically allocate the
extra fields, or the descision would be made to change the kernel
structure.

You could have (in struct lwp):
	void	*lwp_sched_private[4];

the scheduler itself would have (say 'struct sched_rt_lwp_info', and could
have the compile-time verification:

typedef char check_lwp_info[ sizeof (struct sched_rt_lwp_info) <=
	sizeof ((lwp_t *)0)->lwp_sched_private ? 1 : -1];

	David

-- 
David Laight: david@l8s.co.uk