summaryrefslogtreecommitdiffstats
path: root/include/linux/memblock.h
diff options
context:
space:
mode:
authorBenjamin Herrenschmidt <benh@kernel.crashing.org>2010-07-06 15:39:01 -0700
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>2010-08-05 12:56:07 +1000
commite63075a3c9377536d085bc013cd3fe6323162449 (patch)
tree28fde124dde6df867947882fc686d228502846df /include/linux/memblock.h
parent27f574c223d2c09610058b3ec7a29582d63a3e06 (diff)
downloadblackbird-op-linux-e63075a3c9377536d085bc013cd3fe6323162449.tar.gz
blackbird-op-linux-e63075a3c9377536d085bc013cd3fe6323162449.zip
memblock: Introduce default allocation limit and use it to replace explicit ones
This introduce memblock.current_limit which is used to limit allocations from memblock_alloc() or memblock_alloc_base(..., MEMBLOCK_ALLOC_ACCESSIBLE). The old MEMBLOCK_ALLOC_ANYWHERE changes value from 0 to ~(u64)0 and can still be used with memblock_alloc_base() to allocate really anywhere. It is -no-longer- cropped to MEMBLOCK_REAL_LIMIT which disappears. Note to archs: I'm leaving the default limit to MEMBLOCK_ALLOC_ANYWHERE. I strongly recommend that you ensure that you set an appropriate limit during boot in order to guarantee that an memblock_alloc() at any time results in something that is accessible with a simple __va(). The reason is that a subsequent patch will introduce the ability for the array to resize itself by reallocating itself. The MEMBLOCK core will honor the current limit when performing those allocations. Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Diffstat (limited to 'include/linux/memblock.h')
-rw-r--r--include/linux/memblock.h16
1 files changed, 15 insertions, 1 deletions
diff --git a/include/linux/memblock.h b/include/linux/memblock.h
index 3cf3304e901d..c4f6e53264ed 100644
--- a/include/linux/memblock.h
+++ b/include/linux/memblock.h
@@ -34,6 +34,7 @@ struct memblock_type {
struct memblock {
unsigned long debug;
u64 rmo_size;
+ u64 current_limit;
struct memblock_type memory;
struct memblock_type reserved;
};
@@ -46,11 +47,16 @@ extern long memblock_add(u64 base, u64 size);
extern long memblock_remove(u64 base, u64 size);
extern long __init memblock_free(u64 base, u64 size);
extern long __init memblock_reserve(u64 base, u64 size);
+
extern u64 __init memblock_alloc_nid(u64 size, u64 align, int nid);
extern u64 __init memblock_alloc(u64 size, u64 align);
+
+/* Flags for memblock_alloc_base() amd __memblock_alloc_base() */
+#define MEMBLOCK_ALLOC_ANYWHERE (~(u64)0)
+#define MEMBLOCK_ALLOC_ACCESSIBLE 0
+
extern u64 __init memblock_alloc_base(u64 size,
u64, u64 max_addr);
-#define MEMBLOCK_ALLOC_ANYWHERE 0
extern u64 __init __memblock_alloc_base(u64 size,
u64 align, u64 max_addr);
extern u64 __init memblock_phys_mem_size(void);
@@ -66,6 +72,14 @@ extern void memblock_dump_all(void);
/* Provided by the architecture */
extern u64 memblock_nid_range(u64 start, u64 end, int *nid);
+/**
+ * memblock_set_current_limit - Set the current allocation limit to allow
+ * limiting allocations to what is currently
+ * accessible during boot
+ * @limit: New limit value (physical address)
+ */
+extern void memblock_set_current_limit(u64 limit);
+
/*
* pfn conversion functions
OpenPOWER on IntegriCloud