hw: re-add priority down-scaling

This is a follow-up commit for "hw: beautify scheduling-priority code".

ref #960
This commit is contained in:
Martin Stein 2013-11-20 23:35:02 +01:00 committed by Norman Feske
parent 883aa83e62
commit 07aa56fffb
4 changed files with 17 additions and 15 deletions

View File

@ -78,21 +78,21 @@ namespace Genode {
/**
* Constructor for core threads
*
* \param label debugging label
* \param stack_size initial size of the stack
* \param pd_id kernel name of targeted protection domain
* \param label debugging label
*/
Platform_thread(const char * const label, size_t const stack_size,
unsigned const pd_id);
Platform_thread(size_t const stack_size,
unsigned const pd_id, const char * const label);
/**
* Constructor for threads outside of core
*
* \param label debugging label
* \param priority processor-scheduling priority
* \param utcb core local pointer to userland thread-context
* \param label debugging label
* \param virt_prio unscaled processor-scheduling priority
* \param utcb core local pointer to userland thread-context
*/
Platform_thread(const char * const label, unsigned const priority,
Platform_thread(const char * const label, unsigned const virt_prio,
addr_t const utcb);
/**

View File

@ -24,7 +24,7 @@ namespace Kernel
MAX_SIGNAL_RECEIVERS = 256,
MAX_SIGNAL_CONTEXTS = 2048,
MAX_VMS = 4,
MAX_PRIORITY = 255,
MAX_PRIORITY = 128,
};
}

View File

@ -73,9 +73,9 @@ Platform_thread::~Platform_thread()
}
Platform_thread::Platform_thread(const char * const label,
size_t const stack_size,
unsigned const pd_id)
Platform_thread::Platform_thread(size_t const stack_size,
unsigned const pd_id,
const char * const label)
:
_stack_size(stack_size),
_pd_id(pd_id),
@ -105,7 +105,7 @@ Platform_thread::Platform_thread(const char * const label,
Platform_thread::Platform_thread(const char * const label,
unsigned const priority,
unsigned const virt_prio,
addr_t const utcb)
:
_stack_size(0),
@ -132,7 +132,9 @@ Platform_thread::Platform_thread(const char * const label,
_utcb_phys = (Native_utcb *)ram->phys_addr(_utcb);
/* create kernel object */
_id = Kernel::new_thread(_kernel_thread, priority, _label);
enum { MAX_PRIO = Kernel::Priority::MAX };
auto const phys_prio = Cpu_session::scale_priority(MAX_PRIO, virt_prio);
_id = Kernel::new_thread(_kernel_thread, phys_prio, _label);
if (!_id) {
PERR("failed to create kernel object");
throw Cpu_session::Thread_creation_failed();

View File

@ -54,12 +54,12 @@ void Thread_base::_thread_start()
}
Thread_base::Thread_base(const char *name, size_t stack_size)
Thread_base::Thread_base(const char * const label, size_t const stack_size)
:
_list_element(this)
{
_tid.platform_thread = new (platform()->core_mem_alloc())
Platform_thread(name, stack_size, Kernel::core_id());
Platform_thread(stack_size, Kernel::core_id(), label);
}