xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Gianni Tedesco <gianni.tedesco@citrix.com>
To: Patrick Colp <pjcolp@cs.ubc.ca>
Cc: "xen-devel@lists.xensource.com" <xen-devel@lists.xensource.com>,
	Ian Jackson <Ian.Jackson@eu.citrix.com>
Subject: Re: [PATCH 2 of 3] xenpaging: Fix-up xenpaging tool code
Date: Wed, 28 Jul 2010 16:01:17 +0100	[thread overview]
Message-ID: <1280329277.1723.2187.camel@qabil.uk.xensource.com> (raw)
In-Reply-To: <AANLkTimhFnLgX4X8r3t7fdREZ6xvetPjhZCkWGv2O3d2@mail.gmail.com>

On Wed, 2010-07-28 at 15:57 +0100, Patrick Colp wrote:
> On 28 July 2010 10:00, Ian Jackson <Ian.Jackson@eu.citrix.com> wrote:
> > Patrick Colp writes ("[Xen-devel] [PATCH 2 of 3] xenpaging: Fix-up xenpaging tool code"):
> >>   err:
> >> -    if ( paging->bitmap )
> >> -        free(paging->bitmap);
> >> -    if ( paging->platform_info )
> >> -        free(paging->platform_info);
> >>      if ( paging )
> >> +    {
> >> +        if ( paging->bitmap )
> >> +            free(paging->bitmap);
> >
> > While you're doing this, why not replace
> >
> >>-+        if ( paging->bitmap )
> >>-+            free(paging->bitmap);
> > with
> >
> >>++        free(paging->bitmap);
> >
> > since free(0) is legal and a no-op ?
> 
> Could do, but free(0) isn't exactly a no-op. free() does a check to
> see if the pointer passed was 0. So it doesn't really make much
> difference if I do the check or let it do the check. I can easily
> change the code to just do free(paging->bitmap) though, if that's the
> preferred way to do it.

It's just simpler and takes less screen space.

> Actually, I would argue my way is better since
> in the case of a NULL pointer, the free function isn't called at all,
> which saves a bunch of cycles.

At the expense of expanding the binary image with a few more
instructions. Besides don't "optimize" what isn't a bottleneck.

Gianni

  reply	other threads:[~2010-07-28 15:01 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-07-27 21:21 [PATCH 0 of 3] xenpaging: Check that EPT is enabled for target guest Patrick Colp
2010-07-27 21:21 ` [PATCH 1 of 3] xenpaging: Add a check to Xen for EPT Patrick Colp
2010-07-28 13:58   ` Ian Jackson
2010-07-28 13:59     ` Ian Jackson
2010-07-28 14:35       ` Patrick Colp
2010-07-28 15:19         ` Ian Jackson
2010-07-27 21:21 ` [PATCH 2 of 3] xenpaging: Fix-up xenpaging tool code Patrick Colp
2010-07-28 14:00   ` Ian Jackson
2010-07-28 14:57     ` Patrick Colp
2010-07-28 15:01       ` Gianni Tedesco [this message]
2010-07-28 15:28         ` Patrick Colp
2010-07-28 16:27           ` Patrick Colp
2010-07-28 15:06       ` Keir Fraser
2010-07-27 21:21 ` [PATCH 3 of 3] xenpaging: Add check to xenpaging tool for EPT error from Xen Patrick Colp
2010-09-15  8:37   ` Jiang, Yunhong

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=1280329277.1723.2187.camel@qabil.uk.xensource.com \
    --to=gianni.tedesco@citrix.com \
    --cc=Ian.Jackson@eu.citrix.com \
    --cc=pjcolp@cs.ubc.ca \
    --cc=xen-devel@lists.xensource.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).