From: Jan Kiszka <jan.kiszka@domain.hid>
To: Xenomai-core@domain.hid
Subject: [Xenomai-core] [PATCH] Flush xnfree backlog after thread deletion in root context
Date: Tue, 13 May 2008 10:26:00 +0200 [thread overview]
Message-ID: <48295098.10204@domain.hid> (raw)
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
next reply other threads:[~2008-05-13 8:26 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-05-13 8:26 Jan Kiszka [this message]
2008-05-13 8:56 ` [Xenomai-core] [PATCH] Flush xnfree backlog after thread deletion in root context 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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=48295098.10204@domain.hid \
--to=jan.kiszka@domain.hid \
--cc=Xenomai-core@domain.hid \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.