diff options
author | David Hildenbrand | 2022-10-14 15:47:14 +0200 |
---|---|---|
committer | David Hildenbrand | 2022-10-27 11:00:28 +0200 |
commit | 6556aadc18c560e493b29dd99cae2cbf86d214cb (patch) | |
tree | 7d4b15d6988db2f112fab919483a2b783ad7856a /include/qemu | |
parent | hw/mem/nvdimm: fix error message for 'unarmed' flag (diff) | |
download | qemu-6556aadc18c560e493b29dd99cae2cbf86d214cb.tar.gz qemu-6556aadc18c560e493b29dd99cae2cbf86d214cb.tar.xz qemu-6556aadc18c560e493b29dd99cae2cbf86d214cb.zip |
util: Cleanup and rename os_mem_prealloc()
Let's
* give the function a "qemu_*" style name
* make sure the parameters in the implementation match the prototype
* rename smp_cpus to max_threads, which makes the semantics of that
parameter clearer
... and add a function documentation.
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Message-Id: <20221014134720.168738-2-david@redhat.com>
Signed-off-by: David Hildenbrand <david@redhat.com>
Diffstat (limited to 'include/qemu')
-rw-r--r-- | include/qemu/osdep.h | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/include/qemu/osdep.h b/include/qemu/osdep.h index b1c161c035..e556e45143 100644 --- a/include/qemu/osdep.h +++ b/include/qemu/osdep.h @@ -568,8 +568,21 @@ unsigned long qemu_getauxval(unsigned long type); void qemu_set_tty_echo(int fd, bool echo); -void os_mem_prealloc(int fd, char *area, size_t sz, int smp_cpus, - Error **errp); +/** + * qemu_prealloc_mem: + * @fd: the fd mapped into the area, -1 for anonymous memory + * @area: start address of the are to preallocate + * @sz: the size of the area to preallocate + * @max_threads: maximum number of threads to use + * @errp: returns an error if this function fails + * + * Preallocate memory (populate/prefault page tables writable) for the virtual + * memory area starting at @area with the size of @sz. After a successful call, + * each page in the area was faulted in writable at least once, for example, + * after allocating file blocks for mapped files. + */ +void qemu_prealloc_mem(int fd, char *area, size_t sz, int max_threads, + Error **errp); /** * qemu_get_pid_name: |