Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S941009AbcJXNlt (ORCPT ); Mon, 24 Oct 2016 09:41:49 -0400 Received: from mx1.redhat.com ([209.132.183.28]:45240 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S940708AbcJXNlq (ORCPT ); Mon, 24 Oct 2016 09:41:46 -0400 Date: Mon, 24 Oct 2016 15:40:13 +0200 From: Oleg Nesterov To: Peter Zijlstra 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: <20161024134012.GA20798@redhat.com> References: <318B87A793BE164187D8851D6CE09D64371C8811@shsmsx102.ccr.corp.intel.com> <20161024095341.GF3102@twins.programming.kicks-ass.net> <20161024111526.GA13509@redhat.com> <20161024112402.GI3102@twins.programming.kicks-ass.net> <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> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20161024132555.GA18410@redhat.com> 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.38]); Mon, 24 Oct 2016 13:41:45 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 778 Lines: 26 On 10/24, Oleg Nesterov wrote: > > -static u32 perf_event_pid(struct perf_event *event, struct task_struct *p) > +static u32 perf_event_xxx(struct perf_event *event, struct task_struct *p, > + enum pid_type type) > { > + pid_t nr; > /* > * only top level events have the pid namespace they were created in > */ > if (event->parent) > event = event->parent; > > - return task_tgid_nr_ns(p, event->ns); > + nr = __task_pid_nr_ns(p, type, event->ns); > + if (!nr && !is_idle_task(p)) > + nr = -1; > + return nr; And just in case... In any case __task_pid_nr_ns() and other similar helpers can also return zero if "p" runs in another namespace. Say, in the parent ns. Say, perf_event_switch_output(). What do we want to report in this case, zero or -1 ? Oleg.