From 795b0e7ea1cc7098fcbb76858014ffccffbf8624 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Ekl=C3=B6f?= Date: Sun, 22 Mar 2020 21:04:00 +0100 Subject: [PATCH] shm: print performance warning when FALLOC_FL_PUNCH_HOLE isn't supported --- shm.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/shm.c b/shm.c index 2f74fc0b..b9cc325c 100644 --- a/shm.c +++ b/shm.c @@ -233,6 +233,12 @@ shm_get_buffer(struct wl_shm *shm, int width, int height, unsigned long cookie) can_punch_hole_initialized = true; can_punch_hole = fallocate( pool_fd, FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE, 0, 1) == 0; + + if (!can_punch_hole) { + LOG_WARN( + "fallocate(FALLOC_FL_PUNCH_HOLE) not " + "supported (%s): expect lower performance", strerror(errno)); + } } /* Push to list of available buffers, but marked as 'busy' */ @@ -324,9 +330,6 @@ shm_scroll(struct wl_shm *shm, struct buffer *buf, int rows) /* Free unused memory */ if (fallocate(buf->fd, FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE, 0, new_offset) < 0) { - LOG_ERRNO( - "fallocate(FALLOC_FL_PUNCH_HOLE) not " - "supported: expect lower performance"); abort(); }