All of lore.kernel.org
 help / color / mirror / Atom feed
* [Xenomai-core] [PATCH] Flush xnfree backlog after thread deletion in root context
@ 2008-05-13  8:26 Jan Kiszka
  2008-05-13  8:56 ` Gilles Chanteperdrix
  0 siblings, 1 reply; 9+ messages in thread
From: Jan Kiszka @ 2008-05-13  8:26 UTC (permalink / raw)
  To: Xenomai-core

The lazy xnfree mechanism turned out to be too lazy: Just run some
testsuite program and what /proc/xenomai/heap - it will not reach the
level it has on freshly booted box.

The reason is that TCBs of threads that are released over the ROOT
thread will only get purged after the next schedule-to-ROOT. And if
there is no more Xenomai thread scheduling in the system, this won't
happen. It can even leave your system useless if you ran into
out-of-heap with allocating TCBs, and the remaining heap is now too
small to start at least one thread again (happened to customer). Patch
below fixes this by adding an xnfreesync to the related code path.

However, I wonder if we shouldn't better run all those deferred releases
in Linux context with only O(1) critical path lengths. Why risking to
pile up a large backlog of TCBs when releasing a lot of threads in a
row? That may degrade system latency. What about pushing this into some
VIRQ over the Linux domain, releasing the nklock once after each
iteration?

Jan

Index: xenomai-2.4.x/ksrc/nucleus/pod.c
===================================================================
--- xenomai-2.4.x/ksrc/nucleus/pod.c	(Revision 3764)
+++ xenomai-2.4.x/ksrc/nucleus/pod.c	(Arbeitskopie)
@@ -1236,6 +1236,9 @@ void xnpod_delete_thread(xnthread_t *thr
 		xnthread_cleanup_tcb(thread);
 
 		xnarch_finalize_no_switch(xnthread_archtcb(thread));
+
+		if (xnthread_test_state(sched->runthread, XNROOT))
+			xnfreesync();
 	}
 
       unlock_and_exit:

-- 
Siemens AG, Corporate Technology, CT SE 2
Corporate Competence Center Embedded Linux


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2008-05-13 12:33 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-05-13  8:26 [Xenomai-core] [PATCH] Flush xnfree backlog after thread deletion in root context Jan Kiszka
2008-05-13  8:56 ` Gilles Chanteperdrix
2008-05-13  9:10   ` Jan Kiszka
2008-05-13  9:16     ` Gilles Chanteperdrix
2008-05-13  9:29       ` Philippe Gerum
2008-05-13  9:32         ` Jan Kiszka
2008-05-13  9:38           ` Gilles Chanteperdrix
2008-05-13 10:46             ` Jan Kiszka
2008-05-13 12:33               ` Gilles Chanteperdrix

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.