Re: [PATCH] sort: use posix_fadvise to announce access patterns on files
From:
Jim Meyering
Subject:
Re: [PATCH] sort: use posix_fadvise to announce access patterns on files opened for reading
Date:
Wed, 03 Mar 2010 12:43:13 +0100
PƔdraig Brady wrote:
> On 02/03/10 22:51, PƔdraig Brady wrote:
>> I'll apply the patch with SEQUENTIAL enabled,
>> and summarise in a comment the results we've uncovered.
>
> I'll push the attached later today, unless there are objections.
Nice work.
Thanks to both of you!
You must have a few small stand-alone tests that run timings.
If you post one or two, I'll run them on a variety of
hardware and newer kernels.
...
> * configure.ac: check for posix_fadvise().
> * src/sort.c (fadvise_input): A new function to apply
> the POSIX_FADV_SEQUENTIAL hint to an input stream.
> (stream_open): Call the above function for all input streams.
> ---
> configure.ac | 3 ++
> src/sort.c | 70 +++++++++++++++++++++++++++++++++++++++++++++++++++++++--
> 2 files changed, 70 insertions(+), 3 deletions(-)
>
> diff --git a/configure.ac b/configure.ac
> index b07a52b..c07fbd4 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -344,6 +344,9 @@ if test "$elf_sys" = "yes" && \
> gl_ADD_PROG([optional_pkglib_progs], [libstdbuf.so])
> fi
>
> +# Check for fcntl.h/posix_fadvise
> +AC_CHECK_HEADERS(fcntl.h, [AC_CHECK_FUNCS(posix_fadvise)])
There's no need to test for fcntl.h.
Instead, please add this line to m4/jm-macros.m4, right after this comment:
# Used by sort.c.
AC_CHECK_FUNCS_ONCE([posix_fadvise])