patch-ikd+profile+stack-meter against 109

Andrea Arcangeli (arcangeli@mbox.queen.it)
Sat, 18 Jul 1998 00:36:07 +0200 (CEST)


I developed a new feature in the patch ikd that should tell us precisely
how much kernel stack we need in order to run the kernel (and how much my
per interrupt stack helps once I' ll have implemented it (I had to learn
how to map a page read only first ;-)).

Since I was there I uported the patch-ikd to 2.1.109 and I take 1 hour to
understand that the problem with gcc profiling was the FASTCALL of
__switch_to(). With gcc profiling it seems that gcc generate bad code with
the regparam attribute so FASTCALL() has to be disabled. So switch_to()
has to use the stack to pass parameters to __switch_to() and then I freed
that parameters using the gcc stdcall attribute. I got a very happy
evening (happy because at the end all worked fine ;-).

Returning to the stack-meter, everybody that like to test how much kernel
stack needs its kernel can apply the ikd-patch and enable kernel-debugging
-> kernel-debugging -> kernel-stack-meter.

Then you will see the minimum stack left running:

cat /proc/sys/debug/kstack-meter

and you can reinitialize it:

echo -1 0 >/proc/sys/debug/kstack-meter

The sysctl give you also a second integer that is the eip of the function
that was running with the most used stack. This is not 100% reliable since
there could be 8 interrupt running and the 9th could alloc only 1 byte and
be accounted as the most stack eater.

To hard test this patch you must generate most of IRQ you can at the same
time. Something like:

cp /dev/zero /dev/lp0 &
cp /dev/dsp /dev/null &
ping -f otherhost &
cp -a linux/ linux.1/

etc..etc...

It would be nice to see numbers (I suspect that the scsi code is a good
stack eater at least for my experience ;-).

ftp://e-mind.com/pub/linux/kernel-patches/patch-ikd-arca-2.1.109-1.diff.gz

(BTW what does it mean ikd? Kernel Debugging is clear, but the "i" ?)

Andrea[s] Arcangeli

PS. With a bit of test I got not able to eat more than 2kbyte of stack on
my hardware (not very very stressed though). BTW, the task struct at
the low part of the stack is considered in the calc of the free left
stack. So if you see 5kbyte of free stack it means that the kernel
is using only 3/4kbyte of stack really.

-
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.altern.org/andrebalsa/doc/lkml-faq.html