From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S966224AbcIZJED (ORCPT ); Mon, 26 Sep 2016 05:04:03 -0400 Received: from merlin.infradead.org ([205.233.59.134]:34494 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965343AbcIZJEB (ORCPT ); Mon, 26 Sep 2016 05:04:01 -0400 Date: Mon, 26 Sep 2016 11:03:54 +0200 From: Peter Zijlstra To: Alexander Shishkin Cc: Andi Kleen , Ingo Molnar , linux-kernel@vger.kernel.org, vince@deater.net, eranian@google.com, Arnaldo Carvalho de Melo , tglx@linutronix.de Subject: Re: [RFC PATCH 1/6] perf: Move mlock accounting to ring buffer allocation Message-ID: <20160926090354.GK5012@twins.programming.kicks-ass.net> References: <20160923112726.5890-1-alexander.shishkin@linux.intel.com> <20160923112726.5890-2-alexander.shishkin@linux.intel.com> <20160923121403.GC5012@twins.programming.kicks-ass.net> <20160923172615.GU3078@tassilo.jf.intel.com> <20160923202830.GQ5008@twins.programming.kicks-ass.net> <878tufrrqb.fsf@ashishki-desk.ger.corp.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <878tufrrqb.fsf@ashishki-desk.ger.corp.intel.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 On Mon, Sep 26, 2016 at 11:27:08AM +0300, Alexander Shishkin wrote: > Peter Zijlstra writes: > > > Well, we could 'force' inject a VMA into the process's address space, we > > do that for a few other things as well. It also makes for less > > exceptions with the actual core dumping. > > Threads then will end up with the same buffer (through sharing the mm), > but they can't really share trace buffers. > > Also, system core dump is still a problem. Hurm, true on both counts. > > But the worry I have is the total amount of pinned memory. If you want > > to inherit this on fork(), as is a reasonable expectation, then its > > possible to quickly exceed the total amount of pinnable memory. > > > > At which point we _should_ start failing fork(), which is a somewhat > > unexpected, and undesirable side-effect. > > I'm not sure I see why we should fail fork() when we run out of pinned > memory. Well, we cannot fully honour the inherit, what other option do we have? Silently malfunctioning? That's far worse. > > Ideally we'd unpin the old buffers and repin the new buffers on context > > switch, but that's impossible since faulting needs scheduling, > > recursion, we loose. > > Or we can have per-cpu buffers for all user's tasks, record where each > task starts and ends in each buffer and cut out only bits relevant to > the task(s) that dump core. Which gets you the problem that when a task dumps core there might not be any state in the buffer, because the previous task flushed it all out :/