﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc	field_blocks	field_dependson	field_seealso
446	High memory corrodes memory reservations	Jakub Jermář		"Memory reservations were introduced before the physical memory was split into low memory and high memory. In order to make use of the high memory, we started to see the following pattern in the kernel:

{{{
        frame = (uintptr_t) frame_alloc(ONE_FRAME, FRAME_HIGHMEM | FRAME_ATOMIC);
        if (frame) {
                page = km_map(frame, PAGE_SIZE, PAGE_READ | PAGE_WRITE);
        } else {
                frame = (uintptr_t) frame_alloc(ONE_FRAME, FRAME_LOWMEM);
                page = PA2KA(frame);
        }
}}}

Now, the problem with this is that the first non-blocking allocation request for high memory may fail, so that the caller will default to allocating from low memory. Because reservations do not differentiate between low and high memory, the caller may sleep in the second blocking allocation request. It can happen that the reserved memory will become soon available in high memory, but since the caller now only waits for low memory, it will never wake up.

We need to be able to merge the allocation request into a single, atomic allocation. This may require making memory reservations aware of the two kinds of memory and will likely change the mechanism of waiting for physical memory."	defect	new	major		helenos/unspecified	mainline						
