tech-kern archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: Syscall kill(2) called for a zombie process should return 0
On 18/07/2012 12:53, Roger Pau Monne wrote:
> Roy Marples wrote:
>> On 18/07/2012 11:46, Roger Pau Monne wrote:
>>> Please review the attached patch.
>>
>> + if (p != NULL && P_ZOMBIE(p)) {
>> + mutex_exit(proc_lock);
>> + return 0;
>> + }
>> mutex_exit(proc_lock);
>> return ESRCH;
>>
>> This is a general question, not necessarily specific to the patch.
>> Which is more costly? Two function calls as above, or storing the return
>> value in a variable to return with just one function call to mutex_exit?
>
> I don't know if I've understood the question well, but you only make one
> function call, you either call mutex_exit inside of the if, or the one
> outside, but you never make two calls to mutex_exit.
Sure, the code path will only execute one, but coding it one way may be
more efficient for binary size and a few CPU cycles (and I don't know
the answer to it, hence asking). The reason why I asked is mainly
because I favour the store the variable and have one function call where
possible.
Thanks
Roy
Home |
Main Index |
Thread Index |
Old Index