Why use `thread' as an argument of Syscalls?

Robert Watson rwatson at FreeBSD.org
Mon Jun 5 10:22:19 PDT 2006


On Mon, 5 Jun 2006, Poul-Henning Kamp wrote:

> In message <200606051700.k55H0OeJ092393 at chez.mckusick.com>, Kirk McKusick write
> s:
>
>> Your above analysis is correct. When we made the pass over the code base to 
>> eliminate all references to "u." we had also hoped to get rid of all 
>> references to "curproc". While we were successful with the former, it 
>> eventually became clear that the latter was not practical. But by that 
>> time, the convention of passing the current process pointer to Syscall was 
>> established, and removing it did not seem to be worth the effort.
>
> It would be a good Junior Kernel Hacker project to try to replace these 
> passed arguments with curproc and see if a measurable difference in 
> performance is obtained.

Caution should be applied, however: not all threads passed into functions are 
necessarily curthread, nor all processes curproc.  It's the obscure edge 
places that kill you :-).

Robert N M Watson


More information about the freebsd-arch mailing list