Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1349728 > unrolled thread
| Started by | Maxim Patlasov <mpatlasov@virtuozzo.com> |
|---|---|
| First post | 2016-03-04 01:40 +0100 |
| Last post | 2016-03-04 01:50 +0100 |
| Articles | 2 — 2 participants |
Back to article view | Back to linux.kernel
[PATCH] tmpfs: shmem_fallocate must return ERESTARTSYS Maxim Patlasov <mpatlasov@virtuozzo.com> - 2016-03-04 01:40 +0100
Re: [PATCH] tmpfs: shmem_fallocate must return ERESTARTSYS Mike Kravetz <mike.kravetz@oracle.com> - 2016-03-04 01:50 +0100
| From | Maxim Patlasov <mpatlasov@virtuozzo.com> |
|---|---|
| Date | 2016-03-04 01:40 +0100 |
| Subject | [PATCH] tmpfs: shmem_fallocate must return ERESTARTSYS |
| Message-ID | <r8LWF-6Q3-1@gated-at.bofh.it> |
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. Signed-off-by: Maxim Patlasov <mpatlasov@virtuozzo.com> --- mm/shmem.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/mm/shmem.c b/mm/shmem.c index 440e2a7..60e9c8a 100644 --- a/mm/shmem.c +++ b/mm/shmem.c @@ -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
[toc] | [next] | [standalone]
| From | Mike Kravetz <mike.kravetz@oracle.com> |
|---|---|
| Date | 2016-03-04 01:50 +0100 |
| Message-ID | <r8M6m-6Us-3@gated-at.bofh.it> |
| In reply to | #1349728 |
On 03/03/2016 04:30 PM, Maxim Patlasov wrote:
> 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.
>
> Signed-off-by: Maxim Patlasov <mpatlasov@virtuozzo.com>
> ---
> mm/shmem.c | 8 +++++---
> 1 file changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/mm/shmem.c b/mm/shmem.c
> index 440e2a7..60e9c8a 100644
> --- a/mm/shmem.c
> +++ b/mm/shmem.c
> @@ -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
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.
--
Mike Kravetz
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web