path: root/memory.c
AgeCommit message (Collapse)Author
2018-03-21Refactor #includes and headersSitsofe Wheeler
- Try and remove unneeded #include lines - Try and add #include lines that would allow the files to be built in a more standalone manner Signed-off-by: Sitsofe Wheeler <>
2017-08-08Add ability to keep memory-mapped filesStephen Bates
By default file backed memory mappings are unlink()'ed after use. This patch keeps the files if they already existed. We don't check for errors on access() since we will catch them on the open(). Discovered this when doing p2pmem testing and fio kept deleting the /dev/p2pmem0 files... Changes since v1 Altered based on feedback from Jens to avoid using an option and test for file existance instead. Signed-off-by: Stephen Bates <> Changed by me to use a td->flags flag, instead of adding a new member to thread options. Signed-off-by: Jens Axboe <>
2017-04-26gpu: kill a lot of useless ifdefsJens Axboe
We just have to guard how we set the mem type, we don't have to guard any check for MEM_CUDA_MALLOC inside CONFIG_CUDA ifdefs. Additionally, fix up some bad style. Fixes: 03553853 ("GPUDirect RDMA support") Signed-off-by: Jens Axboe <>
2017-04-26GPUDirect RDMA supportYufei Ren
2017-01-02Clean up unit prefixes for binary multiples in comments and printsRobert Elliott
Change comments and prints that are referring to values based on binary multiples to use IEC 80000-13 prefixes for binary multiples rather than SI prefixes for decimal multiples (e.g., KiB, MiB, and GiB rather than KB, MB, and GB). Includes a fix for the rate_min print that was printing "KB/s" although it was really printing bytes per second. Includes a fix for goptions confusing the PB and TB units (while changing them to PiB and TiB). Signed-off-by: Jens Axboe <>
2016-08-15fio: inherit IO engine flags to 'td'Jens Axboe
Signed-off-by: Jens Axboe <>
2016-05-24Spelling fix. Reported by Debian´s lintian.Martin Steigerwald
2016-02-24Allow IO engine driven allocations of IO structuresJens Axboe
Based on a patch from Andrey Kuzmin, but modified so that we error out if the user has specified a specific memory backing type through the use of mem= or iomem=. Signed-off-by: Jens Axboe <>
2015-10-27Add mmapshared option to use mmaped files with the MAP_SHARED flag.Logan Gunthorpe
This is primarily useful for benchmarking DAX files. If they are mmaped with the MAP_PRIVATE flag they will still have copy on write semantics and the test will not actually run against the memory that backs the DAX file. This memory option allows tests to be constructed that use the MAP_SHARED flag which allows running directly with the memory backed by a DAX file.
2015-01-20shm: disable iomem=shm* for shm disabledJens Axboe
Signed-off-by: Jens Axboe <>
2015-01-05memory: double check that mmapfd isn't -1 before closingJens Axboe
Signed-off-by: Jens Axboe <>
2014-10-30mmap: set 'fd' to -1Jens Axboe
This looks like a typo, using '1' makes no sense. This fixes Solaris anon allocs. Reported-by: Sébastien Bouchex Bellomié <> Signed-off-by: Jens Axboe <>
2014-04-14Fix potential NULL dereference in alloc_mem_mmap()Jens Axboe
Signed-off-by: Jens Axboe <>
2013-11-15Add support for O_ATOMICChris Mason
O_ATOMIC makes writes atomic, meaning that they are fully stable on media (in the event of a power cut) when acknowledged by the device and OS. This only truly works on Linux with the pending patches to add O_ATOMIC. Updated by Jens to: - Add man page and HOWTO description of the option - Make O_ATOMIC imply O_DIRECT, so that it actually works if you don't set O_DIRECT manually. - Add the option to the conversion list so it works for client/server. - Error handling so that if atomic=1 is set and the OS does not support it, error out instead of just pretending it works. Signed-off-by: Jens Axboe <>
2013-03-21Merge branch 'master' into gfioJens Axboe
Conflicts: Makefile fio.h options.c Signed-off-by: Jens Axboe <>
2013-03-12Conditionally include <sys/shm.h> based on OS support. Define missing ↵Oleg
MAP_HUGETLB for Android. Signed-off-by: Oleg Matcovschi <> Signed-off-by: Jens Axboe <>
2013-03-04Merge branch 'master' into gfioJens Axboe
Conflicts: init.c Signed-off-by: Jens Axboe <>
2013-02-25Fixup wrong types for dprint()Jens Axboe
Signed-off-by: Jens Axboe <>
2013-01-24Merge branch 'master' into gfioJens Axboe
Conflicts: Makefile backend.c client.c fio.c fio.h ioengine.h options.c os/os-linux.h server.c Signed-off-by: Jens Axboe <>
2013-01-17Make hugetlbfs maping workShaohua Li
If it's a file mapping, flags must be MAP_HARED; If it's an anonymous mapping, flags must be MAP_PRIVATE|MAP_ANONYMOUS|MAP_HUGETLB (can be shared, but doesn't matter here). Signed-off-by: Jens Axboe <>
2012-12-03Merge branch 'master' into gfioJens Axboe
Conflicts: Makefile fio.h io_u.c ioengine.h memory.c Signed-off-by: Jens Axboe <>
2012-11-21Add support for AndroidAaron Carroll
Signed-off-by: Jens Axboe <>
2012-11-20memory: wire up mmap huge page supportJens Axboe
Signed-off-by: Jens Axboe <>
2012-03-28Make lockmem a per job optionJens Axboe
We need to get rid of per job options that fiddle with global state. It's confusing, and it breaks remote option handling. Signed-off-by: Jens Axboe <>
2012-03-28Start the process of making options more gfio friendlyJens Axboe
We either need to eliminate the option callbacks, or ensure that they don't have side effects outside of touching td->o. We will need to use &td->o as the data passed in for the callbacks, not the full td. Signed-off-by: Jens Axboe <>
2011-03-25Fix unsigned integer overflow in IO buffer allocatorJens Axboe
Signed-off-by: Jens Axboe <>
2011-01-02First snapshot of FIO for WindowsBruce Cran
Signed-off-by: Jens Axboe <>
2010-10-28binject: ensure we get aligned memoryJens Axboe
Signed-off-by: Jens Axboe <>
2009-09-14Add hint on being root for EPERM and shmhuge errorJens Axboe
Signed-off-by: Jens Axboe <>
2009-09-12Make sure shmhuge allocations are huge page size alignedJens Axboe
Signed-off-by: Jens Axboe <>
2009-07-17Get rid of KiB vs KB distinctionJens Axboe
Confuses more than it does good, drop it and default to just using KB, MB, etc. Signed-off-by: Jens Axboe <>
2009-07-01Add support for the iomem_align optionJens Axboe
This allows detailed control of the alignment of the IO buffers that fio uses. Signed-off-by: Jens Axboe <>
2009-07-01Cleanup IO buffer memory allocationJens Axboe
This is in preparation for adding an option that controls the alignment of the buffers. Signed-off-by: Jens Axboe <>
2008-06-04MAP_ANON requires fd == -1Jens Axboe
Signed-off-by: Jens Axboe <>
2008-05-30Make it work on opensolarisJens Axboe
Signed-off-by: Jens Axboe <>
2008-03-06Style fixupsJens Axboe
Signed-off-by: Jens Axboe <>
2008-02-01Add --debug for enabling internal dumps on various actionsJens Axboe
A little weak currently, when it's fully integrated everywhere in fio it'll help find fio problems that I can't trigger. Signed-off-by: Jens Axboe <>
2007-10-25More cpu engine fixesJens Axboe
Signed-off-by: Jens Axboe <>
2007-07-19malloc memory still needs to be aligned, if we are doing direct IOJens Axboe
Signed-off-by: Jens Axboe <>
2007-07-19Add clue for ENOMEM hugepage allocationJens Axboe
Signed-off-by: Jens Axboe <>
2007-07-19Fix typo in shmhuge commitJens Axboe
Signed-off-by: Jens Axboe <>
2007-07-19Detect and print when the OS doesn't support huge pagesJens Axboe
Signed-off-by: Jens Axboe <>
2007-04-26Log error on io buffer allocationJens Axboe
Currently it just exits silently. Signed-off-by: Jens Axboe <>
2007-04-17IO buffer allocation cleanupJens Axboe
Signed-off-by: Jens Axboe <>
2007-04-02Move os/arch/compiler headers into directoriesJens Axboe
Signed-off-by: Jens Axboe <>
2007-03-23Print help info on huge page shmget() returning EINVALJens Axboe
Signed-off-by: Jens Axboe <>
2007-03-19Make sure mmaphuge file backed file is the size we needJens Axboe
Signed-off-by: Jens Axboe <>
2007-03-19Helpful indication to run as rootJens Axboe
Signed-off-by: Jens Axboe <>
2007-03-19No need to use perror() after td_verror()Jens Axboe
That'll just result in the error being displayed twice. Signed-off-by: Jens Axboe <>
2007-03-15Move thread options into a seperate structureJens Axboe
Signed-off-by: Jens Axboe <>