Messages in this thread | | | Date | Thu, 17 Jun 1999 21:30:16 +0200 (CEST) | From | Andrea Arcangeli <> | Subject | Re: reschedule_idle |
| |
On Thu, 17 Jun 1999, Stephen C. Tweedie wrote:
>> If the only two tasks in the system that wants the kernel lock are the >> wakenup task and the current-running task, then rescheduling the wakenup >> task in _place_ of the current task will work _fine_. There _won't_ be any >> contention of the lock simply because the current task will go offline >> waiting the next schedule sleeping in the _run_queue. > >That one very special case. What about doing a wakeup from a signal >handler? Or pipes? In the general case, you cannot assume that the >current process is about to give up its lock: you can only do that when >the current task state is not TASK_RUNNING.
The current process will always give up its lock instead:
--------------------------------- asmlinkage void schedule(void) { struct schedule_data * sched_data; struct task_struct *prev, *next, *p; int this_cpu, c;
if (tq_scheduler) goto handle_tq_scheduler; tq_scheduler_back:
prev = current; this_cpu = prev->processor;
if (in_interrupt()) goto scheduling_in_interrupt;
release_kernel_lock(prev, this_cpu); ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ---------------------------------
Reschedule idle asks the running task to go in the runqueue in the place of the wakenup task so there won't be any contention of the lock even if the current task is still in the TASK_RUNNING state.
If in reschedule_idle we found that only a CPU is now running with the big kernel lock held then we must try rescheduling only _such_ _related_ cpu so we'll be sure to not stall in kernel locks. The current heuristic will do the opposite.
Also it make no sense to me making difference about which is the CPU that is running reschedule_idle. reschedule_idle now has all information about all CPUs and can reschedule every cpu it wants, so I can't see why we are changing the scheduling behaviour in function of the CPU that is running the irq (or reschedule_idle in general).
- if ((p->processor == cpu) && related(cpu_curr(cpu), p)) ^^^^^^^^^^^^^^^^^^^^^
Andrea Arcangeli
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/
| |