Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933508AbcJZJDk (ORCPT ); Wed, 26 Oct 2016 05:03:40 -0400 Received: from merlin.infradead.org ([205.233.59.134]:36006 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755059AbcJZJDf (ORCPT ); Wed, 26 Oct 2016 05:03:35 -0400 Date: Wed, 26 Oct 2016 11:03:32 +0200 From: Peter Zijlstra To: Oleg Nesterov Cc: "Ni, BaoleX" , "mingo@redhat.com" , "acme@kernel.org" , "linux-kernel@vger.kernel.org" , "alexander.shishkin@linux.intel.com" , "Liu, Chuansheng" Subject: Re: hit a KASan bug related to Perf during stress test Message-ID: <20161026090332.GA3102@twins.programming.kicks-ass.net> References: <20161024120231.GA16554@redhat.com> <20161024121030.GA17007@redhat.com> <20161024122210.GM3102@twins.programming.kicks-ass.net> <20161024122942.GC17007@redhat.com> <20161024123814.GP3102@twins.programming.kicks-ass.net> <20161024132555.GA18410@redhat.com> <20161024143646.GR3102@twins.programming.kicks-ass.net> <20161024153908.GA26135@redhat.com> <20161025092831.GW3102@twins.programming.kicks-ass.net> <20161025144126.GD4326@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20161025144126.GD4326@redhat.com> User-Agent: Mutt/1.5.23.1 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 720 Lines: 26 On Tue, Oct 25, 2016 at 04:41:26PM +0200, Oleg Nesterov wrote: > > > > So what serialization would close that race? __task_pid_nr_ns() only > > seems to use RCU nothing more. > > I do not see how can we close this race, we obviously do not want to use > any locking. > > That is why I tried to suggest > > nr = __task_pid_nr_ns(p, type, event->ns); > if (!nr && !is_idle_task(p)) > nr = -1; > return nr; > > but this will report -1 if p runs in another namespace, so perhaps we > can do > > nr = __task_pid_nr_ns(p, type, event->ns); > if (!nr && p->exit_state) > // it has already called exit_notify > nr = -1; > return nr; I think I'm asking how __task_pid_nr_ns() isn't susceptible to this race ;-)