qemu-devel
[Top][All Lists]
Advanced

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

Re: [PATCH RFC 08/21] ramblock: Cache the length to do file mmap() on ra


From: Peter Xu
Subject: Re: [PATCH RFC 08/21] ramblock: Cache the length to do file mmap() on ramblocks
Date: Mon, 30 Jan 2023 17:07:01 -0500

On Mon, Jan 30, 2023 at 06:05:47AM +0100, Juan Quintela wrote:
> Peter Xu <peterx@redhat.com> wrote:
> > We do proper page size alignment for file backed mmap()s for ramblocks.
> > Even if it's as simple as that, cache the value because it'll be used in
> > multiple places.
> >
> > Since at it, drop size for file_ram_alloc() and just use max_length because
> > that's always true for file-backed ramblocks.
> >
> > Signed-off-by: Peter Xu <peterx@redhat.com>
> 
> Reviewed-by: Juan Quintela <quintela@redhat.com>

Thanks for reviewing the set!

> 
> > @@ -2100,7 +2100,7 @@ RAMBlock *qemu_ram_alloc_from_fd(ram_addr_t size, 
> > MemoryRegion *mr,
> >      new_block->used_length = size;
> >      new_block->max_length = size;
> >      new_block->flags = ram_flags;
> > -    new_block->host = file_ram_alloc(new_block, size, fd, readonly,
> > +    new_block->host = file_ram_alloc(new_block, fd, readonly,
> >                                       !file_size, offset, errp);
> >      if (!new_block->host) {
> >          g_free(new_block);
> 
> Passing "size" in three places, not bad at all O:-)

Yes it's a bit unfortunate. :(

-- 
Peter Xu




reply via email to

[Prev in Thread] Current Thread [Next in Thread]