Skip to content

⚡ Bolt: [performance improvement] Use napi_alloc_skb for RX cache locality - #11

Open
maxugly wants to merge 1 commit into
mainfrom
bolt/napi-allocator-9367426265710306481
Open

⚡ Bolt: [performance improvement] Use napi_alloc_skb for RX cache locality#11
maxugly wants to merge 1 commit into
mainfrom
bolt/napi-allocator-9367426265710306481

Conversation

@maxugly

@maxugly maxugly commented Jul 20, 2026

Copy link
Copy Markdown
Owner

💡 What

Replaced dev_alloc_skb with napi_alloc_skb in the network driver's RX path (sim_rx_dequeue). Added a journal entry to .jules/bolt.md documenting this optimization pattern.

🎯 Why

sim_rx_dequeue operates in a NAPI polling context. Calling a generic slab allocator like dev_alloc_skb in this hotpath causes cache thrashing. Using napi_alloc_skb leverages the NAPI per-CPU cache locality, reducing lock contention and significantly improving packet processing throughput.

📊 Impact

Expected to increase packet processing performance and lower latency during bursts, as CPU cache thrashing on memory allocations is reduced.

🔬 Measurement

Run sudo ./scripts/nata-bench-once.sh to measure packet throughput and compare against baseline. Use perf to profile CPU usage and observe reduced overhead in kmem_cache_alloc_node and network RX softirqs.


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

Summary by CodeRabbit

  • Performance
    • Improved network receive-path packet allocation for better performance and allocator efficiency.
  • Bug Fixes
    • Preserved existing handling when packet allocation fails, including tracking dropped blocks and advancing the receive queue.

Switched from dev_alloc_skb to napi_alloc_skb in sim_rx_dequeue.
This takes advantage of NAPI's per-CPU cache locality.

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.

@coderabbitai

coderabbitai Bot commented Jul 20, 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: e04dc252-cd01-4a45-a1cc-16cef7014ba6

📥 Commits

Reviewing files that changed from the base of the PR and between 514361c and 4419f14.

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

📝 Walkthrough

Walkthrough

The RX dequeue path now allocates skbs with the selected NAPI context, while retaining existing failure handling. Documentation records the corresponding network RX hotpath guidance.

Changes

NAPI RX allocation

Layer / File(s) Summary
NAPI-aware RX skb allocation
.jules/bolt.md, module/nata_blk.c
sim_rx_dequeue() uses napi_alloc_skb() with the NAPI context selected by is_dev0; allocation failure handling remains unchanged. The guidance documents this allocator choice.

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

Possibly related PRs

  • maxugly/nata#3: Also modifies the RX dequeue function’s error-path handling.
  • maxugly/nata#7: Directly overlaps with the NAPI-aware skb allocation in sim_rx_dequeue().
🚥 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 reflects the main change: switching RX allocation to napi_alloc_skb to improve cache locality and 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-allocator-9367426265710306481

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.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request replaces the generic dev_alloc_skb allocator with the NAPI-specific napi_alloc_skb allocator in module/nata_blk.c to leverage per-CPU caches and improve performance in the network RX hotpath. Additionally, a corresponding learning entry has been added to .jules/bolt.md documenting this optimization. There are no review comments, so I have no feedback to provide.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

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