Skip to content

⚡ Bolt: Use napi_alloc_skb for faster RX packet allocations - #17

Open
maxugly wants to merge 1 commit into
mainfrom
bolt-napi-alloc-skb-15746220529099938097
Open

⚡ Bolt: Use napi_alloc_skb for faster RX packet allocations#17
maxugly wants to merge 1 commit into
mainfrom
bolt-napi-alloc-skb-15746220529099938097

Conversation

@maxugly

@maxugly maxugly commented Jul 23, 2026

Copy link
Copy Markdown
Owner

💡 What: Replaced dev_alloc_skb with napi_alloc_skb in the simulated RX dequeue hotpath (sim_rx_dequeue), passing the napi_struct pointer through from the nata_poll routine. Added explanatory comments.

🎯 Why: In a high-throughput network receive path running in softirq context (like NAPI polling), dev_alloc_skb uses generic memory allocation paths that can suffer from lock contention. napi_alloc_skb uses NAPI-specific per-CPU caches, making allocations significantly faster and more scalable.

📊 Impact: Expected to reduce CPU overhead during packet allocation in the RX hotpath, increasing overall throughput and reducing latency jitter under high load. This prevents unnecessary lock contention.

🔬 Measurement: Verify by running sudo ./scripts/nata-bench-once.sh to measure throughput, or run a high-rate iperf3 test across the simulated netns boundaries. The CPU utilization for nata_poll should decrease.


PR created automatically by Jules for task 15746220529099938097 started by @maxugly

Summary by CodeRabbit

  • Performance

    • Improved network receive processing during NAPI polling.
    • Reduced allocation overhead and contention for incoming packets.
  • Bug Fixes

    • Preserved existing handling when packet buffer allocation fails, including drop tracking and queue advancement.

Co-authored-by: maxugly <64644401+maxugly@users.noreply.github.com>
@google-labs-jules

Copy link
Copy Markdown
Contributor

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@gemini-code-assist

Copy link
Copy Markdown
Contributor

Caution

The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased.

@coderabbitai

coderabbitai Bot commented Jul 23, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: b5bc65c5-16f5-40c5-bcfd-516caf1484b6

📥 Commits

Reviewing files that changed from the base of the PR and between 514361c and 0b48e65.

📒 Files selected for processing (4)
  • .jules/bolt.md
  • module/nata.h
  • module/nata_blk.c
  • module/nata_net.c

📝 Walkthrough

Walkthrough

The RX NAPI poll path now passes its NAPI context through sim_rx_dequeue, which uses napi_alloc_skb() instead of dev_alloc_skb() for skb allocation.

Changes

NAPI RX allocation

Layer / File(s) Summary
NAPI context propagation
module/nata.h, module/nata_blk.c, module/nata_net.c
The sim_rx_dequeue contract and nata_poll call are updated to pass the active NAPI instance.
NAPI skb allocation
module/nata_blk.c, .jules/bolt.md
RX dequeue uses napi_alloc_skb() and documents the NAPI receive-path allocation guidance.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

  • maxugly/nata#3: Both changes modify the NAPI RX poll loop and sim_rx_dequeue.
  • maxugly/nata#7: Contains the same NAPI parameter propagation and skb allocator changes.
  • maxugly/nata#11: Also switches RX skb allocation to napi_alloc_skb() and threads NAPI context through the RX path.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: switching RX allocations to napi_alloc_skb for faster NAPI-path packet handling.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch bolt-napi-alloc-skb-15746220529099938097

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant