All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Roger Pau Monné" <roger.pau@citrix.com>
To: Ian Jackson <ian.jackson@citrix.com>
Cc: Juergen Gross <jgross@suse.com>,
	"xen-devel@lists.xenproject.org" <xen-devel@lists.xenproject.org>,
	Wei Liu <wl@xen.org>
Subject: Re: [PATCH] tools/libxengnttab: correct size of allocated memory
Date: Wed, 20 May 2020 17:56:21 +0200	[thread overview]
Message-ID: <20200520155621.GN54375@Air-de-Roger> (raw)
In-Reply-To: <24261.17303.413916.29534@mariner.uk.xensource.com>

On Wed, May 20, 2020 at 03:49:59PM +0100, Ian Jackson wrote:
> Juergen Gross writes ("[PATCH] tools/libxengnttab: correct size of allocated memory"):
> > The size of the memory allocated for the IOCTL_GNTDEV_MAP_GRANT_REF
> > ioctl() parameters is calculated wrong, which results in too much
> > memory allocated.
> 
> Added Roger to CC.
> 
> Firstly,
> 
> Reviewed-by: Ian Jackson <ian.jackson@eu.citrix.com>

For the FreeBSD bits:

Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>

> 
> Thank you.
> 
> 
> But, looking at this code, why on earth what the ?
> 
> The FreeBSD code checks to see if it's less than a page and if so uses
> malloc and otherwise uses mmap !  Why not unconditionally use malloc ?
> 
> Likewise, the Linux code has its own mmap-based memory-obtainer.  ISTM
> that malloc is probably going to be better.  Often it will be able to
> give out even a substantial amount without making a syscall.
> 
> Essentially, we have two (similar but not identical) tiny custom
> memory allocators here.  Also, the Linux and FreeBSD code are
> remarkably similar which bothers me.

Right. This is due to the FreeBSD file being mostly a clone of the
Linux one. I agree the duplication could be abstracted away.

I really have no idea why malloc or mmap is used, maybe at some point
requesting regions > PAGE_SIZE was considered faster using mmap
directly?

Thanks, Roger.


  reply	other threads:[~2020-05-20 15:56 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-20  8:35 [PATCH] tools/libxengnttab: correct size of allocated memory Juergen Gross
2020-05-20 14:49 ` Ian Jackson
2020-05-20 15:56   ` Roger Pau Monné [this message]
2020-06-11 15:25     ` Jürgen Groß
2020-06-11 16:02       ` Paul Durrant
2020-06-15 14:07         ` Ian Jackson
2020-06-15 14:09           ` Andrew Cooper
2020-06-15 14:57             ` Ian Jackson

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=20200520155621.GN54375@Air-de-Roger \
    --to=roger.pau@citrix.com \
    --cc=ian.jackson@citrix.com \
    --cc=jgross@suse.com \
    --cc=wl@xen.org \
    --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 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.