Re: Can and should the kernel HZ value be changed?

Richard B. Johnson (root@chaos.analogic.com)
Thu, 7 Jan 1999 13:13:16 -0500 (EST)


On Thu, 7 Jan 1999, Chris Wedgwood wrote:

> On Tue, Jan 05, 1999 at 05:16:16PM +0000, Egil Kvaleberg wrote:
>
> > And, with the 32 bit jiffies used for i386, also the problem of
> > roll-over becoming more pronounced.
>
> Er.. no. Its been fixed more or less if people use the new(ish) API's
> to jiffy delays -- it's only differences in time we need to measure
> nothing absolute.
>
> > This can be handled, for instance by making jiffies long long (at a
> > cost) or by implementing a jiffy overflow counter applicable for
> > jiffiestotimespec, sysinfo uptime and such.
>
> Oh -- and gcc sucks rocks at geenrate long long code. Not helped by
> the fact ia32 is a horribly register starved processor.
>

Not so. Long long stuff is as good as anyone should expect on a 32-bit
machine. It's a lot better than 680xx stuff I've seen from compilers.

/*
* This dereferencing make sure gcc doesn't optimize this away
* as constants.
*/
static long long wfoo = 0x12345678deadface;
static long long wbar = 0x12345678beadcaee;
volatile long long *foo = &wfoo;
volatile long long *bar = &wbar;
main()
{
long long a, b, c;
a = *foo;
b = *bar;
c = a * b;
printf("%lld\n", c);
c = a / b;
printf("%lld\n", c);
c = a + b;
printf("%lld\n", c);
c = a - b;
printf("%lld\n", c);
return 0;
}
[SNIPPED init and global data for brevity]
main:
pushl %ebp
movl %esp,%ebp
subl $28,%esp
pushl %esi
pushl %ebx

double-precision integer multiplication in-line

movl foo,%eax
movl (%eax),%edx
movl %edx,-8(%ebp)
movl 4(%eax),%edx
movl %edx,-4(%ebp)
movl bar,%eax
movl (%eax),%ebx
movl 4(%eax),%esi
movl -8(%ebp),%eax
mull %ebx
movl %eax,-28(%ebp)
movl %edx,-24(%ebp)
movl -8(%ebp),%edx
imull %esi,%edx
addl %edx,-24(%ebp)
movl -4(%ebp),%eax
imull %ebx,%eax
addl %eax,-24(%ebp)

pushl -24(%ebp)
pushl -28(%ebp)
pushl $.LC0
call printf
pushl %esi
pushl %ebx
pushl -4(%ebp)
pushl -8(%ebp)
call __divdi3 # They didn't do this in-line
addl $16,%esp
movl %eax,-20(%ebp)
movl %edx,-16(%ebp)
pushl %edx
pushl %eax
pushl $.LC0
call printf

Double precision addition in-line.

movl -8(%ebp),%eax
movl -4(%ebp),%edx
addl %ebx,%eax
adcl %esi,%edx
movl %eax,-28(%ebp)
movl %edx,-24(%ebp)

pushl %edx
pushl %eax
pushl $.LC0
call printf

double precision subtraction in-line

movl -8(%ebp),%eax
movl -4(%ebp),%edx
subl %ebx,%eax
sbbl %esi,%edx
movl %eax,-28(%ebp)
movl %edx,-24(%ebp)

addl $36,%esp
pushl %edx
pushl %eax
pushl $.LC0
call printf
xorl %eax,%eax
leal -36(%ebp),%esp
popl %ebx
popl %esi
movl %ebp,%esp
popl %ebp
ret

Looks pretty damn good to me.

Cheers,
Dick Johnson
***** FILE SYSTEM WAS MODIFIED *****
Penguin : Linux version 2.1.131 on an i686 machine (400.59 BogoMips).
Warning : It's hard to remain at the trailing edge of technology.
Wisdom : It's not a Y2K problem. It's a Y2Day problem.

-
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/