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



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.

This is not related to the question above, but I could change the
previous proc_find call in the code to a call to proc_find_raw, which
will prevent us from searching the proc list twice, but it will involve
more changes in the code.


Home | Main Index | Thread Index | Old Index