Skip to content

⚡ Bolt: Batch producer wakeups outside spinlock - #33

Open
maxugly wants to merge 1 commit into
mainfrom
bolt-batch-producer-wakeups-10508298872880370483
Open

⚡ Bolt: Batch producer wakeups outside spinlock#33
maxugly wants to merge 1 commit into
mainfrom
bolt-batch-producer-wakeups-10508298872880370483

Conversation

@maxugly

@maxugly maxugly commented Jul 31, 2026

Copy link
Copy Markdown
Owner

💡 What: Moved the nata_wake_tx_peer function call in the nata_poll NAPI polling loop from inside the ring buffer spin_lock block to outside the block, after the polling loop is completed. Introduced a freed_slots flag to track whether any slot was successfully freed.

🎯 Why: In the hot path of network data, acquiring a spinlock blocks other CPUs. The netif_wake_queue invoked within nata_wake_tx_peer does internal bookkeeping that takes time. Doing this while holding a critical spin_lock introduces significant lock contention and overhead. Waking the queue once per NAPI poll budget is far more efficient than doing it per-packet inside the lock.

📊 Impact: Reduces lock contention on priv->lock during the NAPI receive path by batching the queue wakeup and performing it locklessly. This should yield higher overall goodput and less time spent spinning under load.

🔬 Measurement: I ran the simulated tests in nata-bench-once.sh. Although it failed to fully compile due to missing headers in the sandbox, logically this is a common driver optimization pattern. Performance improvements can be measured using sudo ./scripts/nata-bench-once.sh in an environment where module loads correctly.


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

Summary by CodeRabbit

  • Performance Improvements
    • Improved network packet processing by batching transmit-queue wakeups during receive polling.
    • Reduced unnecessary synchronization overhead, helping maintain smoother network throughput under load.

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 31, 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: c63ce3cd-df99-45e0-8812-e55d3488833f

📥 Commits

Reviewing files that changed from the base of the PR and between 6d5b3ed and 6f85d80.

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

📝 Walkthrough

Walkthrough

The RX polling path now tracks freed slots and performs one peer TX queue wakeup after releasing the ring lock. Documentation describes the batched wakeup behavior.

Changes

RX wakeup batching

Layer / File(s) Summary
Defer peer TX wakeup outside the ring lock
module/nata_net.c, .jules/bolt.md
nata_poll tracks freed RX slots, removes wakeups from the locked dequeue loop, and wakes the peer TX queue once after polling. The documentation records this behavior.

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

Possibly related PRs

  • maxugly/nata#3: Both changes modify nata_poll and optimize producer wakeups around the ring lock.
  • maxugly/nata#17: Both changes modify the NAPI RX polling path and peer TX wakeups.
  • maxugly/nata#31: This change implements the same deferred TX wakeup behavior described in that PR.
🚥 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 and concisely describes batching producer wakeups outside the spinlock, which is the main change.
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-batch-producer-wakeups-10508298872880370483

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