Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

kernel: Improve cooperative and preemptive performance as per thread_metric benchmark #81311

Open
wants to merge 9 commits into
base: main
Choose a base branch
from

Commits on Nov 26, 2024

  1. kernel: Clean up priority_q.h

    Minor cleanups include ...
     1. Eliminating unnecessary if-defs and forward declarations
     2. Co-locating routines of the same queue type
    
    Signed-off-by: Peter Mitsis <[email protected]>
    peter-mitsis committed Nov 26, 2024
    Configuration menu
    Copy the full SHA
    1b71b00 View commit details
    Browse the repository at this point in the history
  2. kernel: inline z_sched_prio_cmp()

    Inlines z_sched_prio_cmp() to get better performance.
    
    Signed-off-by: Peter Mitsis <[email protected]>
    peter-mitsis committed Nov 26, 2024
    Configuration menu
    Copy the full SHA
    2753541 View commit details
    Browse the repository at this point in the history
  3. kernel: Add method to dequeue from a dlist

    Dequeuing from a doubly linked list is similar to removing an item
    except that it does not re-initialize the dequeued node.
    
    This comes in handy when sorting a doubly linked list (where the
    node gets removed and re-added). In that circumstance, re-initializing
    the node is required. Furthermore, the compiler does not always
    'understand' this. Thus, when performance is critical, dequeuing
    may be preferred to removing.
    
    Signed-off-by: Peter Mitsis <[email protected]>
    peter-mitsis committed Nov 26, 2024
    Configuration menu
    Copy the full SHA
    1fcbddb View commit details
    Browse the repository at this point in the history
  4. kernel: Add routines for _THREAD_QUEUED bit

    Adds routines for setting and clearing the _THREAD_QUEUED
    thread_state bit.
    
    Signed-off-by: Peter Mitsis <[email protected]>
    peter-mitsis committed Nov 26, 2024
    Configuration menu
    Copy the full SHA
    4c3ef75 View commit details
    Browse the repository at this point in the history
  5. kernel: Add custom scheduler yield routines

    Adds customized yield implementations based upon the selected
    scheduler (dumb, multiq or scalable). Although each follows the
    same broad outline, some of them allow for additional tweaking
    to extract maximal performance. For example, the multiq variant
    improves the performance of k_yield() by about 20%.
    
    Signed-off-by: Peter Mitsis <[email protected]>
    peter-mitsis committed Nov 26, 2024
    Configuration menu
    Copy the full SHA
    89ccd1b View commit details
    Browse the repository at this point in the history
  6. kernel: cache priority queue index on UP multiq

    Even though calculating the priority queue index in the priority
    multiq is quick, caching it allows us to extract an extra 2% in
    terms of performance as measured by the thread_metric cooperative
    benchmark.
    
    Signed-off-by: Peter Mitsis <[email protected]>
    peter-mitsis committed Nov 26, 2024
    Configuration menu
    Copy the full SHA
    e7c7360 View commit details
    Browse the repository at this point in the history
  7. kernel: Simplify clear_halting() on UP systems

    There is no need for clear_halting() to do anything on UP systems.
    
    Signed-off-by: Peter Mitsis <[email protected]>
    peter-mitsis committed Nov 26, 2024
    Configuration menu
    Copy the full SHA
    5ef3a80 View commit details
    Browse the repository at this point in the history
  8. kernel: thread suspend/resume bail paths are unlikely

    Gives a hint to the compiler that the bail-out paths in both
    k_thread_suspend() and k_thread_resume() are unlikely events.
    
    Signed-off-by: Peter Mitsis <[email protected]>
    peter-mitsis committed Nov 26, 2024
    Configuration menu
    Copy the full SHA
    202d4aa View commit details
    Browse the repository at this point in the history
  9. kernel: Inline halt_thread() and z_thread_halt()

    Inlining these routines helps to improve the
    performance of k_thread_suspend()
    
    Signed-off-by: Peter Mitsis <[email protected]>
    peter-mitsis committed Nov 26, 2024
    Configuration menu
    Copy the full SHA
    cdbcd22 View commit details
    Browse the repository at this point in the history