Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755792AbcKKKYg (ORCPT ); Fri, 11 Nov 2016 05:24:36 -0500 Received: from mail.fireflyinternet.com ([109.228.58.192]:60992 "EHLO fireflyinternet.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753427AbcKKKYf (ORCPT ); Fri, 11 Nov 2016 05:24:35 -0500 X-Default-Received-SPF: pass (skip=forwardok (res=PASS)) x-ip-name=78.156.65.138; Date: Fri, 11 Nov 2016 10:24:31 +0000 From: Chris Wilson To: Tvrtko Ursulin Cc: Intel-gfx@lists.freedesktop.org, Masahiro Yamada , linux-kernel@vger.kernel.org Subject: Re: [Intel-gfx] [PATCH 3/4] lib/scatterlist: Introduce and export __sg_alloc_table_from_pages Message-ID: <20161111102431.GS9300@nuc-i3427.alporthouse.com> Mail-Followup-To: Chris Wilson , Tvrtko Ursulin , Intel-gfx@lists.freedesktop.org, Masahiro Yamada , linux-kernel@vger.kernel.org References: <1478854220-3255-1-git-send-email-tvrtko.ursulin@linux.intel.com> <1478854220-3255-4-git-send-email-tvrtko.ursulin@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1478854220-3255-4-git-send-email-tvrtko.ursulin@linux.intel.com> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1697 Lines: 43 On Fri, Nov 11, 2016 at 08:50:19AM +0000, Tvrtko Ursulin wrote: > From: Tvrtko Ursulin > > Drivers like i915 benefit from being able to control the maxium > size of the sg coallesced segment while building the scatter- > gather list. > > Introduce and export the __sg_alloc_table_from_pages function > which will allow it that control. > > Signed-off-by: Tvrtko Ursulin > Cc: Masahiro Yamada > Cc: linux-kernel@vger.kernel.org > --- > include/linux/scatterlist.h | 11 +++++---- > lib/scatterlist.c | 55 ++++++++++++++++++++++++++++++++++----------- > 2 files changed, 49 insertions(+), 17 deletions(-) > > diff --git a/include/linux/scatterlist.h b/include/linux/scatterlist.h > index c981bee1a3ae..29591dbb20fd 100644 > --- a/include/linux/scatterlist.h > +++ b/include/linux/scatterlist.h > @@ -261,10 +261,13 @@ void sg_free_table(struct sg_table *); > int __sg_alloc_table(struct sg_table *, unsigned int, unsigned int, > struct scatterlist *, gfp_t, sg_alloc_fn *); > int sg_alloc_table(struct sg_table *, unsigned int, gfp_t); > -int sg_alloc_table_from_pages(struct sg_table *sgt, > - struct page **pages, unsigned int n_pages, > - unsigned int offset, unsigned long size, > - gfp_t gfp_mask); > +int __sg_alloc_table_from_pages(struct sg_table *sgt, struct page **pages, > + unsigned int n_pages, unsigned int offset, > + unsigned long size, gfp_t gfp_mask, > + unsigned int max_segment); Just the question of parameter order, I like gfp_t last :) And I think offset / size / max_segment tie together. -Chris -- Chris Wilson, Intel Open Source Technology Centre