Re: [Intel-gfx] [PATCH 02/16] drm/i915: Refactor pwrite/pread to use single copy of get_user_pages

2011-05-15 Thread Chris Wilson
On Thu, 12 May 2011 17:21:50 -0700, Keith Packard kei...@keithp.com wrote: On Thu, 12 May 2011 22:17:10 +0100, Chris Wilson ch...@chris-wilson.co.uk wrote: + pages = kmalloc(n*sizeof(struct page *), + GFP_KERNEL | __GFP_NORETRY | __GFP_NOWARN); + if (pages == NULL)

Re: [Intel-gfx] [PATCH 02/16] drm/i915: Refactor pwrite/pread to use single copy of get_user_pages

2011-05-15 Thread Keith Packard
On Sun, 15 May 2011 09:00:51 +0100, Chris Wilson ch...@chris-wilson.co.uk wrote: We're not performing the same trick as drm_malloc_ab() here though, since this is only used for a temporary allocation we try to consume any high-order pages, rather than building an array of order-0 pages,

[Intel-gfx] [PATCH 02/16] drm/i915: Refactor pwrite/pread to use single copy of get_user_pages

2011-05-12 Thread Chris Wilson
Replace the three nearly identical copies of the code with a single function. And take advantage of the opportunity to do some micro-optimisation: avoid the vmalloc if at all possible and also avoid dropping the lock unless we are forced to acquire the mm semaphore. Measuring the impact of the

Re: [Intel-gfx] [PATCH 02/16] drm/i915: Refactor pwrite/pread to use single copy of get_user_pages

2011-05-12 Thread Keith Packard
On Thu, 12 May 2011 22:17:10 +0100, Chris Wilson ch...@chris-wilson.co.uk wrote: + pages = kmalloc(n*sizeof(struct page *), + GFP_KERNEL | __GFP_NORETRY | __GFP_NOWARN); + if (pages == NULL) { + pages = drm_malloc_ab(n, sizeof(struct page *)); +