[PATCH] hdparm utilizes shared memory for no good reason ?

Mike Frysinger vapier at gentoo.org
Wed May 17 03:44:26 UTC 2006


On Tuesday 16 May 2006 16:51, Michael S. Zick wrote:
> On Tue May 16 2006 15:23, Tito wrote:
> > The patches are both tested and seem to work on my system, but
> > don't ask why this shm* stuff was used because I don't know
>
> Most likely for more reliable timings. Fewer copies into userspace.
> I admit not looking at the code - but it is probably:

that makes sense ... the code gets a shared memory buffer, locks it from being 
swapped out, and then runs read(fd, shared memory buffer)

> loop copy(kernel_space device buffer) -> (kernel_space shm_buffer) repeat;
> if the code returns the data read at all, then it would do a single,
> expensive, unknown time, copy_to_userspace.
>
> Putting the buffer in userland forces a copy_to_userspace for each device
> buffer worth of data.  That is a lot of unknown time on a time-sliced
> kernel.

there is only one read so while it would affect the statistics, it wouldnt be 
a huge difference i dont think
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 827 bytes
Desc: not available
Url : http://lists.busybox.net/pipermail/busybox/attachments/20060516/7261b789/attachment-0002.pgp 


More information about the busybox mailing list