All of lore.kernel.org
 help / color / mirror / Atom feed
From: Fam Zheng <famz@redhat.com>
To: Stefan Hajnoczi <stefanha@gmail.com>
Cc: Laszlo Ersek <lersek@redhat.com>,
	Stefan Hajnoczi <stefanha@redhat.com>,
	qemu-devel@nongnu.org, qemu-block@nongnu.org
Subject: Re: [Qemu-devel] [PATCH 2/2] virtio-blk: Inline request init, complete and free functions
Date: Tue, 14 Feb 2017 08:54:27 +0800	[thread overview]
Message-ID: <20170214005427.GA6428@lemon.lan> (raw)
In-Reply-To: <20170213142814.GK10361@stefanha-x1.localdomain>

On Mon, 02/13 14:28, Stefan Hajnoczi wrote:
> On Tue, Feb 07, 2017 at 02:52:38PM +0100, Laszlo Ersek wrote:
> > On 02/07/17 14:27, Fam Zheng wrote:
> > > These are used in each request handling, inline them.
> > > 
> > > Signed-off-by: Fam Zheng <famz@redhat.com>
> > > ---
> > >  hw/block/virtio-blk.c | 9 +++++----
> > >  1 file changed, 5 insertions(+), 4 deletions(-)
> > > 
> > > diff --git a/hw/block/virtio-blk.c b/hw/block/virtio-blk.c
> > > index 2858c31..1da9570 100644
> > > --- a/hw/block/virtio-blk.c
> > > +++ b/hw/block/virtio-blk.c
> > > @@ -29,8 +29,8 @@
> > >  #include "hw/virtio/virtio-bus.h"
> > >  #include "hw/virtio/virtio-access.h"
> > >  
> > > -static void virtio_blk_init_request(VirtIOBlock *s, VirtQueue *vq,
> > > -                                    VirtIOBlockReq *req)
> > > +static inline void virtio_blk_init_request(VirtIOBlock *s, VirtQueue *vq,
> > > +                                           VirtIOBlockReq *req)
> > >  {
> > >      req->dev = s;
> > >      req->vq = vq;
> > > @@ -40,12 +40,13 @@ static void virtio_blk_init_request(VirtIOBlock *s, VirtQueue *vq,
> > >      req->mr_next = NULL;
> > >  }
> > >  
> > > -static void virtio_blk_free_request(VirtIOBlockReq *req)
> > > +static inline void virtio_blk_free_request(VirtIOBlockReq *req)
> > >  {
> > >      g_free(req);
> > >  }
> > >  
> > > -static void virtio_blk_req_complete(VirtIOBlockReq *req, unsigned char status)
> > > +static inline void virtio_blk_req_complete(VirtIOBlockReq *req,
> > > +                                           unsigned char status)
> > >  {
> > >      VirtIOBlock *s = req->dev;
> > >      VirtIODevice *vdev = VIRTIO_DEVICE(s);
> > > 
> > 
> > Hm, virtio_blk_req_complete() looks a bit too "meaty" and seems to be
> > called from a little too many places for me to feel convenient about
> > inlining it. I guess I'd leave it to the compiler to optimize the
> > function call. Does the explicit hint offer a noticeable perf improvement?
> > 
> > Inlining virtio_blk_free_request() looks reasonable.
> > 
> > virtio_blk_init_request() looks okay too.
> > 
> > Other reviewers should feel free to override my concerns :) My view on
> > this is distant.
> 
> I'm not a big fan of manually inlining functions.  Let the compiler
> decide whether these static functions should be inlined.
> 

Fair enough, let's drop this one.

Fam

      reply	other threads:[~2017-02-14  0:54 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-07 13:27 [Qemu-devel] [PATCH 0/2] virtio-blk: clean up around g_free() and inline a few functions Fam Zheng
2017-02-07 13:27 ` [Qemu-devel] [PATCH 1/2] virtio-blk: Remove useless condition around g_free() Fam Zheng
2017-02-07 13:48   ` Laszlo Ersek
2017-02-13 14:27   ` [Qemu-devel] [Qemu-block] " Stefan Hajnoczi
2017-03-07 10:28   ` [Qemu-trivial] [Qemu-devel] " Fam Zheng
2017-03-07 10:28     ` Fam Zheng
2017-04-23 17:30   ` [Qemu-trivial] " Michael Tokarev
2017-04-23 17:30     ` [Qemu-devel] " Michael Tokarev
2017-02-07 13:27 ` [Qemu-devel] [PATCH 2/2] virtio-blk: Inline request init, complete and free functions Fam Zheng
2017-02-07 13:52   ` Laszlo Ersek
2017-02-13 14:28     ` Stefan Hajnoczi
2017-02-14  0:54       ` Fam Zheng [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=20170214005427.GA6428@lemon.lan \
    --to=famz@redhat.com \
    --cc=lersek@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@gmail.com \
    --cc=stefanha@redhat.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.