Re: [PATCH v3 1/1] kthread: allocate kthread structure using kmalloc

2016-10-27 Thread Oleg Nesterov
On 10/26, Josh Poimboeuf wrote: > > On Wed, Oct 26, 2016 at 04:14:00PM +0200, Oleg Nesterov wrote: > > +/* > > + * TODO: kill it and use to_kthread(). But we still need the users > > + * like kthread_stop() which has to sync with the exiting kthread. > > + */ > > static struct kthread *to_live_kth

Re: [PATCH v3 1/1] kthread: allocate kthread structure using kmalloc

2016-10-26 Thread Josh Poimboeuf
On Wed, Oct 26, 2016 at 04:14:00PM +0200, Oleg Nesterov wrote: > +/* > + * TODO: kill it and use to_kthread(). But we still need the users > + * like kthread_stop() which has to sync with the exiting kthread. > + */ > static struct kthread *to_live_kthread(struct task_struct *k) Now that the kthr

Re: [PATCH v3 1/1] kthread: allocate kthread structure using kmalloc

2016-10-26 Thread Thomas Gleixner
On Wed, 26 Oct 2016, Oleg Nesterov wrote: > 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

Re: [PATCH v3 1/1] kthread: allocate kthread structure using kmalloc

2016-10-26 Thread Oleg Nesterov
Damn. sorry for noise, this doesn't really matter, but ... On 10/26, Oleg Nesterov wrote: > > Yes, it needs cleanups and > only because of kthread on stack. What I actually tried to say is "NOT only because of kthread on stack". Oleg.

Re: [PATCH v3 1/1] kthread: allocate kthread structure using kmalloc

2016-10-26 Thread Oleg Nesterov
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

Re: [PATCH v3 1/1] kthread: allocate kthread structure using kmalloc

2016-10-26 Thread Thomas Gleixner
On Wed, 26 Oct 2016, Oleg Nesterov wrote: > Some notes right now. Of course, with this patch we are ready to remove > put_task_stack() from kthread.c right now. The next change should kill > to_live_kthread() altogether. And stop using ->vfork_done. > > And. With this patch we do not need another

Re: [PATCH v3 1/1] kthread: allocate kthread structure using kmalloc

2016-10-26 Thread Oleg Nesterov
On 10/25, Andy Lutomirski wrote: > > Would it perhaps make sense to do something like Roman's patch for 4.9 > and then consider further changes down the road? OK, lets make it kmalloc'ed. Please see my old patch below, slightly changed. I'll send it after I do some testing and write the changelog

Re: [PATCH v3 1/1] kthread: allocate kthread structure using kmalloc

2016-10-25 Thread Andy Lutomirski
On Tue, Oct 25, 2016 at 8:43 AM, Oleg Nesterov wrote: > On 10/25, Oleg Nesterov wrote: >> >> On 10/25, Roman Pen wrote: >> > >> > This patch avoids allocation of kthread structure on a stack, and simply >> > uses kmalloc. >> >> Oh. I didn't even read this patch, but I have to admit I personally do

Re: [PATCH v3 1/1] kthread: allocate kthread structure using kmalloc

2016-10-25 Thread Oleg Nesterov
Roman, I need to run away, just one note. On 10/25, Roman Penyaev wrote: > > On Tue, Oct 25, 2016 at 5:43 PM, Oleg Nesterov wrote: > > So in particular I do not understand this comment from the patch above > where you abuse 'current->set_child_tid': > > * This is the ugly but simple hack we will

Re: [PATCH v3 1/1] kthread: allocate kthread structure using kmalloc

2016-10-25 Thread Roman Penyaev
On Tue, Oct 25, 2016 at 5:43 PM, Oleg Nesterov wrote: > On 10/25, Oleg Nesterov wrote: >> >> On 10/25, Roman Pen wrote: >> > >> > This patch avoids allocation of kthread structure on a stack, and simply >> > uses kmalloc. >> >> Oh. I didn't even read this patch, but I have to admit I personally do

Re: [PATCH v3 1/1] kthread: allocate kthread structure using kmalloc

2016-10-25 Thread Roman Penyaev
On Tue, Oct 25, 2016 at 4:03 PM, Oleg Nesterov wrote: > On 10/25, Roman Pen wrote: >> >> This patch avoids allocation of kthread structure on a stack, and simply >> uses kmalloc. > > Oh. I didn't even read this patch, but I have to admit I personally do not > like it. I can be wrong, but imo this

Re: [PATCH v3 1/1] kthread: allocate kthread structure using kmalloc

2016-10-25 Thread Oleg Nesterov
On 10/25, Oleg Nesterov wrote: > > On 10/25, Roman Pen wrote: > > > > This patch avoids allocation of kthread structure on a stack, and simply > > uses kmalloc. > > Oh. I didn't even read this patch, but I have to admit I personally do not > like it. I can be wrong, but imo this is the step to the

Re: [PATCH v3 1/1] kthread: allocate kthread structure using kmalloc

2016-10-25 Thread Oleg Nesterov
On 10/25, Roman Pen wrote: > > This patch avoids allocation of kthread structure on a stack, and simply > uses kmalloc. Oh. I didn't even read this patch, but I have to admit I personally do not like it. I can be wrong, but imo this is the step to the wrong direction. struct kthread is already bl

[PATCH v3 1/1] kthread: allocate kthread structure using kmalloc

2016-10-25 Thread Roman Pen
This patch avoids allocation of kthread structure on a stack, and simply uses kmalloc. Allocation on a stack became a huge problem (with memory corruption and all other not nice consequences) after the following commit 2deb4be28077 ("x86/dumpstack: When OOPSing, rewind the stack before do_exit()")