[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250218232552.3450939-2-adrian.larumbe@collabora.com>
Date: Tue, 18 Feb 2025 23:25:31 +0000
From: Adrián Larumbe <adrian.larumbe@...labora.com>
To: dri-devel@...ts.freedesktop.org,
linux-kernel@...r.kernel.org,
Boris Brezillon <boris.brezillon@...labora.com>,
Steven Price <steven.price@....com>,
Rob Herring <robh@...nel.org>,
Hugh Dickins <hughd@...gle.com>
Cc: kernel@...labora.com,
Adrián Larumbe <adrian.larumbe@...labora.com>,
linux-mm@...ck.org
Subject: [RFC PATCH 1/7] shmem: Introduce non-blocking allocation of shmem pages
With the future goal of preventing deadlocks with the shrinker when reclaiming
GEM-allocated memory, a variant of shmem_read_mapping_page_gfp() that does not
sleep when enough memory isn't available, therefore potentially triggering the
shrinker on same driver, is introduced.
Signed-off-by: Adrián Larumbe <adrian.larumbe@...labora.com>
---
include/linux/shmem_fs.h | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/include/linux/shmem_fs.h b/include/linux/shmem_fs.h
index 0b273a7b9f01..5735728aeda2 100644
--- a/include/linux/shmem_fs.h
+++ b/include/linux/shmem_fs.h
@@ -167,6 +167,13 @@ static inline struct page *shmem_read_mapping_page(
mapping_gfp_mask(mapping));
}
+static inline struct page *shmem_read_mapping_page_nonblocking(
+ struct address_space *mapping, pgoff_t index)
+{
+ return shmem_read_mapping_page_gfp(mapping, index,
+ mapping_gfp_mask(mapping) | GFP_NOWAIT);
+}
+
static inline bool shmem_file(struct file *file)
{
if (!IS_ENABLED(CONFIG_SHMEM))
--
2.47.1
Powered by blists - more mailing lists