Skip to content

Comments

libublk: add queue single CPU affinity management and effective affin…#24

Merged
ming1 merged 1 commit intomainfrom
single-cpu-affinity
Aug 18, 2025
Merged

libublk: add queue single CPU affinity management and effective affin…#24
ming1 merged 1 commit intomainfrom
single-cpu-affinity

Conversation

@ming1
Copy link
Collaborator

@ming1 ming1 commented Aug 18, 2025

…ity query

This commit introduces two new methods for queue affinity management:

  1. UblkCtrl::set_queue_single_affinity() - Allows users to set single CPU affinity for specific queues without calling run_target(). This is useful for code paths that bypass create_queue_handlers().

  2. UblkCtrl::get_queue_effective_affinity() - Retrieves the actual CPU affinity of running queue threads using sched_getaffinity syscall.

Additional improvements:

  • Fix queue_selected_cpus initialization to prevent garbage data panic
  • Refactor create_queue_handlers() to use the new set_queue_single_affinity()
  • Add UblkQueueAffinity::addr_mut() helper method
  • Add comprehensive tests for both new methods

The changes maintain backward compatibility while providing better control over queue CPU affinity management for advanced use cases.

…ity query

This commit introduces two new methods for queue affinity management:

1. UblkCtrl::set_queue_single_affinity() - Allows users to set single CPU
   affinity for specific queues without calling run_target(). This is useful
   for code paths that bypass create_queue_handlers().

2. UblkCtrl::get_queue_effective_affinity() - Retrieves the actual CPU
   affinity of running queue threads using sched_getaffinity syscall.

Additional improvements:
- Fix queue_selected_cpus initialization to prevent garbage data panic
- Refactor create_queue_handlers() to use the new set_queue_single_affinity()
- Add UblkQueueAffinity::addr_mut() helper method
- Add comprehensive tests for both new methods

The changes maintain backward compatibility while providing better control
over queue CPU affinity management for advanced use cases.

Signed-off-by: Ming Lei <tom.leiming@gmail.com>
@ming1 ming1 merged commit 242c052 into main Aug 18, 2025
8 checks passed
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