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

Pekka Paalanen ppaalanen at gmail.com
Thu Apr 28 09:57:00 UTC 2016


On Thu, 28 Apr 2016 12:49:45 +0300
Ian Ray <ian.ray at ge.com> wrote:

> Block signals during the call to posix_fallocate, because that api does
> an explicit rollback if it gets EINTR and on slow systems (particularly
> with large allocation sizes) the smart scheduler's SIGALRM will prevent
> posix_fallocate from ever successfully completing.
> 
> Signed-off-by: Ian Ray <ian.ray at ge.com>
> ---
>  hw/xwayland/xwayland-shm.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/hw/xwayland/xwayland-shm.c b/hw/xwayland/xwayland-shm.c
> index c199e5e..4133a7d 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,11 @@ os_create_anonymous_file(off_t size)
>          return -1;
>  
>  #ifdef HAVE_POSIX_FALLOCATE
> +    OsBlockSignals();
>      do {
>          ret = posix_fallocate(fd, 0, size);
>      } while (ret == EINTR);
> +    OsReleaseSignals();
>  
>      if (ret != 0) {
>          close(fd);

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

I'll leave it to the X developers to check the code is actually
correct. This might warrant a nice comment in the code too, to explain
what is going on.


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/20160428/4189a4d6/attachment.sig>


More information about the xorg-devel mailing list