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); \ task_set_wqh(current, wqh, &wq); \
(wqh)->sleepers++; \ (wqh)->sleepers++; \
list_add_tail(&wq.task_list, &(wqh)->task_list);\ list_add_tail(&wq.task_list, &(wqh)->task_list);\
printk("(%d) waiting...\n", current->tid); \ /* printk("(%d) waiting...\n", current->tid);*/ \
sched_prepare_sleep(); \ sched_prepare_sleep(); \
spin_unlock(&(wqh)->slock); \ spin_unlock(&(wqh)->slock); \
schedule(); \ schedule(); \

View File

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

View File

@@ -88,7 +88,7 @@ void *__kmalloc(int size)
BUG_ON(size >= PAGE_SIZE); BUG_ON(size >= PAGE_SIZE);
BUG_ON(!(cache = mem_cache_init(alloc_page(), PAGE_SIZE, BUG_ON(!(cache = mem_cache_init(alloc_page(), PAGE_SIZE,
size, 0))); 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); list_add(&cache->list, &km_pool.pool_head[index].cache_list);
km_pool.pool_head[index].occupied = 1; km_pool.pool_head[index].occupied = 1;
km_pool.pool_head[index].total_caches++; km_pool.pool_head[index].total_caches++;

View File

@@ -126,7 +126,7 @@ int mutex_lock(struct mutex *mutex)
mutex->wqh.sleepers++; mutex->wqh.sleepers++;
sched_prepare_sleep(); sched_prepare_sleep();
spin_unlock(&mutex->wqh.slock); spin_unlock(&mutex->wqh.slock);
printk("(%d) sleeping...\n", current->tid); // printk("(%d) sleeping...\n", current->tid);
schedule(); schedule();
/* Did we wake up normally or get interrupted */ /* 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); list_add_tail(&wq->task_list, &wqh->task_list);
task_set_wqh(current, wqh, wq); task_set_wqh(current, wqh, wq);
sched_prepare_sleep(); sched_prepare_sleep();
printk("(%d) waiting on wqh at: 0x%p\n", //printk("(%d) waiting on wqh at: 0x%p\n",
current->tid, wqh); // current->tid, wqh);
spin_unlock(&wqh->slock); spin_unlock(&wqh->slock);
return 0; return 0;
@@ -81,8 +81,8 @@ int wait_on(struct waitqueue_head *wqh)
list_add_tail(&wq.task_list, &wqh->task_list); list_add_tail(&wq.task_list, &wqh->task_list);
task_set_wqh(current, wqh, &wq); task_set_wqh(current, wqh, &wq);
sched_prepare_sleep(); sched_prepare_sleep();
printk("(%d) waiting on wqh at: 0x%p\n", //printk("(%d) waiting on wqh at: 0x%p\n",
current->tid, wqh); // current->tid, wqh);
spin_unlock(&wqh->slock); spin_unlock(&wqh->slock);
schedule(); schedule();
@@ -95,7 +95,7 @@ int wait_on(struct waitqueue_head *wqh)
return 0; 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) void wake_up_all(struct waitqueue_head *wqh, unsigned int flags)
{ {
BUG_ON(wqh->sleepers < 0); BUG_ON(wqh->sleepers < 0);
@@ -111,7 +111,7 @@ void wake_up_all(struct waitqueue_head *wqh, unsigned int flags)
wqh->sleepers--; wqh->sleepers--;
if (flags & WAKEUP_INTERRUPT) if (flags & WAKEUP_INTERRUPT)
sleeper->flags |= TASK_INTERRUPTED; 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); spin_unlock(&wqh->slock);
if (flags & WAKEUP_SYNC) if (flags & WAKEUP_SYNC)
@@ -138,7 +138,7 @@ void wake_up(struct waitqueue_head *wqh, unsigned int flags)
task_unset_wqh(sleeper); task_unset_wqh(sleeper);
if (flags & WAKEUP_INTERRUPT) if (flags & WAKEUP_INTERRUPT)
sleeper->flags |= TASK_INTERRUPTED; 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); spin_unlock(&wqh->slock);
if (flags & WAKEUP_SYNC) if (flags & WAKEUP_SYNC)

View File

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