From: Ingo Molnar <mingo@elte.hu>
To: "H. Peter Anvin" <hpa@zytor.com>
Cc: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>,
akpm@linux-foundation.org, linux-kernel@vger.kernel.org
Subject: Re: [patch 0/2] Immediate Values - jump patching update
Date: Tue, 29 Apr 2008 00:11:22 +0200 [thread overview]
Message-ID: <20080428221122.GC16153@elte.hu> (raw)
In-Reply-To: <48163B84.90605@zytor.com>
* H. Peter Anvin <hpa@zytor.com> wrote:
>>> I still think this is the completely wrong approach.
>>
>> hm, can it result in a broken kernel? If yes, how? Or are your
>> objections more higher level?
>
> My objections are higher level, I believe the current code is (a)
> painfully complex, and I'd rather not see it in the kernel, and (b)
> the wrong thing anyway.
>
> Put a 5-byte nop in as the marker, and patch it with a call
> instruction, out of line, to a collector function.
the counter argument was that by specific sched.o analysis, this results
in slower code. The reason is that the "function call parameter
preparation" halo around that 5-byte patch site is larger than that
single conditional branch operation to an offline place of the current
function is.
i.e. the current optimized marker approach does roughly this:
[ .... fastpath head .... ]
[ immediate value instruction ] --->
[ branch instruction ] ---> these two get NOP-ed out
[ .... fastpath tail .... ]
[ ............................. ]
[ ... offline area ............ ]
[ ... parameter preparation ... ]
[ ... marker call ............. ]
your proposed 5-byte call NOP approach (which btw. was what i proposed
multiple times in the past 2 years) would do this:
[ .... fastpath head ...... ]
[ ... parameter preparation ... ]
[ .... 5-byte CALL .......... ] ---> NOP-ed out
[ .... fastpath tail .......... ]
[ ............................. ]
in the first case we have little "marker parameter/value preparation"
cost: it all happens in the 'offline area' _by GCC_. I.e. the fastpath
is relatively undisturbed.
in the latter case, all the 'parameter preparation' phase has to happen
at around the 5-byte CALL site, in the fastpath. This, in the specific,
assembly level analysis of sched.o, was shown by Matthieu to be a
pessimisation. We are better off by inserting that conditional and
letting gcc generate the call, than by forcing it in the middle of the
fastpath - even if we end up NOP-ing out the call.
wrt. complexity i agree with you - if the current optimization cannot be
made correctly we have to fall back to a simpler variant, even if it's
slower.
Ingo
next prev parent reply other threads:[~2008-04-28 22:11 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-04-28 3:34 [patch 0/2] Immediate Values - jump patching update Mathieu Desnoyers
2008-04-28 3:34 ` [patch 1/2] Immediate Values - jump liveliness Mathieu Desnoyers
2008-04-28 3:34 ` [patch 2/2] Markers - use imv_cond " Mathieu Desnoyers
2008-04-28 12:48 ` [patch 0/2] Immediate Values - jump patching update Ingo Molnar
2008-04-28 14:35 ` Mathieu Desnoyers
2008-04-28 17:21 ` H. Peter Anvin
2008-04-28 20:25 ` Ingo Molnar
2008-04-28 21:03 ` H. Peter Anvin
2008-04-28 22:11 ` Ingo Molnar [this message]
2008-04-28 22:25 ` H. Peter Anvin
2008-04-28 22:44 ` Ingo Molnar
2008-04-28 23:06 ` H. Peter Anvin
2008-04-29 0:47 ` Frank Ch. Eigler
2008-04-29 1:08 ` H. Peter Anvin
2008-04-29 12:08 ` Ingo Molnar
2008-05-14 14:53 ` Pavel Machek
2008-04-29 1:46 ` Mathieu Desnoyers
2008-04-29 2:07 ` H. Peter Anvin
2008-04-29 12:18 ` Mathieu Desnoyers
2008-04-29 15:35 ` H. Peter Anvin
2008-05-04 14:54 ` Mathieu Desnoyers
2008-05-04 21:05 ` H. Peter Anvin
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=20080428221122.GC16153@elte.hu \
--to=mingo@elte.hu \
--cc=akpm@linux-foundation.org \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mathieu.desnoyers@polymtl.ca \
/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.