|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [PATCH] tools/libxengnttab: correct size of allocated memory
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@xxxxxxxxxxxxx>
For the FreeBSD bits:
Reviewed-by: Roger Pau Monné <roger.pau@xxxxxxxxxx>
>
> 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.
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |