From: Joao Martins <joao.m.martins@oracle.com>
To: Paul Durrant <Paul.Durrant@citrix.com>
Cc: "netdev@vger.kernel.org" <netdev@vger.kernel.org>,
Wei Liu <wei.liu2@citrix.com>,
"xen-devel@lists.xenproject.org" <xen-devel@lists.xenproject.org>
Subject: Re: [PATCH net-next v1] xen-netback: make copy batch size configurable
Date: Mon, 13 Nov 2017 16:53:37 +0000 [thread overview]
Message-ID: <20171113165336.yhd42fjjxbiymxsf@paddy> (raw)
In-Reply-To: <14e335a545264ea49076a69abf461e49@AMSPEX02CL03.citrite.net>
On Mon, Nov 13, 2017 at 04:39:09PM +0000, Paul Durrant wrote:
> > -----Original Message-----
> > From: Joao Martins [mailto:joao.m.martins@oracle.com]
> > Sent: 13 November 2017 16:34
> > To: Paul Durrant <Paul.Durrant@citrix.com>
> > Cc: netdev@vger.kernel.org; Wei Liu <wei.liu2@citrix.com>; xen-
> > devel@lists.xenproject.org
> > Subject: Re: [PATCH net-next v1] xen-netback: make copy batch size
> > configurable
> >
> > On Mon, Nov 13, 2017 at 11:58:03AM +0000, Paul Durrant wrote:
> > > On Mon, Nov 13, 2017 at 11:54:00AM +0000, Joao Martins wrote:
> > > > On 11/13/2017 10:33 AM, Paul Durrant wrote:
> > > > > On 11/10/2017 19:35 PM, Joao Martins wrote:
> >
> > [snip]
> >
> > > > >> diff --git a/drivers/net/xen-netback/rx.c b/drivers/net/xen-netback/rx.c
> > > > >> index b1cf7c6f407a..793a85f61f9d 100644
> > > > >> --- a/drivers/net/xen-netback/rx.c
> > > > >> +++ b/drivers/net/xen-netback/rx.c
> > > > >> @@ -168,11 +168,14 @@ static void xenvif_rx_copy_add(struct xenvif_queue *queue,
> > > > >> struct xen_netif_rx_request *req,
> > > > >> unsigned int offset, void *data, size_t len)
> > > > >> {
> > > > >> + unsigned int batch_size;
> > > > >> struct gnttab_copy *op;
> > > > >> struct page *page;
> > > > >> struct xen_page_foreign *foreign;
> > > > >>
> > > > >> - if (queue->rx_copy.num == COPY_BATCH_SIZE)
> > > > >> + batch_size = min(xenvif_copy_batch_size, queue->rx_copy.size);
> > > > >
> > > > > Surely queue->rx_copy.size and xenvif_copy_batch_size are always
> > > > > identical? Why do you need this statement (and hence stack variable)?
> > > > >
> > > > This statement was to allow to be changed dynamically and would
> > > > affect all newly created guests or running guests if value happened
> > > > to be smaller than initially allocated. But I suppose I should make
> > > > behaviour more consistent with the other params we have right now
> > > > and just look at initially allocated one `queue->rx_copy.batch_size` ?
> > >
> > > Yes, that would certainly be consistent but I can see value in
> > > allowing it to be dynamically tuned, so perhaps adding some re-allocation
> > > code to allow the batch to be grown as well as shrunk might be nice.
> >
> > The shrink one we potentially risk losing data, so we need to gate the
> > reallocation whenever `rx_copy.num` is less than the new requested
> > batch. Worst case means guestrx_thread simply uses the initial
> > allocated value.
>
> Can't you just re-alloc immediately after the flush (when num is
> guaranteed to be zero)?
/facepalm
Yes, after the flush should make things much simpler.
Joao
prev parent reply other threads:[~2017-11-13 16:54 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-11-10 19:34 [PATCH net-next v1] xen-netback: make copy batch size configurable Joao Martins
2017-11-13 10:33 ` Paul Durrant
2017-11-13 10:50 ` [Xen-devel] " Jan Beulich
2017-11-13 11:03 ` Paul Durrant
2017-11-13 11:54 ` Joao Martins
2017-11-13 11:58 ` Paul Durrant
2017-11-13 16:34 ` Joao Martins
2017-11-13 16:39 ` Paul Durrant
2017-11-13 16:53 ` Joao Martins [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20171113165336.yhd42fjjxbiymxsf@paddy \
--to=joao.m.martins@oracle.com \
--cc=Paul.Durrant@citrix.com \
--cc=netdev@vger.kernel.org \
--cc=wei.liu2@citrix.com \
--cc=xen-devel@lists.xenproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox