Bernd Petrovitsch schrieb:
On Tue, 2005-09-06 at 16:50 +0530, Sabarinathan wrote:
[...]
can anyone tell me how to assert in kernel space ?
Use BUG_ON().
Bernd
Hello!
If you want the tests to stay in the production code, you may want to
use the likely() and unlikely() macros. These macros instruct the
compiler to reorder code that way, that the more likely path will be
optimised. So if you check for an error condition that is very unlikely,
you do so with unlikely(), and your branch cost for the default case
will be lower on architectures and compilers that support this behaviour.
It was recently discussed on this list, you may want to look at
August/September archives.
With kind regards,
Oliver Korpilla
--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive: http://mail.nl.linux.org/kernelnewbies/
FAQ: http://kernelnewbies.org/faq/