/proc output - improve scalability
PATCH 1/2 /proc output - improve scalability
This is an unmodified resent of my previously posted patch to make /proc/xenomai/{sched,stat} O(1) wrt nklock. It also solve a potential race during thread cleanup when accessing the dying thread's name.
Jan
--- include/nucleus/pod.h | 1 ksrc/nucleus/module.c | 94 +++++++++++++++++++++++++++++++++----------------- ksrc/nucleus/pod.c | 2 + 3 files changed, 66 insertions(+), 31 deletions(-)
include/nucleus/pod.h +1 -0
@@ -195,6 +195,7 @@ struct xnpod {xnsched_t sched[XNARCH_NR_CPUS ];/*!< Per-cpu scheduler slots. */ xnqueue_t threadq;/*!< All existing threads. */ +int threadq_rev;/*!< Modification counter of threadq. */ volatile u_long schedlck;/*!< Scheduler lock count. */
ksrc/nucleus/module.c +63 -31
169 lines not on this page · raw message
ksrc/nucleus/pod.c +2 -0
@@ -815,6 +815,7 @@ int xnpod_init_thread(xnthread_t *threadxnlock_get_irqsave (&nklock, s); thread->sched =xnpod_current_sched ();appendq (&nkpod->threadq, &thread->glink); + nkpod->threadq_rev++;xnpod_suspend_thread (thread,XNDORMANT | (flags &XNSUSP ),XN_INFINITE ,NULL );xnlock_put_irqrestore (&nklock, s);
@@ -1225,6 +1226,7 @@ void xnpod_delete_thread(xnthread_t *thr sched = thread->sched;removeq (&nkpod->threadq, &thread->glink); + nkpod->threadq_rev++;if (!testbits (thread->status,XNTHREAD_BLOCK_BITS )) {if (testbits (thread->status,XNREADY )) {