Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1499305

Re: [RFC 0/6] Module for tracking/accounting shared memory buffers

Path csiph.com!aioe.org!bofh.it!news.nic.it!robomod
From Al Viro <viro@ZenIV.linux.org.uk>
Newsgroups linux.kernel
Subject Re: [RFC 0/6] Module for tracking/accounting shared memory buffers
Date Wed, 12 Oct 2016 02:50:01 +0200
Message-ID <srfU5-5mL-1@gated-at.bofh.it> (permalink)
References <srf7H-4Py-7@gated-at.bofh.it>
MIME-Version 1.0
Content-Type text/plain; charset=us-ascii
Content-Disposition inline
User-Agent Mutt/1.7.0 (2016-08-17)
Sender robomod@news.nic.it
List-ID <linux-kernel.vger.kernel.org>
X-Mailing-List linux-kernel@vger.kernel.org
Approved robomod@news.nic.it
Lines 34
Organization linux.* mail to news gateway
X-Original-Cc gregkh@linuxfoundation.org, arve@android.com, riandrews@android.com, sumit.semwal@linaro.org, arnd@arndb.de, labbott@redhat.com, jlayton@poochiereds.net, bfields@fieldses.org, mingo@redhat.com, peterz@infradead.org, akpm@linux-foundation.org, keescook@chromium.org, mhocko@suse.com, oleg@redhat.com, john.stultz@linaro.org, mguzik@redhat.com, jdanis@google.com, adobriyan@gmail.com, ghackmann@google.com, kirill.shutemov@linux.intel.com, vbabka@suse.cz, dave.hansen@linux.intel.com, dan.j.williams@intel.com, hannes@cmpxchg.org, iamjoonsoo.kim@lge.com, luto@kernel.org, tj@kernel.org, vdavydov.dev@gmail.com, ebiederm@xmission.com, linux-kernel@vger.kernel.org, devel@driverdev.osuosl.org, linux-media@vger.kernel.org, dri-devel@lists.freedesktop.org, linaro-mm-sig@lists.linaro.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org
X-Original-Date Wed, 12 Oct 2016 01:26:34 +0100
X-Original-Message-ID <20161012002634.GN19539@ZenIV.linux.org.uk>
X-Original-References <1476229810-26570-1-git-send-email-kandoiruchi@google.com>
X-Original-Sender linux-kernel-owner@vger.kernel.org
Xref csiph.com linux.kernel:1499305

Show key headers only | View raw


On Tue, Oct 11, 2016 at 04:50:04PM -0700, Ruchi Kandoi wrote:

> memtrack maintains a per-process list of shared buffer references, which is
> exported to userspace as /proc/[pid]/memtrack.  Buffers can be optionally
> "tagged" with a short string: for example, Android userspace would use this
> tag to identify whether buffers were allocated on behalf of the camera stack,
> GL, etc.  memtrack also exports the VMAs associated with these buffers so
> that pages already included in the process's mm counters aren't double-counted.
> 
> Shared-buffer allocators can hook into memtrack by embedding
> struct memtrack_buffer in their buffer metadata, calling
> memtrack_buffer_{init,remove} at buffer allocation and free time, and
> memtrack_buffer_{install,uninstall} when a userspace process takes or
> drops a reference to the buffer.  For fd-backed buffers like dma-bufs, hooks in
> fdtable.c and fork.c automatically notify memtrack when references are added or
> removed from a process's fd table.
> 
> This patchstack adds memtrack hooks into dma-buf and ion.  If there's upstream
> interest in memtrack, it can be extended to other memory allocators as well,
> such as GEM implementations.

No, with a side of Hell, No.  Not to mention anything else,
	* descriptor tables do not belong to any specific task_struct and
actions done by one show up in all who share that thing.
	* shared descriptor table does not imply belonging to the same
group.
	* shared descriptor table can become unshared at any point, invisibly
for that Fine Piece Of Software.
	* while we are at it, blocking allocation under several spinlocks
(and with interrupts disabled, for good measure) is generally considered
a bloody bad idea.

That - just from the quick look through that patchset.  Bringing task_struct
into the API is already sufficient for a NAK.

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[RFC 0/6] Module for tracking/accounting shared memory buffers Ruchi Kandoi <kandoiruchi@google.com> - 2016-10-12 02:00 +0200
  [RFC 1/6] fs: add installed and uninstalled file_operations Ruchi Kandoi <kandoiruchi@google.com> - 2016-10-12 02:00 +0200
  [RFC 4/6] memtrack: Adds the accounting to keep track of all mmaped/unmapped pages. Ruchi Kandoi <kandoiruchi@google.com> - 2016-10-12 02:00 +0200
  [RFC 5/6] memtrack: Add memtrack accounting for forked processes. Ruchi Kandoi <kandoiruchi@google.com> - 2016-10-12 02:00 +0200
  [RFC 6/6] drivers: staging: ion: add ION_IOC_TAG ioctl Ruchi Kandoi <kandoiruchi@google.com> - 2016-10-12 02:00 +0200
    Re: [RFC 6/6] drivers: staging: ion: add ION_IOC_TAG ioctl "Hillf Danton" <hillf.zj@alibaba-inc.com> - 2016-10-12 05:40 +0200
  [RFC 2/6] drivers: misc: add memtrack Ruchi Kandoi <kandoiruchi@google.com> - 2016-10-12 02:00 +0200
  Re: [RFC 0/6] Module for tracking/accounting shared memory buffers Al Viro <viro@ZenIV.linux.org.uk> - 2016-10-12 02:50 +0200
  Re: [RFC 0/6] Module for tracking/accounting shared memory buffers Rob Clark <robdclark@gmail.com> - 2016-10-12 03:20 +0200
  Re: [RFC 0/6] Module for tracking/accounting shared memory buffers Dave Hansen <dave.hansen@linux.intel.com> - 2016-10-12 19:30 +0200

csiph-web