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 Wed, Jul 18, 2012 at 12:37:58PM +0100, 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;

First for the patch: I would add a __predict_false() around the surrounding
if (p == NULL).

> 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?

The compiler might even generate the same code for both variants, so I
would use whatever is more readable for the human reader.

Martin


Home | Main Index | Thread Index | Old Index