Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933640AbcJZPxi (ORCPT ); Wed, 26 Oct 2016 11:53:38 -0400 Received: from mx1.redhat.com ([209.132.183.28]:47412 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933547AbcJZPxb (ORCPT ); Wed, 26 Oct 2016 11:53:31 -0400 Date: Wed, 26 Oct 2016 17:51:56 +0200 From: Oleg Nesterov To: Thomas Gleixner Cc: Andy Lutomirski , Roman Pen , Andy Lutomirski , Peter Zijlstra , Ingo Molnar , Tejun Heo , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH v3 1/1] kthread: allocate kthread structure using kmalloc Message-ID: <20161026155155.GA28832@redhat.com> References: <20161025110508.9052-1-roman.penyaev@profitbricks.com> <20161025140333.GB4326@redhat.com> <20161025154301.GA12015@redhat.com> <20161026141359.GA6893@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.18 (2008-05-17) X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Wed, 26 Oct 2016 15:53:31 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 747 Lines: 23 On 10/26, Thomas Gleixner wrote: > > On Wed, 26 Oct 2016, Oleg Nesterov wrote: > > +static inline void set_kthread_struct(void *kthread) > > +{ > > + /* > > + * We abuse ->set_child_tid to avoid the new member and because it > > + * can't be wrongly copied by copy_process(). We also rely on fact > > + * that the caller can't exec, so PF_KTHREAD can't be cleared. > > + */ > > + current->set_child_tid = (__force void __user *)kthread; > > Can we pretty please avoid this type casting? We only have 5 places using > set_child_tid. So we can really make it a proper union Yes, I thought about anonymous union too, the only problem is that it will need more comments ;) And I agree with other nits, will redo/resend tomorrow. Thanks! Oleg.