rump: tweak memory configuration
Adjust managed dataspace (== max memory provided to rump kernel) based on 32/64 bit architecture. On 32bit is it 256M, on 64bit is 4G. Additionally limit the actual announced memory to rump by the available RAM and by the maximum size of the managed dataspace. Fixes #2709
This commit is contained in:
parent
80e1dce1b0
commit
f294ec608e
|
@ -21,8 +21,8 @@
|
||||||
#include <rump/env.h>
|
#include <rump/env.h>
|
||||||
|
|
||||||
namespace Allocator {
|
namespace Allocator {
|
||||||
template <unsigned VM_SIZE, typename POLICY> class Backend_alloc;
|
template <unsigned long VM_SIZE, typename POLICY> class Backend_alloc;
|
||||||
template <unsigned VM_SIZE, typename POLICY> class Fap;
|
template <unsigned long VM_SIZE, typename POLICY> class Fap;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -48,7 +48,7 @@ namespace Allocator {
|
||||||
/**
|
/**
|
||||||
* Back-end allocator for Genode's slab allocator
|
* Back-end allocator for Genode's slab allocator
|
||||||
*/
|
*/
|
||||||
template <unsigned VM_SIZE, typename POLICY = Default_allocator_policy>
|
template <unsigned long VM_SIZE, typename POLICY = Default_allocator_policy>
|
||||||
class Backend_alloc : public Genode::Allocator,
|
class Backend_alloc : public Genode::Allocator,
|
||||||
public Genode::Rm_connection,
|
public Genode::Rm_connection,
|
||||||
public Genode::Region_map_client
|
public Genode::Region_map_client
|
||||||
|
@ -56,7 +56,7 @@ namespace Allocator {
|
||||||
private:
|
private:
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
BLOCK_SIZE = 1024 * 1024, /* 1 MB */
|
BLOCK_SIZE = 2 * 1024 * 1024, /* 2 MB */
|
||||||
ELEMENTS = VM_SIZE / BLOCK_SIZE, /* MAX number of dataspaces in VM */
|
ELEMENTS = VM_SIZE / BLOCK_SIZE, /* MAX number of dataspaces in VM */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -193,7 +193,7 @@ namespace Allocator {
|
||||||
/**
|
/**
|
||||||
* Interface
|
* Interface
|
||||||
*/
|
*/
|
||||||
template <unsigned VM_SIZE, typename POLICY = Default_allocator_policy>
|
template <unsigned long VM_SIZE, typename POLICY = Default_allocator_policy>
|
||||||
class Fap
|
class Fap
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -22,7 +22,10 @@
|
||||||
#include <util/random.h>
|
#include <util/random.h>
|
||||||
#include <util/string.h>
|
#include <util/string.h>
|
||||||
|
|
||||||
enum { SUPPORTED_RUMP_VERSION = 17 };
|
enum {
|
||||||
|
SUPPORTED_RUMP_VERSION = 17,
|
||||||
|
MAX_VIRTUAL_MEMORY = (sizeof(void *) == 4 ? 256UL : 4096UL) * 1024 * 1024
|
||||||
|
};
|
||||||
|
|
||||||
static bool verbose = false;
|
static bool verbose = false;
|
||||||
|
|
||||||
|
@ -170,6 +173,7 @@ int rumpuser_getparam(const char *name, void *buf, size_t buflen)
|
||||||
}
|
}
|
||||||
|
|
||||||
rump_ram -= RESERVE_MEM;
|
rump_ram -= RESERVE_MEM;
|
||||||
|
rump_ram = Genode::min((unsigned long)MAX_VIRTUAL_MEMORY, rump_ram);
|
||||||
|
|
||||||
/* convert to string */
|
/* convert to string */
|
||||||
Genode::snprintf((char *)buf, buflen, "%zu", rump_ram);
|
Genode::snprintf((char *)buf, buflen, "%zu", rump_ram);
|
||||||
|
@ -233,7 +237,7 @@ struct Allocator_policy
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
typedef Allocator::Fap<128 * 1024 * 1024, Allocator_policy> Rump_alloc;
|
typedef Allocator::Fap<MAX_VIRTUAL_MEMORY, Allocator_policy> Rump_alloc;
|
||||||
|
|
||||||
static Genode::Lock & alloc_lock()
|
static Genode::Lock & alloc_lock()
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue