Re: Question about kernel preemption

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Aug 13, 2009 at 11:02 PM,
Microbit_Ubuntu<microbit@xxxxxxxxxxxxxxxxxxxxxx> wrote:
> Hi Mohammed,
>
> On Thu, 2009-08-13 at 15:59 +0300, Mohammed Gamal wrote:
>> Hi All,
>> I know that kernel preemption exists in order to allow high-priority
>> processes to interrupt the kernel if the kernel executes on relatively
>> long code paths in order to improve latency times and process
>> responsiveness. However, I am curious to know when and where the
>> kernel gets preempted and at what code paths. I searched LXR for
>> instances where preempt_schedule() gets called for instance but it
>> seems it never gets explicitly called anywhere in the kernel (please
>> CCIW). So, when exactly does the kernel get preempted? A pointer to
>> the actual code path where that happens is appreciated.
>>
>> Regards,
>> Mohammed
>>
>> --
>> To unsubscribe from this list: send an email with
>> "unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
>> Please read the FAQ at http://kernelnewbies.org/FAQ
>>
>
> Because I had the indexer/search from Eclipse on into my embedded target kernel
> anyway, I did a quick scan for "preempt_schedule".
>
> With 2.6.29.4 kernel I get 35 matches :
>
> - 4 in system.map
> - 1 in module.symvers
> - 3 in sched.c
>  Line 4681 : asmlinkage void __sched preempt_schedule(void)
>  Line 4712 : asmlinkage void __sched preempt_schedule_irq(void)
>  and just the exported symbol
> - 2 in kprobes.c
>  the only relevant is :
>  static struct kprobe_blackpoint kprobe_blacklist[] = {
>        {"preempt_schedule",},
>        {NULL}    /* Terminator */
> - 2 in preempt.h
>  the relevant is macro :
>  #define preempt_check_resched() \
>  do { \
>    if (unlikely(test_thread_flag(TIF_NEED_RESCHED))) \
>     preempt_schedule(); \
>     } while (0)
> - 2 in Documentation /ftrace.txt
>  Line 811 & 1043
> - one for each entry in /arch/* ..  eg. in arch/arm/kernel/entry-armv.S :
>  #ifdef CONFIG_PREEMPT
>  svc_preempt:
>        mov     r8, lr
> 1:      bl      preempt_schedule_irq            @ irq en/disable is done inside
>        ldr     r0, [tsk, #TI_FLAGS]            @ get new tasks TI_FLAGS
>        tst     r0, #_TIF_NEED_RESCHED
>        moveq   pc, r8                          @ go again
>        b       1b
>  #endif
>
> Perhaps that'll give a hand.
>
> HTH
> --
> Best regards,
> Kris
>
>
>
>
> --
> To unsubscribe from this list: send an email with
> "unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
> Please read the FAQ at http://kernelnewbies.org/FAQ
>
>
Hi All,
The search on LXR revealed the same thing, basically
preempt_schedule_irq() is called explicitly only within an entry.S
routine in each architecture (it was resume_kernel on ia32 IIRC),
which does make some sense.

As far as I understood, Michi's answer explains why and when the
kernel *can* get preempted, however what I really want to know is when
and where kernel preemption is *triggered*. Please correct me if I did
misunderstand anything.

Regards,
Mohammed

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at http://kernelnewbies.org/FAQ



[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux