[xserver-xorg][PATCH V2 1/1] xwayland-shm: block signals during fallocate

Pekka Paalanen ppaalanen at gmail.com
Wed May 25 07:54:50 UTC 2016


On Wed, 25 May 2016 10:41:53 +0300
Ian Ray <ian.ray at ge.com> wrote:

> posix_fallocate() does an explicit rollback if it gets EINTR, and
> this is a problem on slow systems because when the allocation size
> is sufficiently large posix_fallocate() will always be interrupted
> by the smart scheduler's SIGALRM.
> 
> Changes since v1 - big comment in the code to explain what is going on
> 
> Signed-off-by: Ian Ray <ian.ray at ge.com>
> ---
>  hw/xwayland/xwayland-shm.c | 10 ++++++++++
>  1 file changed, 10 insertions(+)
> 
> diff --git a/hw/xwayland/xwayland-shm.c b/hw/xwayland/xwayland-shm.c
> index c199e5e..82a9414 100644
> --- a/hw/xwayland/xwayland-shm.c
> +++ b/hw/xwayland/xwayland-shm.c
> @@ -28,6 +28,8 @@
>  #include <dix-config.h>
>  #endif
>  
> +#include "os.h"
> +
>  #include "xwayland.h"
>  
>  #include <sys/mman.h>
> @@ -140,9 +142,17 @@ os_create_anonymous_file(off_t size)
>          return -1;
>  
>  #ifdef HAVE_POSIX_FALLOCATE
> +    /*
> +     * posix_fallocate does an explicit rollback if it gets EINTR.
> +     * Temporarily block signals to allow the call to succeed on
> +     * slow systems where the smart scheduler's SIGALRM prevents
> +     * large allocation attempts from ever succeeding.
> +     */
> +    OsBlockSignals();
>      do {
>          ret = posix_fallocate(fd, 0, size);
>      } while (ret == EINTR);
> +    OsReleaseSignals();
>  
>      if (ret != 0) {
>          close(fd);

This is still:
Acked-by: Pekka Paalanen <pekka.paalanen at collabora.co.uk>


Thanks,
pq
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 811 bytes
Desc: OpenPGP digital signature
URL: <https://lists.x.org/archives/xorg-devel/attachments/20160525/6d78db17/attachment-0001.sig>


More information about the xorg-devel mailing list