[PATCH] hdparm utilizes shared memory for no good reason ?
Michael S. Zick
mszick at morethan.org
Tue May 16 20:51:51 UTC 2006
On Tue May 16 2006 15:23, Tito wrote:
>
> Hi, attached are 2 patches to resolve this hdparm shared memory problem.
>
> the first patch adds a config option to disable the use of shared memory segments when performing
> timings on devices and substitute them with static or malloced buffers.
>
> the second alternative patch removes the use of shm* calls totally.
>
> 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:
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.
- - -
But this is BB not a hard drive diagnostic/benchmark tool - you only need
go/no-go measurements of an option change. Userspace buffers should be fine.
Mike
More information about the busybox
mailing list