From: Brendan Shephard <bshephar@bne-home.net>
To: Alexandre Courbot <acourbot@nvidia.com>
Cc: aliceryhl@google.com, joelagnelf@nvidia.com, airlied@redhat.com,
rust-for-linux@vger.kernel.org, nouveau@lists.freedesktop.org
Subject: Re: [PATCH v4] drm/nova: Align GEM memory allocation to system page size
Date: Tue, 23 Dec 2025 16:10:55 +1000 [thread overview]
Message-ID: <aUoyb9BcnYS0xp8f@fedora> (raw)
In-Reply-To: <DF1DDD8BUIYQ.1YCAA8T6557NP@nvidia.com>
On Thu, Dec 18, 2025 at 10:16:48PM +0900, Alexandre Courbot wrote:
> On Mon Dec 15, 2025 at 5:34 PM JST, Brendan Shephard wrote:
> > impl NovaObject {
> > /// Create a new DRM GEM object.
> > pub(crate) fn new(dev: &NovaDevice, size: usize) -> Result<ARef<gem::Object<Self>>> {
> > - let aligned_size = size.next_multiple_of(1 << 12);
> > -
> > - if size == 0 || size > aligned_size {
> > + if size == 0 {
> > return Err(EINVAL);
> > }
> > + let aligned_size = page_align(size).ok_or(EINVAL)?;
>
> nit, but it's a good practice to always leave an empty line before a
> block of variable declarations.
>
> >
> > gem::Object::new(dev, aligned_size)
>
> ... or if you prefer to avoid the variable altogether:
>
> page_align(size)
> .ok_or(EINVAL)
> .and_then(|size| gem::Object::new(dev, size))
>
Sounds good, I'll use `and_then`. I like the idea of not unnecessarily
assigning variables just to use them once. I'll make that change, re-test
and send a new revision of this one.
Thanks!
next prev parent reply other threads:[~2025-12-23 6:11 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-15 8:34 [PATCH v4] drm/nova: Align GEM memory allocation to system page size Brendan Shephard
2025-12-18 13:16 ` Alexandre Courbot
2025-12-23 6:10 ` Brendan Shephard [this message]
2025-12-29 14:46 ` Danilo Krummrich
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=aUoyb9BcnYS0xp8f@fedora \
--to=bshephar@bne-home.net \
--cc=acourbot@nvidia.com \
--cc=airlied@redhat.com \
--cc=aliceryhl@google.com \
--cc=joelagnelf@nvidia.com \
--cc=nouveau@lists.freedesktop.org \
--cc=rust-for-linux@vger.kernel.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox