设置进程p的thread_info中的flag域的TIF_NEED_RESCHED位,表示该进程需要调用调度程序执行进程切换
static
inline
void
resched_task(task_t
*
p)
{
set_tsk_need_resched(p);
}
static
inline
void
set_tsk_need_resched(
struct
task_struct
*
tsk)
{
set_tsk_thread_flag(tsk,TIF_NEED_RESCHED);
}
static
inline
void
set_tsk_thread_flag(
struct
task_struct
*
tsk,
int
flag)
{
set_ti_thread_flag(tsk->thread_info,flag);
}
static
inline
void
set_ti_thread_flag(
struct
thread_info
*
ti,
int
flag)
{
set_bit(flag,&ti->flags);
}
#define TIF_NEED_RESCHED 3
struct thread_info {
...
unsigned long flags;
...
};
static
inline
void
resched_task(task_t
*
p)
{
set_tsk_need_resched(p);
}
static
inline
void
set_tsk_need_resched(
struct
task_struct
*
tsk)
{
set_tsk_thread_flag(tsk,TIF_NEED_RESCHED);
}
static
inline
void
set_tsk_thread_flag(
struct
task_struct
*
tsk,
int
flag)
{
set_ti_thread_flag(tsk->thread_info,flag);
}
static
inline
void
set_ti_thread_flag(
struct
thread_info
*
ti,
int
flag)
{
set_bit(flag,&ti->flags);
}
#define TIF_NEED_RESCHED 3
struct thread_info {
...
unsigned long flags;
...
};
进程调度标记设置
本文介绍了一个内核级的进程调度标记设置过程,通过一系列内联函数实现对进程thread_info结构中flags域的TIF_NEED_RESCHED位进行设置,触发进程重新调度。

1709

被折叠的 条评论
为什么被折叠?



