From: Andi Kleen <ak@muc.de>
To: torvalds@osdl.org, roland@redhat.com, akpm@osdl.org
Cc: linux-kernel@vger.kernel.org
Subject: Bad patch to schedule()
Date: 9 Mar 2005 13:02:51 +0100
Date: Wed, 9 Mar 2005 13:02:51 +0100 [thread overview]
Message-ID: <20050309120251.GA4374@muc.de> (raw)
I just see that this patch went into mainline.
[PATCH] posix-timers: high-resolution CPU clocks for POSIX clock_* syscalls
This patch provides support for thread and process CPU time clocks in the
....
/*
+ * This is called on clock ticks and on context switches.
+ * Bank in p->sched_time the ns elapsed since the last tick or switch.
+ */
+static inline void update_cpu_clock(task_t *p, runqueue_t *rq,
+ unsigned long long now)
+{
+ unsigned long long last = max(p->timestamp, rq->timestamp_last_tick);
+ p->sched_time += now - last;
+}
+
called from schedule(). The problem with this is that it completely
messes up the register allocation for i386 schedule() because it
does long long arithmetic. This causes gcc to spill everything
else because it needs four registers, and i386 only has 6 usable
ones.
I think a critical path like the scheduler needs a little bit more
care. Also it is totally unclear if this obscure POSIX feature
is really worth making schedule() slower. I think not.
In case it is kept it should be done in a way that doesn't impact
i386 unduly e.g. by avoiding long long arithmetic here and
making sure fast paths stay fast.
I would propose to back this patch out again until this is resolved.
-Andi
next reply other threads:[~2005-03-09 12:03 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-03-09 12:02 Andi Kleen [this message]
2005-03-13 5:18 ` Bad patch to schedule() Roland McGrath
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=20050309120251.GA4374@muc.de \
--to=ak@muc.de \
--cc=akpm@osdl.org \
--cc=linux-kernel@vger.kernel.org \
--cc=roland@redhat.com \
--cc=torvalds@osdl.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox