Re: [PATCH V2 1/2] ftrace: Make saved_cmdlines use seq_read

Steven Rostedt
2014-05-30T03:08:36Z

On Thu, 20 Feb 2014 17:44:31 +0900
Yoshihiro YUNOMAE <yoshihiro.yunomae.ez@hitachi.com> wrote:

> Current tracing_saved_cmdlines_read() implementation is naive;
> simply allocate a big buffer, construct output data on the
> buffer for each read operation, and then copy a portion of
> the buffer to the user space buffer. This can cause a couple of
> issues such as a slow memory allocation, high cpu usage, and a
> corruption of the output data.
>
> To address these issues, make saved_cmdlines use seq_read.

I changed the subject and change log to the following. The patch is
untouched:

tracing: Have saved_cmdlines use the seq_read infrastructure

Current tracing_saved_cmdlines_read() implementation is naive; It
allocates a large buffer, constructs output data to that buffer for
each read operation, and then copies a portion of the buffer to the
user space buffer. This has several issues such as slow memory
allocation, high CPU usage, and even corruption of the output data.

The seq_read infrastructure is made to handle this type of work.
By converting it to use seq_read() the code becomes smaller,
simplified, as well as correct.

-- Steve