[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [coreutils] [PATCH] fadvise: new module providing a simpler interfac
From: |
Jim Meyering |
Subject: |
Re: [coreutils] [PATCH] fadvise: new module providing a simpler interface to posix_fadvise |
Date: |
Tue, 20 Jul 2010 16:28:45 +0200 |
Pádraig Brady wrote:
> To get the same benefits noticed with `sort`
> http://git.savannah.gnu.org/gitweb/?p=coreutils.git;a=commit;h=dae35bac
> I'm applying the same hint to all appropriate utils in the attached.
...
> Linux does quite well without this hint, and is getting better:
> http://article.gmane.org/gmane.linux.kernel.mm/43753
> http://lkml.org/lkml/2010/2/3/27
> However I saw a small benefit on my system with
> fast flash devices (around 5% less run time) and perhaps
Nice!
> 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.