[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
qemu-user: avoid allocations to convert stuff when not necessary
From: |
Michael Tokarev |
Subject: |
qemu-user: avoid allocations to convert stuff when not necessary |
Date: |
Sun, 9 Apr 2023 11:52:15 +0300 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.9.0 |
Hi!
In the qemu-user case, we allocate various structures and arrays
for conversion of data between host and guest byte orders and sizes.
But it is actually not necessary to do such allocation when the
*size* is the same, and only byte order is different, because the
conversion can be done in-place. Does it make any sense to avoid'
allocations in such cases?
There are 2 issues with this though. First is that in some cases,
the data being converted is const, and we may end up writing to a
data resides in a read-only segment, is it ever possible? And
second - it is not entirely clear what to do in case the syscall
returned error.
Thanks,
/mjt
- qemu-user: avoid allocations to convert stuff when not necessary,
Michael Tokarev <=