Skip to content

sched: inline nxsched_select_cpu nxsched_add_prioritized - #14059

Merged
xiaoxiang781216 merged 1 commit into
apache:masterfrom
hujun260:apache_6
Oct 10, 2024
Merged

xiaoxiang781216 merged 1 commit into
apache:masterfrom
hujun260:apache_6

Conversation

@hujun260

Copy link
Copy Markdown
Contributor

Summary

inline nxsched_select_cpu nxsched_add_prioritized to improve performence

Impact

sched

Testing

Configuring NuttX and compile:
$ ./tools/configure.sh -l qemu-armv8a:nsh_smp
$ make
Running with qemu
$ qemu-system-aarch64 -cpu cortex-a53 -smp 4 -nographic
-machine virt,virtualization=on,gic-version=3
-net none -chardev stdio,id=con,mux=on -serial chardev:con
-mon chardev=con,mode=readline -kernel ./nuttx

…erformence

Configuring NuttX and compile:
$ ./tools/configure.sh -l qemu-armv8a:nsh_smp
$ make
Running with qemu
$ qemu-system-aarch64 -cpu cortex-a53 -smp 4 -nographic \
   -machine virt,virtualization=on,gic-version=3 \
   -net none -chardev stdio,id=con,mux=on -serial chardev:con \
   -mon chardev=con,mode=readline -kernel ./nuttx

Signed-off-by: hujun5 <[email protected]>
@github-actions github-actions Bot added Area: OS Components OS Components issues Size: M The size of the change in this PR is medium labels Oct 10, 2024
@nuttxpr

nuttxpr commented Oct 10, 2024

Copy link
Copy Markdown

[Experimental Bot, please feedback here]

Let's break down if this Pull Request (PR) description meets the NuttX requirements.

Here's a breakdown of what's missing and how to improve it:

Summary:

  • Insufficient Detail: "inline nxsched_select_cpu nxsched_add_prioritized to improve performance" is too brief.
    • What it should include:
      • Why: Clearly explain why inlining these functions is necessary. Is there a specific performance bottleneck you're addressing? What are the expected gains?
      • What: Provide more context on the nxsched_select_cpu and nxsched_add_prioritized functions. What part of the scheduler do they belong to? What do they do?
      • How: Briefly explain how inlining these functions improves performance (e.g., reduces function call overhead, enables compiler optimizations).

Impact:

  • Too Vague: Simply stating "sched" isn't helpful.
    • What it should include:
      • Feature Changes: Does this change add a new scheduling feature or modify an existing one? Be specific.
      • User Impact: Will users notice any changes in the system's behavior (e.g., task responsiveness)?
      • Build Impact: Are there any changes to the NuttX build system or configuration options as a result of this change?
      • Hardware Impact: Does this optimization target a specific architecture or have implications for certain hardware platforms?
      • Documentation: Does this change require updates to the NuttX documentation? If so, are they included in the PR?
      • Security: Are there any potential security implications (even if unlikely)? It's good to consider and state "NO" explicitly if none.
      • Compatibility: Does this change break compatibility with older NuttX versions or any specific hardware/software configurations?

Testing:

  • Incomplete Information:
    • Build Host: Specify the operating system, CPU architecture, and compiler (including version) used to build NuttX.
    • Target(s): Be specific about the target architecture(s) and board configurations used for testing.
    • Testing Logs: Provide relevant snippets of logs from before and after the change. Focus on sections that demonstrate the performance improvement or highlight the changes in behavior.

Example of an Improved PR Description

## Summary

This PR improves the performance of the NuttX scheduler by inlining the `nxsched_select_cpu` and `nxsched_add_prioritized` functions. These functions are called frequently during task scheduling operations, particularly in systems with multiple CPUs or high task loads.  Inlining them reduces function call overhead and allows the compiler to perform more aggressive optimizations. 

**[Link to relevant NuttX Issue if applicable]**

## Impact

* **Is new feature added?** NO
* **Is existing feature changed?** YES, this optimizes the existing task scheduling mechanism.
* **Impact on user:** Users may observe slightly improved system responsiveness, particularly in CPU-intensive scenarios. 
* **Impact on build:** NO
* **Impact on hardware:**  NO, this optimization is not architecture-specific. 
* **Impact on documentation:**  NO
* **Impact on security:** NO
* **Impact on compatibility:** NO
* **Anything else to consider:** N/A

## Testing

**I confirm that changes are verified on the local setup and work as intended:**

* **Build Host(s):** Ubuntu 20.04, x86_64, GCC 9.4.0
* **Target(s):** QEMU (cortex-a53), nsh_smp configuration

**Testing logs before change:**

[Relevant log snippets showing scheduler performance before the change]


**Testing logs after change:**

[Relevant log snippets showing scheduler performance improvement after the change]

Key Points to Remember:

  • Be Specific: Provide concrete details and avoid vague language.
  • Think from the Reviewer's Perspective: Make it easy for reviewers to understand your changes and their impact.
  • Follow the Guidelines: Adhering to the NuttX PR requirements ensures consistency and makes the review process smoother.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area: OS Components OS Components issues Size: M The size of the change in this PR is medium

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants