Removed all unecessary prints from the mutex test and the kernel

- removed (%d) Sleeping print from contended kernel mutexes.
- removed (%d) Waiting print from WAIT_EVENT used by the pager for suspending tasks.
- removed prints from the mutex_control syscall and user mutex test.
This commit is contained in:
Bahadir Balban
2009-06-01 16:02:10 +03:00
parent 5a616d1eb5
commit 13d469f659
6 changed files with 25 additions and 33 deletions

View File

@@ -59,7 +59,7 @@ do { \
task_set_wqh(current, wqh, &wq); \
(wqh)->sleepers++; \
list_add_tail(&wq.task_list, &(wqh)->task_list);\
printk("(%d) waiting...\n", current->tid); \
/* printk("(%d) waiting...\n", current->tid);*/ \
sched_prepare_sleep(); \
spin_unlock(&(wqh)->slock); \
schedule(); \

View File

@@ -263,11 +263,9 @@ int sys_mutex_control(syscall_context_t *regs)
switch (mutex_op) {
case MUTEX_CONTROL_LOCK:
printk("(%d): MUTEX_LOCK\n", current->tid);
ret = mutex_control_lock(mutex_physical);
break;
case MUTEX_CONTROL_UNLOCK:
printk("(%d): MUTEX_UNLOCK\n", current->tid);
ret = mutex_control_unlock(mutex_physical);
break;
default:

View File

@@ -88,7 +88,7 @@ void *__kmalloc(int size)
BUG_ON(size >= PAGE_SIZE);
BUG_ON(!(cache = mem_cache_init(alloc_page(), PAGE_SIZE,
size, 0)));
printk("%s: Created new cache for size %d\n", __FUNCTION__, size);
// printk("%s: Created new cache for size %d\n", __FUNCTION__, size);
list_add(&cache->list, &km_pool.pool_head[index].cache_list);
km_pool.pool_head[index].occupied = 1;
km_pool.pool_head[index].total_caches++;

View File

@@ -126,7 +126,7 @@ int mutex_lock(struct mutex *mutex)
mutex->wqh.sleepers++;
sched_prepare_sleep();
spin_unlock(&mutex->wqh.slock);
printk("(%d) sleeping...\n", current->tid);
// printk("(%d) sleeping...\n", current->tid);
schedule();
/* Did we wake up normally or get interrupted */

View File

@@ -65,8 +65,8 @@ int wait_on_prepare(struct waitqueue_head *wqh, struct waitqueue *wq)
list_add_tail(&wq->task_list, &wqh->task_list);
task_set_wqh(current, wqh, wq);
sched_prepare_sleep();
printk("(%d) waiting on wqh at: 0x%p\n",
current->tid, wqh);
//printk("(%d) waiting on wqh at: 0x%p\n",
// current->tid, wqh);
spin_unlock(&wqh->slock);
return 0;
@@ -81,8 +81,8 @@ int wait_on(struct waitqueue_head *wqh)
list_add_tail(&wq.task_list, &wqh->task_list);
task_set_wqh(current, wqh, &wq);
sched_prepare_sleep();
printk("(%d) waiting on wqh at: 0x%p\n",
current->tid, wqh);
//printk("(%d) waiting on wqh at: 0x%p\n",
// current->tid, wqh);
spin_unlock(&wqh->slock);
schedule();
@@ -95,7 +95,7 @@ int wait_on(struct waitqueue_head *wqh)
return 0;
}
/* Wake up all */
/* Wake up all - FIXME: this is buggy with double spin_unlock */
void wake_up_all(struct waitqueue_head *wqh, unsigned int flags)
{
BUG_ON(wqh->sleepers < 0);
@@ -111,7 +111,7 @@ void wake_up_all(struct waitqueue_head *wqh, unsigned int flags)
wqh->sleepers--;
if (flags & WAKEUP_INTERRUPT)
sleeper->flags |= TASK_INTERRUPTED;
printk("(%d) Waking up (%d)\n", current->tid, sleeper->tid);
// printk("(%d) Waking up (%d)\n", current->tid, sleeper->tid);
spin_unlock(&wqh->slock);
if (flags & WAKEUP_SYNC)
@@ -138,7 +138,7 @@ void wake_up(struct waitqueue_head *wqh, unsigned int flags)
task_unset_wqh(sleeper);
if (flags & WAKEUP_INTERRUPT)
sleeper->flags |= TASK_INTERRUPTED;
printk("(%d) Waking up (%d)\n", current->tid, sleeper->tid);
// printk("(%d) Waking up (%d)\n", current->tid, sleeper->tid);
spin_unlock(&wqh->slock);
if (flags & WAKEUP_SYNC)

View File

@@ -52,7 +52,7 @@ int user_mutex_test(void)
__FUNCTION__, (int)base);
goto out_err;
} else
printf("mmap: Anonymous shared buffer at %p\n", base);
test_printf("mmap: Anonymous shared buffer at %p\n", base);
shared_page = base;
@@ -64,32 +64,29 @@ int user_mutex_test(void)
/* Fork the current task */
if ((child = fork()) < 0) {
printf("%s: Fork failed with %d\n", __FUNCTION__, errno);
test_printf("%s: Fork failed with %d\n", __FUNCTION__, errno);
goto out_err;
}
if (child)
printf("%d: Created child with pid %d\n", getpid(), child);
test_printf("%d: Created child with pid %d\n", getpid(), child);
else
printf("Child %d running.\n", getpid());
test_printf("Child %d running.\n", getpid());
/* Child locks and produces */
if (child == 0) {
for (int x = 0; x < 10000; x++) {
for (int x = 0; x < 2000; x++) {
int temp;
/* Lock page */
printf("Child locking page.\n");
test_printf("Child locking page.\n");
l4_mutex_lock(&shared_page->mutex);
/* Read variable */
printf("Child locked page.\n");
test_printf("Child locked page.\n");
temp = shared_page->shared_var;
/* Thread switch */
l4_thread_switch(0);
/* Update local copy */
temp++;
@@ -99,11 +96,11 @@ int user_mutex_test(void)
/* Write back the result */
shared_page->shared_var = temp;
printf("Child modified. Unlocking...\n");
test_printf("Child modified. Unlocking...\n");
/* Unlock */
l4_mutex_unlock(&shared_page->mutex);
printf("Child unlocked page.\n");
test_printf("Child unlocked page.\n");
/* Thread switch */
l4_thread_switch(0);
@@ -114,20 +111,17 @@ int user_mutex_test(void)
/* Parent locks and consumes */
} else {
for (int x = 0; x < 10000; x++) {
for (int x = 0; x < 2000; x++) {
int temp;
/* Lock page */
printf("Parent locking page.\n");
test_printf("Parent locking page.\n");
l4_mutex_lock(&shared_page->mutex);
/* Read variable */
printf("Parent locked page.\n");
test_printf("Parent locked page.\n");
temp = shared_page->shared_var;
/* Thread switch */
l4_thread_switch(0);
/* Update local copy */
temp--;
@@ -137,11 +131,11 @@ int user_mutex_test(void)
/* Write back the result */
shared_page->shared_var = temp;
printf("Parent modified. Unlocking...\n");
test_printf("Parent modified. Unlocking...\n");
/* Unlock */
l4_mutex_unlock(&shared_page->mutex);
printf("Parent unlocked page.\n");
test_printf("Parent unlocked page.\n");
/* Thread switch */
l4_thread_switch(0);
@@ -149,7 +143,7 @@ int user_mutex_test(void)
/* Sync with the child */
l4_receive(child);
printf("Parent checking validity of value.\n");
test_printf("Parent checking validity of value.\n");
if (shared_page->shared_var != 0)
goto out_err;