FADV_DONTNEED support

Ben Gamari bgamari.foss at gmail.com
Fri Feb 17 17:54:08 MST 2012


While going through an old todo list I found that these patches had fallen by
the way-side. About a year ago I initiated a discussion[1] with the Linux
kernel folks regarding the lack of any useable fadvise support on the kernel
side. As a result, I was observing extremely poor performance on my server
after backup as executable pages were being swapped out in favor of data
waiting to be flushed to disk. This is an extremely poor trade-off in the case
of a backup but the user-mode had no way to communicate this to the kernel as few POSIX implementations had working implementations of fadvise.

While there was at least one[1] attempt at making kernels' limited fadvise
implementations work for rsync, it was quite awkward and it was understandably
deemed inappropriate for merge. As a result of discussions with Minchan Kim and
KOSAKI Motohiro, Linux has had reasonable support for handling
POSIX_FADV_DONTNEED[3]. In particular, issuing this hint will compel the kernel
to try reclaiming the affected pages more quickly, which should reduce memory
pressure by dirty pages.

The accompanying patches adds support for this hint when available. Currently
DONTNEED is issued unconditionally although it could be conditioned on a flag
if this is deemed more inappropriate.

Cheers,

- Ben


[1] http://marc.info/?l=rsync&m=128885034930933&w=2
[2] http://insights.oetiker.ch/linux/fadvise.html
[3] http://kernel.opensuse.org/cgit/kernel/commit/?id=315601809d124d046abd6c3ffa346d0dbd7aa29d&ignorews=1



More information about the rsync mailing list