From mboxrd@z Thu Jan 1 00:00:00 1970 From: Oleg Nesterov Subject: Re: [RFC PATCH 10/14] ring_buffer: Fix more races when terminating the producer in the benchmark Date: Mon, 7 Sep 2015 19:49:14 +0200 Message-ID: <20150907174914.GA2148@redhat.com> References: <1438094371-8326-1-git-send-email-pmladek@suse.com> <1438094371-8326-11-git-send-email-pmladek@suse.com> <20150803143323.426ea2fc@gandalf.local.home> <20150904093856.GI22739@pathway.suse.cz> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Content-Disposition: inline In-Reply-To: <20150904093856.GI22739-KsEp0d+Q8qECVLCxKZUutA@public.gmane.org> Sender: linux-api-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org To: Petr Mladek Cc: Steven Rostedt , Andrew Morton , Tejun Heo , Ingo Molnar , Peter Zijlstra , "Paul E. McKenney" , Josh Triplett , Thomas Gleixner , Linus Torvalds , Jiri Kosina , Borislav Petkov , Michal Hocko , linux-mm-Bw31MaZKKs3YtjvyW6yDsg@public.gmane.org, Vlastimil Babka , live-patching-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-api-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org List-Id: linux-api@vger.kernel.org Sorry, I didn't read these emails, and I never looked at this code... Can't understand what are you talking about but a minor nit anyway ;) On 09/04, Petr Mladek wrote: > > + __set_current_state(TASK_RUNNING); > if (!kthread_should_stop()) > wait_to_die(); I bet this wait_to_die() can die, consumer/producer can simply exit. Just you need get_task_struct() after kthread_create(), and put_task_struct() after kthread_stop(). Oleg.