mm: fadvise: avoid fadvise for fs without backing device
+linux-mm, linux-kernel
Quoted 45 lines · Shakeel Butt
The
fadvise()manpage is silent on fadvise()'s effect on memory-based filesystems (shmem, hugetlbfs & ramfs) and pseudo file systems (procfs, sysfs, kernfs). The current implementaion of fadvise is mostly a noop for such filesystems except forFADV_DONTNEEDwhich will trigger expensive remote LRU cache draining. This patch makes the noop offadvise()on such file systems very explicit.However this change has two side effects for ramfs and one for tmpfs. First
fadvise(FADV_DONTNEED)can remove the unmapped clean zero'ed pages of ramfs (allocated through read, readahead & read fault) and tmpfs (allocated through read fault). Alsofadvise(FADV_WILLNEED)on create such clean zero'ed pages for ramfs. This change removes these two interfaces.Signed-off-by Shakeel Butt <[email protected]>--- mm/fadvise.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)mm/fadvise.c +3
-4@@ -52,7 +52,9 @@ SYSCALL_DEFINE4(fadvise64_64, int, fd, loff_t, offset, loff_t, len, int, advice) goto out; } -if (IS_DAX (inode)) { + bdi =inode_to_bdi (mapping->host); + +if (IS_DAX (inode) || (bdi == &noop_backing_dev_info)) {switch (advice) {case POSIX_FADV_NORMAL :case POSIX_FADV_RANDOM :@@ -75,8 +77,6 @@ SYSCALL_DEFINE4(fadvise64_64, int, fd, loff_t, offset, loff_t, len, int, advice)else endbyte--;/* inclusive */ - bdi =inode_to_bdi (mapping->host); -switch (advice) {case POSIX_FADV_NORMAL : f.file->f_ra.ra_pages = bdi->ra_pages; --
Quoted 2 lines
2.14.1.480.gb18f417b89-goog
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Andrew Morton
maintainerQuoted 18 lines · On Thu, 17 Aug 2017 18:20:17 -0700 Shakeel Butt <[email protected]> wrote:
+linux-mm, linux-kernel
Quoted 15 lines · Shakeel Butt
The
fadvise()manpage is silent on fadvise()'s effect on memory-based filesystems (shmem, hugetlbfs & ramfs) and pseudo file systems (procfs, sysfs, kernfs). The current implementaion of fadvise is mostly a noop for such filesystems except forFADV_DONTNEEDwhich will trigger expensive remote LRU cache draining. This patch makes the noop offadvise()on such file systems very explicit.However this change has two side effects for ramfs and one for tmpfs. First
fadvise(FADV_DONTNEED)can remove the unmapped clean zero'ed pages of ramfs (allocated through read, readahead & read fault) and tmpfs (allocated through read fault). Alsofadvise(FADV_WILLNEED)on create such clean zero'ed pages for ramfs. This change removes these two interfaces.
It doesn't sound like a risky change to me, although perhaps someone is depending on the current behaviour for obscure reasons, who knows.
What are the reasons for this change? Is the current behaviour causing some sort of problem for someone?
Quoted 21 lines · Andrew Morton
Quoted 18 lines · On Thu, 17 Aug 2017 18:20:17 -0700 Shakeel Butt <[email protected]> wrote:
+linux-mm, linux-kernel
Quoted 15 lines · Shakeel Butt
The
fadvise()manpage is silent on fadvise()'s effect on memory-based filesystems (shmem, hugetlbfs & ramfs) and pseudo file systems (procfs, sysfs, kernfs). The current implementaion of fadvise is mostly a noop for such filesystems except forFADV_DONTNEEDwhich will trigger expensive remote LRU cache draining. This patch makes the noop offadvise()on such file systems very explicit.However this change has two side effects for ramfs and one for tmpfs. First
fadvise(FADV_DONTNEED)can remove the unmapped clean zero'ed pages of ramfs (allocated through read, readahead & read fault) and tmpfs (allocated through read fault). Alsofadvise(FADV_WILLNEED)on create such clean zero'ed pages for ramfs. This change removes these two interfaces.
Quoted 5 lines
It doesn't sound like a risky change to me, although perhaps someone is depending on the current behaviour for obscure reasons, who knows.
What are the reasons for this change? Is the current behaviour causing some sort of problem for someone?
Yes, one of our generic library does fadvise(FADV_DONTNEED). Recently we observed high latency in fadvise() and notice that the users have started using tmpfs files and the latency was due to expensive remote LRU cache draining. For normal tmpfs files (have data written on them), fadvise(FADV_DONTNEED) will always trigger the un-needed remote cache draining.
Quoted 2 lines
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Quoted 6 lines
Quoted 5 lines
It doesn't sound like a risky change to me, although perhaps someone is depending on the current behaviour for obscure reasons, who knows.
What are the reasons for this change? Is the current behaviour causing some sort of problem for someone?
Quoted 7 lines
Yes, one of our generic library does
fadvise(FADV_DONTNEED). Recently we observed high latency infadvise()and notice that the users have started using tmpfs files and the latency was due to expensive remote LRU cache draining. For normal tmpfs files (have data written on them),fadvise(FADV_DONTNEED)will always trigger the un-needed remote cache draining.
Hi Andrew, do you have more comments or concerns?
Quoted 2 lines
Quoted 2 lines
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Andrew Morton
maintainerQuoted 17 lines · On Thu, 17 Aug 2017 18:20:17 -0700 Shakeel Butt <[email protected]> wrote:
+linux-mm, linux-kernel
Quoted 14 lines · Shakeel Butt
The
fadvise()manpage is silent on fadvise()'s effect on memory-based filesystems (shmem, hugetlbfs & ramfs) and pseudo file systems (procfs, sysfs, kernfs). The current implementaion of fadvise is mostly a noop for such filesystems except forFADV_DONTNEEDwhich will trigger expensive remote LRU cache draining. This patch makes the noop offadvise()on such file systems very explicit.However this change has two side effects for ramfs and one for tmpfs. First
fadvise(FADV_DONTNEED)can remove the unmapped clean zero'ed pages of ramfs (allocated through read, readahead & read fault) and tmpfs (allocated through read fault). Alsofadvise(FADV_WILLNEED)on create such clean zero'ed pages for ramfs.
That sentence makes no sense. I assume "fadvise(FADV_WILLNEED) will create"?
Quoted 20 lines · Andrew Morton
Quoted 17 lines · On Thu, 17 Aug 2017 18:20:17 -0700 Shakeel Butt <[email protected]> wrote:
+linux-mm, linux-kernel
Quoted 14 lines · Shakeel Butt
The
fadvise()manpage is silent on fadvise()'s effect on memory-based filesystems (shmem, hugetlbfs & ramfs) and pseudo file systems (procfs, sysfs, kernfs). The current implementaion of fadvise is mostly a noop for such filesystems except forFADV_DONTNEEDwhich will trigger expensive remote LRU cache draining. This patch makes the noop offadvise()on such file systems very explicit.However this change has two side effects for ramfs and one for tmpfs. First
fadvise(FADV_DONTNEED)can remove the unmapped clean zero'ed pages of ramfs (allocated through read, readahead & read fault) and tmpfs (allocated through read fault). Alsofadvise(FADV_WILLNEED)on create such clean zero'ed pages for ramfs.
Quoted 3 lines
That sentence makes no sense. I assume "
fadvise(FADV_WILLNEED)will create"?
Sorry about that, it should be "fadvise(FADV_WILLNEED) can create".
Quoted 1 line
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>