Results 1 to 4 of 4
So I've edited SLOB to use the best-fit algorithm, both when finding a suitable page and a suitable block. But the question is, how do I test it? Should I ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
- 04-20-2013 #1Just Joined!
- Join Date
- Apr 2013
- Posts
- 2
How do I test SLOB? Really need help!
So I've edited SLOB to use the best-fit algorithm, both when finding a suitable page and a suitable block. But the question is, how do I test it? Should I just write user-level code that continuously does malloc? Or should I create a module that does a few kmallocs?
By the way, I've inserted a static unsigned int counter, that after 6000 calls of slob_alloc (the function that finds the suitable page to handle the request), prints the requested size, the available blocks on the page, and the block that's the best fit. But I get nothing printed with dmesg.
Your replies will be greatly appreciated!Last edited by markloop; 04-20-2013 at 01:13 PM.
- 04-20-2013 #2Linux Guru
- Join Date
- Apr 2009
- Location
- I can be found either 40 miles west of Chicago, or in a galaxy far, far away.
- Posts
- 10,232
Without looking at your code, there isn't much to tell you. Are you sure your code is getting called?
Sometimes, real fast is almost as good as real time.
Just remember, Semper Gumbi - always be flexible!
- 04-20-2013 #3Just Joined!
- Join Date
- Apr 2013
- Posts
- 2
My code is slob.c, edited to use the best-fit algorithm. I told the .config file specifically to use SLOB, then I compiled the kernel. So isn't my code supposed to be called whenever an allocation is asked for?
- 05-11-2013 #4Linux Guru
- Join Date
- Apr 2009
- Location
- I can be found either 40 miles west of Chicago, or in a galaxy far, far away.
- Posts
- 10,232
It is not called when malloc() is, only when sbrk() is called. It is sbrk() that allocates system memory to the process, and malloc() only uses that chunk. FWIW, malloc()/calloc()/realloc()/free() are all user-space functions. Only sbrk() will hit the kernel.
Sometimes, real fast is almost as good as real time.
Just remember, Semper Gumbi - always be flexible!


Reply With Quote
