Re: [PATCH] Export shmem_file_setup for DRM-GEM

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Keith Packard
Date: Sunday, August 10, 2008 - 8:03 pm

On Sun, 2008-08-10 at 21:23 -0400, Christoph Hellwig wrote:


A typical GPU-intensive application will have a few thousand objects
full of GPU-bound data containing GPU commands, vertices, textures,
rendering buffers, constants and other misc GPU state.

When rendering a typical frame, all of these objects will be referenced
in turn -- each frame is much like the last, so the process of drawing
the frame ends up using almost exactly the same data each time. It's an
animation after all.

Any kind of resource constraint places severe pressure on an eviction
policy -- the obvious 'LRU' turns out to be almost exactly wrong as you
always eject the objects which are next in line for re-use. Obviously,
the right solution is to avoid artificial resource constraints, and
minimize the impact of real constraints.

Limiting the number of objects we can have in-use at a time (by limiting
the number of open FDs) is an artificial resource constraint, forcing
re-use of closed objects to pay an extra openat cost. That may be cheap,
but it's not free.

Plus, we don't want persistent objects here -- when the application
exits, we want the objects to disappear automatically; otherwise you'll
clutter shmem with thousands of spurious files when an application
crashes. So, if we create shmem files, we'll want to unlink them
immediately, leaving only the fd in place to refer to them.

Our alternative is to open the shmem file and pass the fd into our
driver to hold onto the file while the application closes the fd.
I see that as simply a kludge to work around the absence of anonymous
pageable file allocation -- it seems like an abuse of the current API.

Perhaps we should construct a different API to allocate a pageable
object? Having shmem expose these as 'files' doesn't make a lot of sense
in this context, it just happens to be an easy way to plug them into the
vm system, as is evidenced by ipc/shm using them as well.

--=20
keith.packard@intel.com
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH] PCI: Add pci_read_base() API, Eric Anholt, (Thu Jul 31, 11:58 pm)
Re: [PATCH] Export shmem_file_setup and shmem_getpage for ..., Christoph Hellwig, (Fri Aug 1, 1:50 pm)
Re: [PATCH] Export shmem_file_setup and shmem_getpage for ..., Stephane Marchesin, (Wed Aug 6, 9:20 am)
Re: [PATCH] Export shmem_file_setup and shmem_getpage for ..., Arjan van de Ven, (Wed Aug 6, 10:24 am)
Re: [PATCH] Export shmem_file_setup and shmem_getpage for ..., Stephane Marchesin, (Wed Aug 6, 10:32 am)
Re: [PATCH] Export shmem_file_setup and shmem_getpage for ..., Stephane Marchesin, (Wed Aug 6, 11:09 am)
Re: [PATCH] Export shmem_file_setup and shmem_getpage for ..., Stephane Marchesin, (Wed Aug 6, 7:16 pm)
Re: [PATCH] Export shmem_file_setup and shmem_getpage for ..., Christoph Hellwig, (Sun Aug 10, 6:23 pm)
Re: [PATCH] Export shmem_file_setup and shmem_getpage for ..., Christoph Hellwig, (Sun Aug 10, 6:30 pm)
Re: [PATCH] Export shmem_file_setup and shmem_getpage for ..., Christoph Hellwig, (Sun Aug 10, 6:34 pm)
Re: [PATCH] Export shmem_file_setup for DRM-GEM, Keith Packard, (Sun Aug 10, 8:03 pm)