Re: kernel-hacking-HOWTO: An lk primer seeks feedback

Neil Brown (neilb@cse.unsw.edu.au)
Thu, 23 Sep 1999 12:42:20 +1000 (EST)


On Sunday September 19, Paul.Russell@rustcorp.com.au wrote:
> Hi all,
>
> `This document describes the common routines, locking systems
> and general requirements for kernel code: its goal is to serve as a
> primer for Linux kernel development.'
>
> I won't expand this into a book (it'd be unmaintainable, and hence
> useless), but additions, comments and gotchyas appreciated.
>

This was good to read. I have been thinking of writting down
something about the different sorts of locking just to make sure that I
understood it properly. Now I don't have to. :-)

A couple of comments:

1/ I find examples are good (at least, that is what people tell me I
should add to my documentation).
e.g. examples of where particular sorts of locks are used and why.
Example of an interesting ioctl. Examples comparing kmalloc use
with vmalloc.
For modules: is there a nicely written module that is fairly
small and does all the "right" and "interesting" things that
can be used as a template?

It would be useful (though probably beyond the scope of what
you were writting) is a survey of which bits of the kernel are
still under the kernel_lock, and what sorts of locks other bits
use.

2/ under Return conventions it might be good to talk about ERR_PTR
and PTR_ERR

I find that writing this sort of documentation is very useful to
check and enhance ones own understanding of the code, as well as to
find odd anachronisms in the code.
If anyone is interested, you can see my documentation on the VFS layer
and kNFSD at
http://www.cse.unsw.edu.au/~neilb/oss/linux-commentary/

NeilBrown

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/