Ken,
Don't listen to people that tell you "well don't use linked lists in rt tasks" and the like. Go ahead.. do it. Have fun.. knock yourself out. The reason your machine crashes is because kmalloc can't be used inside the RT thread. Generally you need to use kmalloc in the non-rt part of your module (in init_module(), for instance). Basically this means that you have to set up some sort of memory buffer ahead of time for all the structs you will ever need :/. So in that sense, using linked lists is kind of painful, and a bit of a memory hog, and maybe even inelegant, depending on your perspective. But, I think that linked lists also have some nice virtues in that they can be searched quickly, reordered quickly, etc. But, you know, unless you plan on getting this to run on a memory-starved machine, I personally am starting to think that just allocating like 1 MB of kernel memory in init_module() for all the structs you will ever need may not be so bad :). That is, if you think it is possible to determine how many structs you would ever need.... On Thu, 6 Dec 2001, Ken Emmons, Jr. wrote: > Hello, > > I am trying to create a doubly linked list in order to keep track of timers on my >system. It is similar to the way they do it in the Linux kernel, but obviously much >faster polling for RT purposes. Certain function calls in my API will allocate memory >for a structure and then call a function to isert this structure intot he list. I >tried using: > > my_struct_t my_struct; > my_struct = kmalloc( sizeof(my_struct_t), GFP_ATOMIC); > > within a periodic RT task and it appears to crash my machine. > > Is this supposed to work in RTLinux?? If not how do I get free memory?? Do I have to >set aside a free block of ram and create my own memory allocation algorithms?? Does >RTLinux have a preferred mechanism? > > Thanks, > > ~Ken > > -- [rtl] --- > To unsubscribe: > echo "unsubscribe rtl" | mail [EMAIL PROTECTED] OR > echo "unsubscribe rtl <Your_email>" | mail [EMAIL PROTECTED] > -- > For more information on Real-Time Linux see: > http://www.rtlinux.org/ > -- [rtl] --- To unsubscribe: echo "unsubscribe rtl" | mail [EMAIL PROTECTED] OR echo "unsubscribe rtl <Your_email>" | mail [EMAIL PROTECTED] -- For more information on Real-Time Linux see: http://www.rtlinux.org/