lkml.org 
[lkml]   [1999]   [May]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: long long in kernel
Date
From
Marc Unangst <mju@cs.cmu.edu> replied:
> Jes.Sorensen@cern.ch (Jes Sorensen) writes:
> > I am curious, what sorta device requires 64 bit entities on a 32 bit
> > architecture?
>
> There are a lot of reasons to want 64-bit quantities in the kernel --
> if you are doing filesystems or I/O work, you frequently want more
> than 32 bits to represent a file offset or object length.

Yes, sure. However in certain commonly used register poor 32-bit
architechtures doing 64-bit adding/comparing is rather memory intensive
thing, as the processor must keep loading items for processing.

Basic adding, substracting, comparing, and shifting are handled by
the gcc internal templates, but more complex things like division,
modulus, and multiplying usually aren't...

...
> To port our research code we had to get around this problem, and ended
> up just linking libgcc.a into the kernel. It works fine, and since
> the Linux kernel depends on gcc in a number of other places, it
> doesn't seem to raise the bar any.

I am usually doing great lengths of code massage to get away without
the need to do generic division or modulus operations (or multiplications,
though those are rare) in the kernel.

You see, usually (long long)/(const int) (and modulus of the same)
doesn't collapse in the optimization phase at i386 into some neat
(long long) >> const_shift_value
expressions, even when it could.

Related: The reason why the HZ at Alpha is 1024, and not 1000, seems
to be ability to do certain "divisions" with simple shifts.
(Alpha does not have division instruction, rather one must use
an assembly subroutine for one bit at a time division -- but
executing it 64 rounds within the icache is faster, than trying
more advanced resiprocal table lookups -- just because single
cache miss can take more time, than executing the iterator..)

> -Marc Unangst
> Research Programmer, Parallel Data Lab
> Carnegie Mellon University School of Computer Science
> mju@cs.cmu.edu

/Matti Aarnio <matti.aarnio@sonera.fi>

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:51    [W:0.087 / U:0.580 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site