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. From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-qg0-f47.google.com (mail-qg0-f47.google.com [209.85.192.47]) by kanga.kvack.org (Postfix) with ESMTP id E75DF6B0038 for ; Mon, 7 Sep 2015 13:52:03 -0400 (EDT) Received: by qgev79 with SMTP id v79so66131074qge.0 for ; Mon, 07 Sep 2015 10:52:03 -0700 (PDT) Received: from mx1.redhat.com (mx1.redhat.com. [209.132.183.28]) by mx.google.com with ESMTPS id 143si593615qhy.11.2015.09.07.10.52.02 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 07 Sep 2015 10:52:02 -0700 (PDT) Date: Mon, 7 Sep 2015 19:49:14 +0200 From: Oleg Nesterov Subject: Re: [RFC PATCH 10/14] ring_buffer: Fix more races when terminating the producer in the benchmark 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 Content-Disposition: inline In-Reply-To: <20150904093856.GI22739@pathway.suse.cz> Sender: owner-linux-mm@kvack.org List-ID: 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@kvack.org, Vlastimil Babka , live-patching@vger.kernel.org, linux-api@vger.kernel.org, linux-kernel@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. -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: email@kvack.org From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754061AbbIGRwH (ORCPT ); Mon, 7 Sep 2015 13:52:07 -0400 Received: from mx1.redhat.com ([209.132.183.28]:34510 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753999AbbIGRwB (ORCPT ); Mon, 7 Sep 2015 13:52:01 -0400 Date: Mon, 7 Sep 2015 19:49:14 +0200 From: Oleg Nesterov 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@kvack.org, Vlastimil Babka , live-patching@vger.kernel.org, linux-api@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [RFC PATCH 10/14] ring_buffer: Fix more races when terminating the producer in the benchmark 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 Content-Disposition: inline In-Reply-To: <20150904093856.GI22739@pathway.suse.cz> User-Agent: Mutt/1.5.18 (2008-05-17) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@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.