From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752127AbdJFLyl (ORCPT ); Fri, 6 Oct 2017 07:54:41 -0400 Received: from mga05.intel.com ([192.55.52.43]:53760 "EHLO mga05.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751875AbdJFLyk (ORCPT ); Fri, 6 Oct 2017 07:54:40 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.42,483,1500966000"; d="scan'208";a="907410064" From: Alexander Shishkin To: Peter Zijlstra Cc: Ingo Molnar , linux-kernel@vger.kernel.org, acme@redhat.com, kirill.shutemov@linux.intel.com, Borislav Petkov , rric@kernel.org Subject: Re: [RFC PATCH 09/17] perf: Use shmemfs pages for userspace-only per-thread detached events In-Reply-To: <20171003144335.jqsraoqn2zskv2xd@hirez.programming.kicks-ass.net> References: <20170905133026.13689-1-alexander.shishkin@linux.intel.com> <20170905133026.13689-10-alexander.shishkin@linux.intel.com> <20171003144335.jqsraoqn2zskv2xd@hirez.programming.kicks-ass.net> User-Agent: Notmuch/0.23.7 (http://notmuchmail.org) Emacs/25.1.1 (x86_64-pc-linux-gnu) Date: Fri, 06 Oct 2017 14:52:26 +0300 Message-ID: <87lgkotrwl.fsf@ashishki-desk.ger.corp.intel.com> MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Peter Zijlstra writes: > On Tue, Sep 05, 2017 at 04:30:18PM +0300, Alexander Shishkin wrote: >> In order to work around the problem of using up mlocked memory for the >> detached events, we can pin the ring buffer pages only while they are >> in use (that is, the event is ACTIVE), and unpin them for the rest of >> the time. When not pinned in, these pages can be swapped out. This way, >> one user can have at most mlock_limit*nr_cpus kB of memory pinned at >> any given moment, however many events they actually have. >> >> This enforces a constraint: pinning and unpinning may sleep and thus >> can't be done in the event scheduling path. Instead, we use a task >> work to do this, which this pattern us to userspace-only events. >> Also, since one userspace thread only needs one buffer (for whatever >> CPU it's running on at any given moment), we only do this for per-thread >> events. >> >> The source for such swappable pages is shmemfs. This patch allows >> allocating perf ring buffer pages from an shmemfs file if the above >> constraints are met. > > Right, so why still allow that previous icky thing? What cases do we > need that for? 8/17..12/17 are really one patch split into smaller chunks. The first one does the icky thing and then we get to what we actually want. The idea is that you won't be able to enable inheritance for detached events unless they are shmem-backed. Regards, -- Alex