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

Ian Ray ian.ray at ge.com
Thu Apr 28 09:49:45 UTC 2016


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);
-- 
2.4.5



More information about the xorg-devel mailing list