Subject: Removing p_nras from struct proc
To: None <tech-kern@netbsd.org>
From: David Laight <david@l8s.co.uk>
List: tech-kern
Date: 11/04/2003 08:22:41
A quick look at the ras code shows that the p_nras (of struct proc) is a
pointless field.  Nothing actually needs to know the number of items on
p_raslist.  All the checks for (p->p_nras [!]= 0) can be replaced by
([!]ISEMPTY(&p->p_raslist)) which is an equivalent test [1].

The overlap check in ras_install is also over-complicated:

	nras = 0;
	LIST_FOREACH(rp, &p->p_raslist, ras_list) {
		if (++nras >= ras_per_proc ||
		    (addr < rp->ras_endaddr && endaddr > rp->ras_startaddr)) {
			simple_unlock(&p->p_raslock);
			return (EINVAL);
		}
	}

Is adequate here.

I also see no reason to have both p_lwplock and p_raslock, and propose
replacing both with a single p_lock.

	David

[1] including all the .S files that use NRAS (some need to use a 64bit test).

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