Commit Graph

13 Commits

Author SHA1 Message Date
Avi Kivity
a597d37bc1 memory: add statistics for reclaim operations and free memory 2015-07-15 18:08:54 +03:00
Avi Kivity
23d874f786 doc: low-level memory management 2015-06-01 11:35:37 +03:00
Asias He
88e7dcfa86 Remove redundant const in static constexpr const
From http://en.cppreference.com/w/cpp/language/constexpr:

   A constexpr specifier used in an object declaration implies const.

However, We can not change from
   static constexpr const char* TIME_FORMAT = "%a %b %d %I:%M:%S %Z %Y";
to
   static constexpr char* TIME_FORMAT = "%a %b %d %I:%M:%S %Z %Y";

The compiler complains:

   In file included from json/formatter.cc:22:0:
   json/formatter.hh:132:42: error: deprecated conversion from string
   constant to ‘char*’ [-Werror=write-strings]
        static constexpr char* TIME_FORMAT = "%a %b %d %I:%M:%S %Z %Y";

Since, unlike const, constexpr does not modify a type. It just applies
to an object (or function), and incidentally implies const to the
top-level type.
2015-05-25 11:57:19 +03:00
Avi Kivity
7f8d88371a Add LICENSE, NOTICE, and copyright headers to all source files.
The two files imported from the OSv project retain their original licenses.
2015-02-19 16:52:34 +02:00
Vlad Zolotarov
18f35236db memory: Move page_size, page_bits and huge page size definitions to header
They are going to be used in more places (not just in memory.cc).

Signed-off-by: Vlad Zolotarov <vladz@cloudius-systems.com>
2015-02-11 19:27:12 +02:00
Avi Kivity
45f9c86943 memory: provide C++ facilities for aligned allocation
new (with_alignment(64)) foo(...)   // cache aligned foo
  std::vector<foo, aligned_allocator<foo, 64>> // cached aligned foo vector
2015-01-19 09:49:32 +02:00
Avi Kivity
80bcf3f973 memory: provide virt-to-phys translation API
Convert virtual addresses to physical addresses.  Only works when
--hugepages is in effect.
2015-01-15 18:23:19 +02:00
Avi Kivity
e57be410b5 memory: support cross-cpu freeing
Currently we require that memory be freed on the same cpu it was allocated.
This does not impose difficulties on the user code, since our code is already
smp-unsafe, and so must use message-passing to run the destructor on the
origin cpu, so memory is naturally freed there as well.

However, library code does not run under our assumptions, specifically
std::exception_ptr, which we do transport across cores.

To support this use case, add low-performance support for cross-cpu frees,
using an atomic singly linked list per core.
2015-01-15 15:19:00 +02:00
Avi Kivity
4453fd1d6a memory: add support for allocating memory via hugetlbfs
This is a little tricky, since we only know we want hugetlbfs after memory
has been initialized, so we start up in anonymous memory, and later
switch to hugetlbfs by copying it to hugetlb-backed memory and mremap()ing
it back into place.
2014-12-11 12:25:31 +02:00
Avi Kivity
347b135b78 memory: rename statistics member functions to be more readable
Requested by Gleb.
2014-11-24 11:53:13 +02:00
Avi Kivity
5cd200831b memory: add allocation statistics collection 2014-11-23 19:28:07 +02:00
Avi Kivity
56598903f6 memory: add support for reconfiguring memory
- add memory to a cpu
- bind that memory to a NUMA node
2014-10-13 13:03:46 +03:00
Avi Kivity
6746bcfd68 memory: reclaim support
Allow memory users to declare methods of reclaiming memory (reclaimers),
and allow the main loop to declare a safe point for calling these reclaimers.

The memory mananger will then schedule calls to reclaimers when memory runs
low.
2014-10-07 15:14:44 +03:00