anjiahao1 opened a new pull request, #22414:
URL: https://github.com/apache/nuttx/pull/22414

   ## Summary
   
   Add a user-space fast path for sched_getcpu().
   
   When CONFIG_ARCH_SCHED_GETCPU_USER_ACCESS is selected on a flat build,
   libc provides sched_getcpu() that returns up_cpu_index() directly
   instead of trapping into the kernel.  The kernel implementation and the
   syscall table entry are compiled out in that configuration, so the
   symbol is defined exactly once.
   
   The option depends on BUILD_FLAT because the fast path calls the arch
   helper directly, and on ARCH_HAVE_MULTICPU because a single-core build
   has no per-CPU state to report.
   
   ## Impact
   
   * Is new feature added? YES - optional fast path for sched_getcpu().
   * Impact on user: NO - opt-in; default behaviour is unchanged.
   * Impact on build: NO
   * Impact on hardware: NO
   * Impact on documentation: NO - the Kconfig help describes the option.
   * Impact on security: NO
   * Impact on compatibility: NO
   
   ## Testing
   
   Build host: Linux x86_64, gcc 13.3.
   
   ```
   tools/configure.sh -a <apps> sim:smp
   # enable CONFIG_ARCH_SCHED_GETCPU_USER_ACCESS
   make -j10
   ```
   
   The build completes with the libc implementation compiled in and the
   kernel copy and syscall entry compiled out.
   
   ## PR verification
   
   * [x] This PR introduces only one functional change.
   * [x] I have updated all required description fields above.
   * [x] My PR adheres to Contributing Guidelines and Documentation.
   * [ ] My PR is still work in progress (not ready for review).
   * [x] My PR is ready for review and can be safely merged into a codebase.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

  • [PR] libc/sched: add user-spa... anjiahao1 (via GitHub) via commits

Reply via email to