mem: Check if phys-mem is within the range of McKernel memory

Fujitsu: POSTK_DEBUG_TEMP_FIX_52
Refs: #1164
Change-Id: Idb9a6eac1d2e1df4c663c3171925c774421177fd
This commit is contained in:
Ken Sato
2018-08-08 09:40:05 +09:00
committed by Masamichi Takagi
parent f57b0c5d4f
commit 9a20cfaefb
11 changed files with 436 additions and 53 deletions

View File

@ -2296,34 +2296,37 @@ void ___kmalloc_print_free_list(struct list_head *list)
kprintf_unlock(irqflags);
}
#ifdef POSTK_DEBUG_TEMP_FIX_52 /* supports NUMA for memory area determination */
#ifdef IHK_RBTREE_ALLOCATOR
int is_mckernel_memory(unsigned long phys)
int is_mckernel_memory(unsigned long start, unsigned long end)
{
int i;
for (i = 0; i < ihk_mc_get_nr_memory_chunks(); ++i) {
unsigned long start, end;
unsigned long chunk_start, chunk_end;
int numa_id;
ihk_mc_get_memory_chunk(i, &start, &end, &numa_id);
if (start <= phys && phys < end) {
ihk_mc_get_memory_chunk(i, &chunk_start, &chunk_end, &numa_id);
if ((chunk_start <= start && start < chunk_end) &&
(chunk_start <= end && end < chunk_end)) {
return 1;
}
}
return 0;
}
#else /* IHK_RBTREE_ALLOCATOR */
int is_mckernel_memory(unsigned long phys)
int is_mckernel_memory(unsigned long start, unsigned long end)
{
int i;
for (i = 0; i < ihk_mc_get_nr_numa_nodes(); ++i) {
struct ihk_page_allocator_desc *pa_allocator;
unsigned long area_start = pa_allocator->start;
unsigned long area_end = pa_allocator->end;
list_for_each_entry(pa_allocator,
&memory_nodes[i].allocators, list) {
if (pa_allocator->start <= phys && phys < pa_allocator->end) {
if ((area_start <= start && start < area_end) &&
(area_start <= end && end < area_end)) {
return 1;
}
}
@ -2331,7 +2334,6 @@ int is_mckernel_memory(unsigned long phys)
return 0;
}
#endif /* IHK_RBTREE_ALLOCATOR */
#endif /* POSTK_DEBUG_TEMP_FIX_52 */
void ihk_mc_query_mem_areas(void){