* [RFC PATCH 1/7] shmem: Introduce non-blocking allocation of shmem pages [not found] <20250218232552.3450939-1-adrian.larumbe@collabora.com> @ 2025-02-18 23:25 ` Adrián Larumbe 2025-02-25 12:43 ` Boris Brezillon 0 siblings, 1 reply; 2+ messages in thread From: Adrián Larumbe @ 2025-02-18 23:25 UTC (permalink / raw) To: dri-devel, linux-kernel, Boris Brezillon, Steven Price, Rob Herring, Hugh Dickins Cc: kernel, Adrián Larumbe, linux-mm 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@collabora.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 ^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [RFC PATCH 1/7] shmem: Introduce non-blocking allocation of shmem pages 2025-02-18 23:25 ` [RFC PATCH 1/7] shmem: Introduce non-blocking allocation of shmem pages Adrián Larumbe @ 2025-02-25 12:43 ` Boris Brezillon 0 siblings, 0 replies; 2+ messages in thread From: Boris Brezillon @ 2025-02-25 12:43 UTC (permalink / raw) To: Adrián Larumbe Cc: dri-devel, linux-kernel, Steven Price, Rob Herring, Hugh Dickins, kernel, linux-mm On Tue, 18 Feb 2025 23:25:31 +0000 Adrián Larumbe <adrian.larumbe@collabora.com> wrote: > 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@collabora.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); > +} Just my 2 cents, but I'm not entirely sure it's worth adding a helper for the non-blocking case given we can pretty easily call shmem_read_mapping_page_gfp() with the GFP_NOWAIT addition where needed. > + > static inline bool shmem_file(struct file *file) > { > if (!IS_ENABLED(CONFIG_SHMEM)) ^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-02-25 12:43 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <20250218232552.3450939-1-adrian.larumbe@collabora.com>
2025-02-18 23:25 ` [RFC PATCH 1/7] shmem: Introduce non-blocking allocation of shmem pages Adrián Larumbe
2025-02-25 12:43 ` Boris Brezillon
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox