On Fri, 2005-03-25 at 17:29 -0500, linux-os wrote: > Isn't it expensive of CPU time to call kfree() even though the > pointer may have already been freed?
nope a call instruction is effectively half a cycle or less, the branch predictor of the cpu can predict perfectly where the next instruction is from. The extra if() you do in front is a different matter, that can easily cost 100 cycles+. (And those are redundant cycles because kfree will do the if again anyway). So what you propose is to spend 100+ cycles to save half a cycle. Not a good tradeoff ;) - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/