From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Jan Beulich" Subject: Re: [PATCH 3/3] grant-table: defer releasing pages acquired in a grant copy Date: Thu, 22 Jan 2015 16:01:36 +0000 Message-ID: <54C12CF00200007800058581@mail.emea.novell.com> References: <1421777990-1122-1-git-send-email-david.vrabel@citrix.com> <1421777990-1122-4-git-send-email-david.vrabel@citrix.com> <54C11875020000780005834D@mail.emea.novell.com> <54C10BB4.90109@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta4.messagelabs.com ([85.158.143.247]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1YEKCQ-0004fe-D7 for xen-devel@lists.xenproject.org; Thu, 22 Jan 2015 16:01:38 +0000 In-Reply-To: <54C10BB4.90109@citrix.com> Content-Disposition: inline List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: David Vrabel Cc: xen-devel@lists.xenproject.org, Keir Fraser , Ian Campbell , Tim Deegan List-Id: xen-devel@lists.xenproject.org >>> On 22.01.15 at 15:39, wrote: > On 22/01/15 14:34, Jan Beulich wrote: >>>>> On 20.01.15 at 19:19, wrote: >>> Acquiring a page for the source or destination of a grant copy is an >>> expensive operation. A common use case is for two adjacent grant copy >>> ops to operate on either the same source or the same destination page. >>> >>> Instead of always acquiring and releasing destination and source pages >>> for each operation, release the page once it is no longer valid for >>> the next op. >>> >>> If either the source or destination domains changes both pages are >>> released as it is unlikely that either will still be valid. >>> >>> XenServer's performance benchmarks show modest improvements in network >>> receive throughput (netback uses grant copy in the guest Rx path) and >>> no regressions in disk performamnce (using tapdisk3 which grant copies >>> as the backend). > [...] >>> +static bool_t gnttab_copy_buf_valid(const struct gnttab_copy *op, >>> + const struct gnttab_copy_ptr *p, >>> + const struct gnttab_copy_buf *b, >>> + unsigned int gref_flag) >>> +{ >>> + if ( !b->virt ) >>> + return 0; >>> + if ( op->flags & gref_flag ) >>> + return b->have_grant && p->u.ref == b->ptr.u.ref; >>> + return p->u.gmfn == b->ptr.u.gmfn; >>> +} >> >> ... whether you wouldn't better fold the op and gref_flag parameters >> into one, as they're used only once and only together. > > Do you mean something like? > > static bool_t gnttab_copy_buf_valid(const struct gnttab_copy_ptr *p, > const struct gnttab_copy_buf *b, > bool_t is_gref) Yes. Jan