Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8706853
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T03:43:10+00:00 2026-06-13T03:43:10+00:00

enqueue_task_rt function in ./kernel/sched/rt.c is responsible for queuing the task to the run queue.

  • 0

enqueue_task_rt function in ./kernel/sched/rt.c is responsible for queuing the task to the run queue. enqueue_task_rt contains call to enqueue_rt_entity which calls dequeue_rt_stack. Most part of the code seems logical but I am a bit lost because of the function dequeue_rt_stack unable to understand what it does. Can somebody tell what is the logic that I am missing or suggest some good read.

Edit: The following is the code for dequeue_rt_stack function

     struct sched_rt_entity *back = NULL;
     /* macro for_each_sched_rt_entity defined as
     for(; rt_se; rt_se = rt_se->parent)*/
     for_each_sched_rt_entity(rt_se) {
             rt_se->back = back;
             back = rt_se;
     }

     for (rt_se = back; rt_se; rt_se = rt_se->back) {
             if (on_rt_rq(rt_se))
                     __dequeue_rt_entity(rt_se);
     }

More specifically, I do not understand why there is a need for this code:

     for_each_sched_rt_entity(rt_se) {
             rt_se->back = back;
             back = rt_se;
     }

What is its relevance.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T03:43:11+00:00Added an answer on June 13, 2026 at 3:43 am

    When a task is to be added to some queue, it must first be removed from the queue that it currently is on, if any.

    With the group scheduler, a task is always at the lowest level of the tree, and might have multiple ancestors:

           NULL
             ^
             |
    +-----parent------+
    |                 |
    | top-level group |
    |                 |
    +-----------------+
             ^      ^_____________
             |                    \
    +-----parent------+   +-----parent------+
    |                 |   |                 |
    | mid-level group |   |   other group   |  ...
    |                 |   |                 |
    +-----------------+   +-----------------+
             ^      ^_____________
             |                    \
    +-----parent------+   +-----------------+
    |                 |   |                 |
    |      task       |   |   other task    |  ...
    |                 |   |                 |
    +-----------------+   +-----------------+
    

    To remove the task from the tree, it must be removed from all groups’ queues, and this must be done first at the top-level group (otherwise, the scheduler might try to run an already partially-removed task). Therefore, dequeue_rt_stack uses the back pointers to constructs a list in the opposite direction:

       NULL    back
         ^      |
         |      V
    +-parent----------+
    |                 |
    | top-level group |
    |                 |
    +----------back---+
         ^      |   ^_____________
         |      V                 \
    +-parent----------+   +-----parent------+
    |                 |   |                 |
    | mid-level group |   |   other group   |  ...
    |                 |   |                 |
    +----------back---+   +-----------------+
         ^      |   ^_____________
         |      V                 \
    +-parent----------+   +-----------------+
    |                 |   |                 |
    |      task       |   |   other task    |  ...
    |                 |   |                 |
    +----------back---+   +-----------------+
                |
                V
               NULL
    

    That back list can then be used to walk down the tree to remove the entities in the correct order.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

The following function is defined in ./kernel/sched/rt.c(v3.5.4): static void enqueue_pushable_task(struct rq *rq, struct task_struct
I'd like to run a rake task (apn:notifications:deliver from the apn_on_rails gem) from a
My scenario is this: I've got worker which enqueues tasks into a multiprocessing.Queue() if
I know when a task runs, it is enqueued into the running queue. When
I have developed a generic producer-consumer queue which pulses by Monitor in the following
We have multi-device system which distribute main task across them. Each subtask consist of:
I have this part of code in my functions.php: function cc_admin_enqueue_scripts($hook) { $file_dir=get_bloginfo('template_directory'); wp_enqueue_script('media-upload');
In C# I use a Queue collection. I can easily Enqueue or Dequeue. Okay,
While reflecting with ILSpy i found this line of code in the Queue<T>.Enqueue(T item)
Is objects enqueued to a ConcurrentQueue are copied to the queue or just their

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.