2 new revisions:
Revision: db4c70c0f252
Branch: default
Author: Jack Lange <
jack....@gmail.com>
Date: Tue Aug 20 19:08:17 2013 UTC
Log: Fix a couple bugs in the bootmem allocator.
http://code.google.com/p/kitten/source/detail?r=db4c70c0f252
Revision: 0c4429916ccd
Branch: default
Author: Jack Lange <
jack....@gmail.com>
Date: Tue Aug 20 22:10:11 2013 UTC
Log: More fixes to allow kmem to start at non-zero base address.
http://code.google.com/p/kitten/source/detail?r=0c4429916ccd
==============================================================================
Revision: db4c70c0f252
Branch: default
Author: Jack Lange <
jack....@gmail.com>
Date: Tue Aug 20 19:08:17 2013 UTC
Log: Fix a couple bugs in the bootmem allocator.
http://code.google.com/p/kitten/source/detail?r=db4c70c0f252
Modified:
/kernel/mm/bootmem.c
=======================================
--- /kernel/mm/bootmem.c Wed Jun 19 13:11:12 2013 UTC
+++ /kernel/mm/bootmem.c Tue Aug 20 19:08:17 2013 UTC
@@ -343,9 +343,9 @@
BUG_ON(!bdata->node_bootmem_map);
- kmem_max_idx = (kmem_size >> PAGE_SHIFT) - (bdata->node_boot_start >>
PAGE_SHIFT);
+ kmem_max_idx = (kmem_size >> PAGE_SHIFT);
max_idx = bdata->node_low_pfn - (bdata->node_boot_start >> PAGE_SHIFT);
- BUG_ON(kmem_max_idx > max_idx);
+ BUG_ON(kmem_max_idx > max_idx); /* kmem region doesn't fit into available
bootmem */
/* Create the initial kernel managed memory pool (kmem) */
count = 0;
@@ -573,7 +573,7 @@
kmem_size);
/* Initialize the kernel memory pool */
- kmem_create_zone(PAGE_OFFSET, kmem_size);
+ kmem_create_zone((unsigned long)__va( bootmem_data.node_boot_start),
kmem_size);
free_all_bootmem();
arch_memsys_init(kmem_size);
}
==============================================================================
Revision: 0c4429916ccd
Branch: default
Author: Jack Lange <
jack....@gmail.com>
Date: Tue Aug 20 22:10:11 2013 UTC
Log: More fixes to allow kmem to start at non-zero base address.
http://code.google.com/p/kitten/source/detail?r=0c4429916ccd
Modified:
/arch/x86_64/mm/init.c
/include/lwk/kmem.h
/kernel/mm/kmem.c
=======================================
--- /arch/x86_64/mm/init.c Tue Dec 20 22:12:50 2011 UTC
+++ /arch/x86_64/mm/init.c Tue Aug 20 22:10:11 2013 UTC
@@ -332,7 +332,7 @@
query.end = round_up( initrd_end, PAGE_SIZE );
while (pmem_query(&query, &result) == 0) {
/* Only umem needs to be marked free at this point */
- if (result.start >= kmem_size) {
+ if (!paddr_is_kmem(result.start)) {
result.type = PMEM_TYPE_UMEM;
result.allocated = false;
BUG_ON(pmem_update(&result));
@@ -363,7 +363,8 @@
query.start = round_down( initrd_start, PAGE_SIZE );
query.end = round_up( initrd_end, PAGE_SIZE );
while (pmem_query(&query, &result) == 0) {
- if (result.start < kmem_size) {
+ if (paddr_is_kmem(result.start)) {
+ BUG_ON(!paddr_is_kmem(result.end));
result.type = PMEM_TYPE_KMEM;
result.allocated = false;
BUG_ON(pmem_update(&result));
=======================================
--- /include/lwk/kmem.h Wed Jan 7 16:13:59 2009 UTC
+++ /include/lwk/kmem.h Tue Aug 20 22:10:11 2013 UTC
@@ -12,4 +12,6 @@
extern void * kmem_get_pages(unsigned long order);
extern void kmem_free_pages(const void *addr, unsigned long order);
+extern bool paddr_is_kmem(const paddr_t paddr);
+
#endif
=======================================
--- /kernel/mm/kmem.c Wed Aug 25 18:41:20 2010 UTC
+++ /kernel/mm/kmem.c Tue Aug 20 22:10:11 2013 UTC
@@ -270,3 +270,14 @@
}
+/**
+ * Returns true if the physical addr passed in is kmem, false otherwise.
+ */
+bool
+paddr_is_kmem(
+ const paddr_t paddr
+)
+{
+ return (((unsigned long)__va(paddr) >= kmem->base_addr) &&
+ ((unsigned long)__va(paddr) - kmem->base_addr) < (1 <<
(kmem->pool_order)));
+}