LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: "Alexey Dobriyan" <adobriyan@gmail.com>
To: "J.C. Pizarro" <jcpiza@gmail.com>
Cc: "Andrew Morton" <akpm@linux-foundation.org>,
LKML <linux-kernel@vger.kernel.org>
Subject: Re: Please, put 64-bit counter per task and incr.by.one each ctxt switch.
Date: Tue, 26 Feb 2008 16:41:28 +0300 [thread overview]
Message-ID: <b6fcc0a0802260541l1035b0fcx9aeb166cf81a7ff6@mail.gmail.com> (raw)
In-Reply-To: <998d0e4a0802260520x77fdea2dr32bc30a5448f32b3@mail.gmail.com>
On 2/26/08, J.C. Pizarro <jcpiza@gmail.com> wrote:
> On 2008/2/25, Andrew Morton <akpm@linux-foundation.org> wrote:
> > On Sun, 24 Feb 2008 14:12:47 +0100 "J.C. Pizarro" <jcpiza@gmail.com>
> wrote:
> >
> > > It's statistic, yes, but it's a very important parameter for the
> CPU-scheduler.
> > > The CPU-scheduler will know the number of context switches of each task
> > > before of to take a blind decision into infinitum!.
> >
> >
> > We already have these:
> >
> > unsigned long nvcsw, nivcsw; /* context switch counts */
> >
> > in the task_struct.
>
> 1. They use "unsigned long" instead "unsigned long long".
> 2. They use "= 0;" instead of "= 0ULL";
Very funny.
> 3. They don't use ++ (incr. by one per ctxt-switch).
No they do, read schedule() already.
> 4. I don't like the separation of voluntary and involuntary ctxt-switches,
> and i don't understand the utility of this separation.
Ah, that's why you don't like it.
> The tsk->nvcsw & tsk->nivcsw mean different to i had proposed.
>
> It's simple, when calling to function kernel/sched.c:context_switch(..)
> to do ++, but they don't do it.
>
> I propose you
> 1. unsigned long long tsk->ncsw = 0ULL; and tsk->ncsw++;
> 2. unsigned long long tsk->last_registered_ncsw = tsk->ncsw; when it's
> polling.
> 3. long tsk->vcsw = ( tsk->ncsw - tsk->last_registered_ncsw ) / ( t2 - t1 )
> /* velocity of task (ctxt-switches per second), (t1 != t2 in seconds
> for no zerodiv)
> 4. long tsk->last_registered_vcsw = tsk->vcsw;
> 5. long tsk->normalized_vcsw =
> (1 - alpha)*tsk->last_registered_vcsw + alpha*tsk->vcsw; /* 0<alpha<1
> */
6. Profit.
As I understood the idea of CFS, all interactivity heuristics were bitbucketed,
so you'll add them back (you won't, of course, because you can't be arsed
to send a patch)
So best course of action it to describe workload and setup (distro, relevant
.config items and so on.) on which CFS behaves poorly.
next prev parent reply other threads:[~2008-02-26 13:42 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-02-24 3:08 J.C. Pizarro
2008-02-24 3:17 ` Rik van Riel
2008-02-24 4:08 ` J.C. Pizarro
2008-02-24 4:26 ` Rik van Riel
2008-02-24 13:12 ` J.C. Pizarro
2008-02-24 17:53 ` Mike Galbraith
2008-02-25 20:34 ` Andrew Morton
2008-02-26 13:20 ` J.C. Pizarro
2008-02-26 13:41 ` Alexey Dobriyan [this message]
2008-02-24 5:08 ` Mike Galbraith
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=b6fcc0a0802260541l1035b0fcx9aeb166cf81a7ff6@mail.gmail.com \
--to=adobriyan@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=jcpiza@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--subject='Re: Please, put 64-bit counter per task and incr.by.one each ctxt switch.' \
/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
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).