tmpfs: shmem_fallocate must return ERESTARTSYS
Subsystems (2)
PATCH 1/1 tmpfs: shmem_fallocate must return ERESTARTSYS
shmem_fallocate() is restartable, so it can return ERESTARTSYS if signal_pending(). Although fallocate(2) manpage permits EINTR, the more places use ERESTARTSYS the better.
--- mm/shmem.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
mm/shmem.c +5 -3
@@ -2229,11 +2229,13 @@ static long shmem_fallocate(struct file *file, int mode, loff_t offset,struct page *page;/* -* Good, the fallocate(2) manpage permits EINTR: we may have -* been interrupted because we are using up too much memory. +* Although fallocate(2) manpage permits EINTR, the more +* places use ERESTARTSYS the better. If we have been +* interrupted because we are using up too much memory, +* oom-killer used fatal signal and we will die anyway. */ if (signal_pending (current)) - error = -EINTR ; + error = -ERESTARTSYS ;else if (shmem_falloc.nr_unswapped > shmem_falloc.nr_falloced) error = -ENOMEM ;else
--
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 20 lines · Maxim Patlasov
shmem_fallocate()is restartable, so it can return ERESTARTSYS ifsignal_pending(). Although fallocate(2) manpage permits EINTR, the more places use ERESTARTSYS the better.Signed-off-by Maxim Patlasov <[email protected]>--- mm/shmem.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)mm/shmem.c +1
-2@@ -2229,11 +2229,13 @@ static long shmem_fallocate(struct file *file, int mode, loff_t offset,struct page *page;/* -* Good, the fallocate(2) manpage permits EINTR: we may have -* been interrupted because we are using up too much memory. +* Although fallocate(2) manpage permits EINTR, the more
mm/shmem.c static long shmem_fallocate(struct file *file, int mode, loff_t offset, · line 2241
Quoted 10 lines
mm/shmem.c +4
-1+* places use ERESTARTSYS the better. If we have been +* interrupted because we are using up too much memory, +* oom-killer used fatal signal and we will die anyway. */ if (signal_pending (current)) - error = -EINTR ; + error = -ERESTARTSYS ;else if (shmem_falloc.nr_unswapped > shmem_falloc.nr_falloced) error = -ENOMEM ;else
I used the shmem fallocate code as a basis for hugetlbfs fallocate. See, hugetlbfs_fallocate(). Specifically:
/*
* fallocate(2) manpage permits EINTR; we may have been
* interrupted because we are using up too much memory.
*/
if (signal_pending(current)) {
error = -EINTR;
break;
}I don't know much about the advantages of changing to ERESTARTSYS. But, if it is changed for shmem it should be changed for hugetlbfs as well.
Signature · 7 lines
Mike Kravetz -- 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>