Re: [PATCH] kvm tools: Use mmap for working with disk image V4

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, Apr 9, 2011 at 8:07 PM, Sasha Levin <levinsasha928@xxxxxxxxx> wrote:
> Now openning map with MAP_SHARED.
>
> Attempt to use mmap first for working with a disk image, if the attempt is failed (for example, large image on a 32bit system) fallback to using read/write.
>
> Performance (kB/s) test using bonnie++ showed the following improvement:
>
> kvm cmdline: ./kvm run --mem=256 --image=./work/vms/gentoo.img --kernel=/boot/bzImage-git
> bonnie++ cmdline: bonnie++ -u 0
>
> Before:
> Version  1.96       ------Sequential Output----- --Sequential Input- -Random-
> Concurrency   1     -Per Chr- --Block-- -Rewrite- -Per Chr- --Block-- --Seeks--
> Machine        Size K/sec %CP K/sec %CP K/sec %CP K/sec %CP K/sec %CP  /sec %CP
> tux            480M   673 100 308017  61 288156  49  3286  99 892186  76 +++++ +++
> Latency             12998us   50992us   35993us    3000us    1999us     201ms
> Version  1.96       ------Sequential Create------ --------Random Create--------
> tux                 -Create-- --Read--- -Delete-- -Create-- --Read--- -Delete--
>              files  /sec %CP  /sec %CP  /sec %CP  /sec %CP  /sec %CP  /sec %CP
>                 16 +++++ +++ +++++ +++ +++++ +++ +++++ +++ +++++ +++ +++++ +++
> Latency              3000us    1000us    1000us    1000us    1998us    1000us
>
> Version  1.96       ------Sequential Output------ --Sequential Input- --Random-
> Concurrency   1     -Per Chr- --Block-- -Rewrite- -Per Chr- --Block-- --Seeks--
> Machine        Size K/sec %CP K/sec %CP K/sec %CP K/sec %CP K/sec %CP  /sec %CP
> tux            480M   674  99 366588  42 309514  44  3539  99 954554  76 +++++ +++
> Latency             17997us   15997us   37993us    4999us    1998us     145ms
> Version  1.96       ------Sequential Create------ --------Random Create--------
> tux                 -Create-- --Read--- -Delete-- -Create-- --Read--- -Delete--
>              files  /sec %CP  /sec %CP  /sec %CP  /sec %CP  /sec %CP  /sec %CP
>                 16 +++++ +++ +++++ +++ +++++ +++ +++++ +++ +++++ +++ +++++ +++
> Latency              1000us    1000us    2000us    1999us    1000us    1000us
>
> Signed-off-by: Sasha Levin <levinsasha928@xxxxxxxxx>

I applied this because throughput improves. I need to revisit the
decision after we fix the blocking I/O model.

> +struct disk_image *disk_image__new(int fd, uint64_t size)
> +{
> +       struct disk_image *self;
> +
> +       self            = malloc(sizeof *self);
> +       if (!self)
> +               return NULL;
> +
> +       self->fd        = fd;
> +       self->size      = size;
> +       self->priv      = mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_SHARED | MAP_NORESERVE, fd, 0);

Btw, I dropped MAP_NORESERVE. It's a no-op with MAP_SHARED.
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux