This is the mail archive of the
libc-alpha@sources.redhat.com
mailing list for the glibc project.
Re: horrible disk thorughput on itanium
- From: Linus Torvalds <torvalds at transmeta dot com>
- To: Andreas Jaeger <aj at suse dot de>
- Cc: <libc-alpha at sources dot redhat dot com>
- Date: Fri, 7 Dec 2001 16:03:30 -0800 (PST)
- Subject: Re: horrible disk thorughput on itanium
On Fri, 7 Dec 2001, Andreas Jaeger wrote:
>
> This should be doable. We could easily implement libio/putc.c as
> follows:
I would suggest doing the test at "lock" time, and getting rid of the
locks ALWAYS.
If you want to be clever, you can do this with clever mmap tricks, or even
self-modifying code. Have a page that defaults to mapping just a plain
"ret", for both lock and unlock. Then, when you call "pthread_create()",
you change the code to actually do the locking, either by mmap'ing another
library in that one page or by just doing self-modifying code.
(Mmaping is nicer for the VM and might be cleaner, and you could select
different files for SMP vs UP, and make the locking even _faster_ that
way).
That way _all_ of stdio could _always_ do the locking, but by default the
locking would be very cheap (a static function call to a "ret" - just a
few cycles)
Remember: it's not just putc() that probably sees the overhead of locking.
I bet that locking is quite noticeable in other parts too.
Linus