From: Boris Brezillon <boris.brezillon@collabora.com>
To: "Adrián Larumbe" <adrian.larumbe@collabora.com>
Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org,
Steven Price <steven.price@arm.com>,
Rob Herring <robh@kernel.org>, Hugh Dickins <hughd@google.com>,
kernel@collabora.com, linux-mm@kvack.org
Subject: Re: [RFC PATCH 1/7] shmem: Introduce non-blocking allocation of shmem pages
Date: Tue, 25 Feb 2025 13:43:25 +0100 [thread overview]
Message-ID: <20250225134325.72a071b6@collabora.com> (raw)
In-Reply-To: <20250218232552.3450939-2-adrian.larumbe@collabora.com>
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))
next prev parent reply other threads:[~2025-02-25 12:43 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-18 23:25 [RFC PATCH 0/7] Introduce sparse DRM shmem object allocations Adrián Larumbe
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 message]
2025-02-18 23:25 ` [RFC PATCH 2/7] lib/scatterlist.c: Support constructing sgt from page xarray Adrián Larumbe
2025-02-25 12:57 ` Boris Brezillon
2025-02-18 23:25 ` [RFC PATCH 3/7] drm/prime: Let drm_prime_pages_to_sg use the page_array interface Adrián Larumbe
2025-02-18 23:25 ` [RFC PATCH 4/7] drm/shmem: Introduce the notion of sparse objects Adrián Larumbe
2025-02-25 13:28 ` Boris Brezillon
2025-02-18 23:25 ` [RFC PATCH 5/7] drm/shmem: Implement sparse allocation of pages for shmem objects Adrián Larumbe
2025-02-25 14:39 ` Boris Brezillon
2025-02-18 23:25 ` [RFC PATCH 6/7] drm/panfrost: Use shmem sparse allocation for heap BOs Adrián Larumbe
2025-02-25 15:04 ` Boris Brezillon
2025-02-18 23:25 ` [RFC PATCH 7/7] drm/panfrost/panthor: Take sparse objects into account for fdinfo Adrián Larumbe
2025-02-25 15:09 ` Boris Brezillon
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250225134325.72a071b6@collabora.com \
--to=boris.brezillon@collabora.com \
--cc=adrian.larumbe@collabora.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=hughd@google.com \
--cc=kernel@collabora.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=robh@kernel.org \
--cc=steven.price@arm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.