On Tue, 9 Oct 2012 19:59:02 +0200, Daniel Vetter <daniel.vetter at ffwll.ch> wrote: > The obj->pages to obj->pages->sgl rework introduced this helper, but > it doesn't actually work for n % SG_MAX_SINGLE_ALLOC == 0. > > This is exercised by the improved hangman tests and the gem_exec_big > test in i-g-t. > > Signed-off-by: Daniel Vetter <daniel.vetter at ffwll.ch> I had to think about that harder than I should, to be sure we handled the case where the last element was a page and not a chainptr correctly. On hindsight, the code is clearly bogus for the n==SG_MAX_SINGLE_ALLOC because n is an index. My original thought was to use 'nth' instead and I believe that it would have helped prevent my confusion. Ah hindisght. Reviewed-by: Chris Wilson <chris at chris-wilson.co.uk> -Chris -- Chris Wilson, Intel Open Source Technology Centre