[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [coreutils] [PATCH] fadvise: new module providing a simpler interfac
Re: [coreutils] [PATCH] fadvise: new module providing a simpler interface to posix_fadvise
Tue, 20 Jul 2010 16:28:45 +0200
Pádraig Brady wrote:
> To get the same benefits noticed with `sort`
> I'm applying the same hint to all appropriate utils in the attached.
> Linux does quite well without this hint, and is getting better:
> However I saw a small benefit on my system with
> fast flash devices (around 5% less run time) and perhaps
> the kernel can use this info in more sophisticated ways in future.
> diff --git a/src/wc.c b/src/wc.c
> @@ -211,6 +212,10 @@ wc (int fd, char const *file_x, struct fstatus *fstatus)
> count_complicated = print_words || print_linelength;
> + /* Only advise the kernel of our access pattern if we need to read(). */
> + if (!count_bytes || count_chars || print_lines || count_complicated)
> + fdadvise (fd, 0, 0, FADVISE_SEQUENTIAL);
If you reword that comment
/* Advise the kernel of our access pattern only if we will read(). */
it won't imply that advising is all it does in that case.