public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
[parent not found: <2mN94-3MP-9@gated-at.bofh.it>]
* stat very inefficient
@ 2004-07-28  3:13 David S. Miller
  2004-07-28 18:07 ` viro
  0 siblings, 1 reply; 21+ messages in thread
From: David S. Miller @ 2004-07-28  3:13 UTC (permalink / raw)
  To: linux-kernel; +Cc: viro


All of the *stat*() syscall routines copy the inode attributes
around a whopping _3_ times before they get to userspace.

1) From inode to "struct kstat"
2) From "struct kstat" to "struct stat{,64}" on local kernel stack
3) From local kernel stack to userspace

That's rediculious.  And also the stores into the various
structures are not done in ascending order and thus all of
the store buffers on various cpus never get a reasonable
store stream for maximal store buffer compression.

The reason things happen this way is that each implementation
of the various stat structures have padding in different places
and/or have other layout issues.  The simplest thing to do
is memset() the thing, fill in the non-pad parts, and copy
it into user space.

We should be able to do this with just 2 copies as I recognize
the reason why the struct kstat abstraction exists.

I was about to make sparc64 specific copies of all the stat
system calls in order to optimize this properly.  But that
makes little sense, instead I think fs/stat.c should call
upon arch-specific stat{,64} structure fillin routines that
can do the magic, given a kstat struct.

Comments?

^ permalink raw reply	[flat|nested] 21+ messages in thread

end of thread, other threads:[~2004-07-29 11:42 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <233602095@toto.iv>
2004-07-28 22:33 ` stat very inefficient Peter Chubb
2004-07-28 22:45   ` David S. Miller
2004-07-29  0:08     ` Chris Wedgwood
2004-07-29  0:14       ` David S. Miller
2004-07-29  0:24         ` Chris Wedgwood
2004-07-29  0:29         ` viro
2004-07-29  7:26           ` Peter Chubb
2004-07-29  7:42             ` Andrew Morton
2004-07-29  8:49               ` Paul Jackson
2004-07-29  9:02                 ` Andrew Morton
2004-07-29  9:17                   ` Peter Chubb
2004-07-29  7:45             ` Ulrich Drepper
2004-07-29 11:42         ` Nigel Rantor
2004-07-29  1:07     ` Ulrich Drepper
2004-07-29  2:22       ` Paul Jackson
2004-07-29  4:10         ` Ulrich Drepper
2004-07-29  6:18           ` Paul Jackson
     [not found] <2mN94-3MP-9@gated-at.bofh.it>
2004-07-28 10:16 ` Andi Kleen
2004-07-28 15:38   ` David S. Miller
2004-07-28  3:13 David S. Miller
2004-07-28 18:07 ` viro

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox