From: george anzinger <george@mvista.com>
To: Bernardo Innocenti <bernie@develer.com>
Cc: Andrew Morton <akpm@osdl.org>,
linux-kernel@vger.kernel.org, rmk@arm.linux.org.uk,
torvalds@osdl.org
Subject: Re: do_div64 generic
Date: Thu, 17 Jul 2003 16:09:13 -0700 [thread overview]
Message-ID: <3F172C99.40002@mvista.com> (raw)
In-Reply-To: <200307172310.48918.bernie@develer.com>
Bernardo Innocenti wrote:
> On Wednesday 16 July 2003 20:33, Bernardo Innocenti wrote:
>
>
>>>>Bernardo, can you do the patch please?
>>
>> I would be glad to do it once the discussion has settled, whatever
>>the final decision will be. Just don't make me do it twice, please ;-)
>
>
> So far nobody have commented and the problem is still unaddressed.
> What shall I do? As far as I can tell, our options are:
>
> 1) add surrogates of div_long_long_rem() in asm-generic/div64.h and in
> all other archs that have their own optimized versions of do_div().
> I already have a patch for this, but it has been tested only on i386
> and m68knommu.
>
> 2) replace all uses of div_long_long_rem() (I see onlt 4 of them in
> 2.6.0-test1) with do_div(). This is slightly less efficient, but
> easier to maintain in the long term.
Actually, the macro to do this is already there. Is there a real
reason not to use it. The using code sure looks cleaner with it.
>
> I shall note that I _hate_ fixing compiler problems in the kernel. The
> real fix I'm dreaming involves adding specialized patterns in GCC to
> generate an optimal instruction sequence for all these cases.
I would love to get to the instruction via normal C.
>
> Of course we should realize that we need to support older versions of
> GCC and, even if we didn't, we can't wait for the next GCC release :-)
>
> So, if we're going to live with do_div(), I think we could as well
> have a set of macros for the most frequent cases. I've just spotted
> another candidate in kernel/posix-timers.c: mpy_l_X_l_ll().
The mpy_l_X_l_ll() is there because it is so easy to get it wrong. It
is standard C (well gcc) but if you don't get the casting just right
it will throw away the high bits.
>
> This is not a third option for fixing our immediate problem: it's
> just an idea for future improvement.
>
> Andrew, George, please comment.
Is there any need to change any thing at all? Or maybe a comment
somewhere on what direction we would like things to go.
When I look at the div code on the risc machines I begin to really
understand why gcc avoids the div instruction so actively. (It
optimizes away almost all divides by constants.)
>
--
George Anzinger george@mvista.com
High-res-timers: http://sourceforge.net/projects/high-res-timers/
Preemption patch: http://www.kernel.org/pub/linux/kernel/people/rml
prev parent reply other threads:[~2003-07-17 22:55 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <3F1360F4.2040602@mvista.com>
2003-07-15 5:17 ` do_div64 generic Bernardo Innocenti
2003-07-15 5:38 ` Andrew Morton
2003-07-15 6:23 ` Bernardo Innocenti
2003-07-15 6:30 ` Andrew Morton
2003-07-15 21:52 ` george anzinger
2003-07-15 22:06 ` Andrew Morton
2003-07-16 0:07 ` george anzinger
2003-07-16 18:33 ` Bernardo Innocenti
2003-07-17 21:10 ` Bernardo Innocenti
2003-07-17 21:16 ` Andrew Morton
2003-07-17 22:43 ` Bernardo Innocenti
2003-07-17 23:10 ` george anzinger
2003-07-18 3:19 ` Andrew Morton
2003-07-18 4:14 ` Bernardo Innocenti
2003-07-17 23:09 ` george anzinger [this message]
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=3F172C99.40002@mvista.com \
--to=george@mvista.com \
--cc=akpm@osdl.org \
--cc=bernie@develer.com \
--cc=linux-kernel@vger.kernel.org \
--cc=rmk@arm.linux.org.uk \
--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