From: Claude Code Review Bot <claude-review@example.com>
To: dri-devel-reviews@example.com
Subject: Claude review: udmabuf: emit one sg entry per pinned folio
Date: Fri, 05 Jun 2026 06:49:28 +1000 [thread overview]
Message-ID: <review-patch2-20260603-tcpdm-large-niovs-v1-2-f37a4ac6726c@meta.com> (raw)
In-Reply-To: <20260603-tcpdm-large-niovs-v1-2-f37a4ac6726c@meta.com>
Patch Review
This patch generalizes udmabuf's sg table construction to coalesce contiguous folio pages into single sg entries.
**Observations:**
1. **Tree divergence:** The current drm-next tree uses `ubuf->pages[]` and `sg_alloc_table_from_pages()`, while this patch operates on `ubuf->folios[]` and `ubuf->offsets[]`. This is a dependency on an upstream udmabuf refactoring that isn't in drm-next yet. Not a bug in the patch, but the base must merge first.
2. **Double traversal of folio array:**
```c
nents = udmabuf_sg_nents(ubuf);
/* ... allocate ... */
for (i = 0; i < ubuf->pagecount; i += run) {
run = udmabuf_folio_nr_pages(ubuf, i);
```
`udmabuf_folio_nr_pages` is called once in `udmabuf_sg_nents()` and again in the sg construction loop, so the folio array is traversed twice. This is fine for setup-time code, but if a reviewer is concerned about large page counts (NUM_PAGES is 16000), a single-pass approach could be considered.
3. **`sg_next()` after last entry:**
```c
sgl = sg->sgl;
for (i = 0; i < ubuf->pagecount; i += run) {
run = udmabuf_folio_nr_pages(ubuf, i);
sg_set_folio(sgl, ubuf->folios[i], run << PAGE_SHIFT,
ubuf->offsets[i]);
sgl = sg_next(sgl);
}
```
After the last iteration, `sg_next(sgl)` returns NULL, and `sgl` is never used again. Harmless, but a more defensive approach would be to only call `sg_next` when there's a next iteration.
4. **The comment block style** uses `/* ... */` spanning multiple lines but without leading `*` on intermediate lines, which is inconsistent with typical kernel style (though acceptable per the coding guidelines as long as it's consistent within the file):
```c
+/* Return the number of contiguous pages backed by the folio at @i.
+ * A udmabuf may map only part of a folio, or reference the same folio
+ * in multiple non-contiguous runs, so folio_nr_pages() can't be used.
+ */
```
This is actually fine -- it does use `*` prefixes. No issue.
---
Generated by Claude Code Patch Reviewer
next prev parent reply other threads:[~2026-06-04 20:49 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-04 0:42 [PATCH net-next 0/4] net: devmem: allow rx-buf-size > PAGE_SIZE per binding Bobby Eshleman
2026-06-04 0:42 ` [PATCH net-next 1/4] net: devmem: allow rx-buf-size > PAGE_SIZE per dmabuf binding Bobby Eshleman
2026-06-04 20:49 ` Claude review: " Claude Code Review Bot
2026-06-04 0:42 ` [PATCH net-next 2/4] udmabuf: emit one sg entry per pinned folio Bobby Eshleman
2026-06-04 20:49 ` Claude Code Review Bot [this message]
2026-06-04 0:43 ` [PATCH net-next 3/4] selftests/net: ncdevmem: add -b option to set rx-buf-size on bind Bobby Eshleman
2026-06-04 20:49 ` Claude review: " Claude Code Review Bot
2026-06-04 0:43 ` [PATCH net-next 4/4] selftests/net: devmem.py: add check_rx_large_niov Bobby Eshleman
2026-06-04 20:49 ` Claude review: " Claude Code Review Bot
2026-06-04 20:49 ` Claude review: net: devmem: allow rx-buf-size > PAGE_SIZE per binding Claude Code Review Bot
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=review-patch2-20260603-tcpdm-large-niovs-v1-2-f37a4ac6726c@meta.com \
--to=claude-review@example.com \
--cc=dri-devel-reviews@example.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox