Re: [PATCH] kthreads: kill CLONE_KERNEL, change kernel_thread(kernel_init) to avoid CLONE_SIGHAND

From: Sasha Levin
Date: Mon May 19 2014 - 11:22:20 EST


On 05/16/2014 11:35 AM, Oleg Nesterov wrote:
> On 05/16, Sasha Levin wrote:
>>
>> On 04/13/2014 03:56 PM, Oleg Nesterov wrote:
>>> 1. Remove CLONE_KERNEL, it has no users and it is dangerous.
>>>
>>> The (old) comment says "List of flags we want to share for kernel
>>> threads" but this is not true, we do not want to share ->sighand by
>>> default. This flag can only be used if the caller is sure that both
>>> parent/child will never play with signals (say, allow_signal/etc).
>>>
>>> 2. Change rest_init() to clone kernel_init() without CLONE_SIGHAND.
>>>
>>> In this case CLONE_SIGHAND does not really hurt, and it looks like
>>> optimization because copy_sighand() can avoid kmem_cache_alloc().
>>>
>>> But in fact this only adds the minor pessimization. kernel_init()
>>> is going to exec the init process, and de_thread() will need to
>>> unshare ->sighand and do kmem_cache_alloc(sighand_cachep) anyway,
>>> but it needs to do more work and take tasklist_lock and siglock.
>>>
>>> Signed-off-by: Oleg Nesterov <oleg@xxxxxxxxxx>
>>
>> Hi Oleg,
>>
>> This patch triggers a hang during boot in my KVM guest.
>
> Hmm... How??? ;)

I'm afraid this is just bisection gone bad. The real issue was the
new goldfish code added, and not this patch.

Since apparently the boot issue was probabilistic I ended up blaming
this commit by mistake. Sorry about that.


Thanks,
Sasha
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/