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 <[email protected]>
---
 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);
-- 
2.4.5

_______________________________________________
[email protected]: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel

Reply via email to