All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jan Kiszka <jan.kiszka@domain.hid>
To: rpm@xenomai.org
Cc: xenomai-core <xenomai@xenomai.org>
Subject: Re: [Xenomai-core] [RFC, PATCH] per-thread exec-time stats
Date: Fri, 07 Jul 2006 10:09:23 +0200	[thread overview]
Message-ID: <44AE16B3.80901@domain.hid> (raw)
In-Reply-To: <1152259455.5017.14.camel@domain.hid>

Philippe Gerum wrote:
> On Thu, 2006-07-06 at 18:36 +0200, Jan Kiszka wrote:
>> Jan Kiszka wrote:
>>> Philippe Gerum wrote:
>>>> On Thu, 2006-07-06 at 17:09 +0200, Jan Kiszka wrote:
>>>>>> We could do that from the current loop below, given that the
>>>>>> accumulation routine is changed to use thread->sched implicitely.
>>>>> The idea is avoid adding even further load to the nklock-protected loop.
>>>>> And we only update the current thread, not each and every.
>>>>>
>>>> Yes, but why? I mean, accumulated time so far remains significant even
>>>> for non-running threads.
>>> Update must only happen for the currently running thread on each cpu,
>>> otherwise you skew the stats up.
>>>
>>>
>>> But looking at the whole code in stat_seq_open() again, I now wonder if
>>> that whole routine isn't
>>>
>>> a) fragile on task removal and
>>> b) still poorly scaling.
>>>
>>> The thread name is only copied by reference, a disappearing instance my
>>> cause troubles on printing it. And, instead of holding the lock all the
>>> time, shouldn't we better
>>>
>>> 1. pick some element from the queue and mark it somehow
>>>    in-use under lock
>>> 2. print or copy the entry
>>> 3. reacquire the lock to proceed to the next one - after checking if
>>>    that element happened to be removed from the queue meanwhile (in that
>>>    case we could abort the output or try to resync)
>> Not feasible (threads may not always be prevented from being deleted),
>> but what about this:
>>
>> - maintain a modification counter for nkpod->threadq
>> - in our /proc-loops (sched and latency e.g.):
>>   1. take nklock
>>   2. get current counter
>>   3. compare with previous, restart whole loop if not matching
>>   4. copy current element (including the name...)
>>   5. forward element pointer
>>   6. release nklock
>>   7. goto 1 if not end-of-list
>>
>> As modifications on threadq should be fairly rare, I don't see a risk of
>> looping endlessly here.
>>
> 
> The more I think of it, the more I'm convinced that we are trying to
> tweak /proc/xenomai/stats for the wrong purpose. Actually, some xeno_top
> tool would rather need the equivalent of individual /proc/<pid> files,
> thus reducing the contention on access, and the need for weird grepping
> on the output. e.g. /proc/xenomai/threads/<pid> could emit per-thread
> data in some easily greppable form by a user-space tool.

Far too complex in my eyes for this simple purpose (what's the pid of
kernel-only threads?) - and we need to solve the latency problem of
/sched and /stat anyway.

Jan


  reply	other threads:[~2006-07-07  8:09 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-07-06 11:37 [Xenomai-core] [RFC, PATCH] per-thread exec-time stats Jan Kiszka
2006-07-06 11:41 ` Jan Kiszka
2006-07-06 14:32 ` Philippe Gerum
2006-07-06 15:09   ` Jan Kiszka
2006-07-06 15:37     ` Philippe Gerum
2006-07-06 15:46       ` Jan Kiszka
2006-07-06 16:36         ` Jan Kiszka
2006-07-06 17:17           ` Jan Kiszka
2006-07-07  8:20             ` Jan Kiszka
2006-07-07  8:04           ` Philippe Gerum
2006-07-07  8:09             ` Jan Kiszka [this message]
2006-07-07  8:49               ` Philippe Gerum
2006-07-07  9:03                 ` Jan Kiszka
2006-07-07 11:28                   ` Philippe Gerum
2006-07-06 16:37         ` Philippe Gerum
2006-07-06 23:47   ` Gilles Chanteperdrix
2006-07-07  7:54     ` Philippe Gerum
2006-07-07 10:22       ` Gilles Chanteperdrix
2006-07-07 10:30         ` Jan Kiszka
2006-07-07 13:23         ` Philippe Gerum
2006-07-07 13:59           ` Gilles Chanteperdrix
2006-07-07 14:25             ` Philippe Gerum
2006-07-06 15:04 ` Philippe Gerum
2006-07-06 15:06   ` Philippe Gerum

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=44AE16B3.80901@domain.hid \
    --to=jan.kiszka@domain.hid \
    --cc=rpm@xenomai.org \
    --cc=xenomai@xenomai.org \
    /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.