Skip to content

⚡ Bolt: Use napi_alloc_skb for RX path performance - #23

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

⚡ Bolt: Use napi_alloc_skb for RX path performance#23
maxugly wants to merge 1 commit into
mainfrom
bolt-napi-skb-alloc-14843957356728935227

Conversation

@maxugly

@maxugly maxugly commented Jul 26, 2026

Copy link
Copy Markdown
Owner

What:
Replaced dev_alloc_skb with napi_alloc_skb in the sim_rx_dequeue function and removed the manual skb_reserve call since napi_alloc_skb automatically handles NET_IP_ALIGN.

Why:
The RX path operates in a NAPI polling context. dev_alloc_skb uses a generic slab allocator which can cause lock contention. napi_alloc_skb uses NAPI-specific per-CPU caches, providing faster sk_buff allocations during high-speed packet reception.

Impact:
Significantly reduces CPU overhead and lock contention during network packet receiving, increasing RX throughput and reducing latency.

Measurement:
Compare the iperf3 RX bandwidth between nata-a and nata-b nodes using scripts/nata-ns-up.sh before and after the change, or check CPU utilization of softirqd under heavy RX load.


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

Summary by CodeRabbit

  • Bug Fixes
    • Improved receive-packet allocation during network polling.
    • Removed unnecessary packet alignment handling while preserving existing behavior when allocation fails.
  • Documentation
    • Added guidance on using the appropriate packet allocator for network polling contexts.

Replaced dev_alloc_skb with napi_alloc_skb in the sim_rx_dequeue function to utilize per-CPU NAPI caching for socket buffers, and removed the manual skb_reserve call since napi_alloc_skb automatically handles NET_IP_ALIGN.

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 26, 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: 49ca28a0-5dc0-4c03-8345-4b6f8993e209

📥 Commits

Reviewing files that changed from the base of the PR and between 514361c and 67260b8.

📒 Files selected for processing (2)
  • .jules/bolt.md
  • module/nata_blk.c

📝 Walkthrough

Walkthrough

The RX dequeue path now selects the relevant NAPI context and uses napi_alloc_skb without manual alignment reservation. Allocation failure handling is unchanged, and .jules/bolt.md documents the NAPI allocator guidance.

Changes

NAPI RX allocator

Layer / File(s) Summary
Integrate per-NAPI skb allocation
module/nata_blk.c, .jules/bolt.md
sim_rx_dequeue() selects napi0 or napi1, allocates with napi_alloc_skb, removes the fixed skb_reserve step, preserves failure handling, and documents the NAPI allocation rule.

Estimated code review effort: 1 (Trivial) | ~5 minutes

Possibly related PRs

  • maxugly/nata#21: Updates the same RX path to use per-NAPI allocation and remove manual alignment.
  • maxugly/nata#11: Implements and documents the same allocator transition.
  • maxugly/nata#7: Overlaps on the NAPI allocator and function-context changes.
🚥 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 clearly matches the main change: switching the RX path to napi_alloc_skb for performance.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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-skb-alloc-14843957356728935227

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