mirror of
https://github.com/drasko/codezero.git
synced 2026-01-22 15:53:16 +01:00
Some more progress with debugging pager exits
This commit is contained in:
@@ -117,6 +117,7 @@ int mutex_lock(struct mutex *mutex)
|
||||
* undeterministic as to how many retries will result in success.
|
||||
* We may need to add priority-based locking.
|
||||
*/
|
||||
printk("Thread (%d) locking (%p) nlocks: %d\n", current->tid, mutex, current->nlocks);
|
||||
for (;;) {
|
||||
spin_lock(&mutex->wqh.slock);
|
||||
if (!__mutex_lock(&mutex->lock)) { /* Could not lock, sleep. */
|
||||
@@ -131,6 +132,7 @@ int mutex_lock(struct mutex *mutex)
|
||||
|
||||
/* Did we wake up normally or get interrupted */
|
||||
if (current->flags & TASK_INTERRUPTED) {
|
||||
printk("Thread (%d) interrupted on mutex sleep\n", current->tid);
|
||||
current->flags &= ~TASK_INTERRUPTED;
|
||||
return -EINTR;
|
||||
}
|
||||
@@ -140,11 +142,14 @@ int mutex_lock(struct mutex *mutex)
|
||||
}
|
||||
}
|
||||
spin_unlock(&mutex->wqh.slock);
|
||||
printk("Thread (%d) locked (%p) nlocks: %d\n", current->tid, mutex, current->nlocks);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline void mutex_unlock_common(struct mutex *mutex, int sync)
|
||||
{
|
||||
struct ktcb *c = current; if (c);
|
||||
printk("Thread (%d) unlocking (%p) nlocks: %d\n", c->tid, mutex, c->nlocks);
|
||||
spin_lock(&mutex->wqh.slock);
|
||||
__mutex_unlock(&mutex->lock);
|
||||
current->nlocks--;
|
||||
|
||||
@@ -38,7 +38,7 @@ void task_unset_wqh(struct ktcb *task)
|
||||
/*
|
||||
* Initiate wait on current task that
|
||||
* has already been placed in a waitqueue
|
||||
*
|
||||
*
|
||||
* NOTE: This enables preemption and wait_on_prepare()
|
||||
* should be called first.
|
||||
*/
|
||||
@@ -63,7 +63,7 @@ int wait_on_prepared_wait(void)
|
||||
* Do all preparations to sleep but return without sleeping.
|
||||
* This is useful if the task needs to get in the waitqueue before
|
||||
* it releases a lock.
|
||||
*
|
||||
*
|
||||
* NOTE: This disables preemption and it should be enabled by a
|
||||
* call to wait_on_prepared_wait() - the other function of the pair.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user