diff --git a/kernel/sched/rtg/frame_rtg.c b/kernel/sched/rtg/frame_rtg.c index 79db645228c42352e8e49847f09d79b67fdd6bfd..1e73901f3523dd05d6652bea5b4b8aa06d7fd5ca 100755 --- a/kernel/sched/rtg/frame_rtg.c +++ b/kernel/sched/rtg/frame_rtg.c @@ -404,8 +404,10 @@ static int do_set_rtg_sched(struct task_struct *task, bool is_rtg, struct sched_param sp = {0}; if (is_rtg) { + pr_err("[lqw] do_set_rtg_sched: is_rtg\n"); if (is_rt_task) { if (test_and_read_rtg_rt_thread_num() >= RTG_MAX_RT_THREAD_NUM) + pr_err("[lqw] do_set_rtg_sched: rtg_rt_thread_num is inavailable, set policy to CFS\n"); // rtg_rt_thread_num is inavailable, set policy to CFS goto skip_setpolicy; policy = SCHED_FIFO | SCHED_RESET_ON_FORK; @@ -480,16 +482,21 @@ static bool set_frame_rtg_thread(int grp_id, struct task_struct *task, if (!task) return false; depth = task->rtg_depth; - if (is_rtg) + if (is_rtg) { task->rtg_depth = STATIC_RTG_DEPTH; - else + pr_err("[lqw] set_frame_rtg_thread: task->rtg_depth = STATIC_RTG_DEPTH\n"); + } else { + pr_err("[lqw] set_frame_rtg_thread: else task->rtg_depth = 0\n"); task->rtg_depth = 0; + } if (set_rtg_sched(task, is_rtg, grp_id, prio) < 0) { task->rtg_depth = depth; + pr_err("[lqw] set_frame_rtg_thread: return false\n"); return false; } + pr_err("[lqw] set_frame_rtg_thread: return true\n"); return true; } @@ -502,14 +509,24 @@ struct task_struct *update_frame_thread(struct frame_info *frame_info, int new_prio = prio; bool update_ret = false; + pr_err("[lqw] update_frame_thread: pid=%d\n", pid); + pr_err("[lqw] update_frame_thread: old_task->pid=%d\n", old_task->pid); + pr_err("[lqw] update_frame_thread: old_prio=%d\n", old_prio); + pr_err("[lqw] update_frame_thread: new_prio=%d\n", new_prio); if (pid > 0) { + pr_err("[lqw] update_frame_thread: (pid > 0)\n"); if (old_task && (pid == old_task->pid) && (old_prio == new_prio)) { + pr_err("[lqw] update_frame_thread: old_task (pid == old_task->pid) (old_prio == new_prio)\n"); if (is_rt_task && atomic_read(&frame_info->curr_rt_thread_num) < atomic_read(&frame_info->max_rt_thread_num) && - (atomic_read(&frame_info->frame_sched_state) == 1)) + (atomic_read(&frame_info->frame_sched_state) == 1)) { + pr_err("[lqw] update_frame_thread: atomic_inc(frame_info->curr_rt_thread_num)"); + atomic_inc(&frame_info->curr_rt_thread_num); + } trace_rtg_frame_sched(frame_info->rtg->id, "curr_rt_thread_num", atomic_read(&frame_info->curr_rt_thread_num)); + pr_err("[lqw] update_frame_thread: return old_task"); return old_task; } rcu_read_lock(); @@ -522,11 +539,18 @@ struct task_struct *update_frame_thread(struct frame_info *frame_info, atomic_read(&frame_info->frame_sched_state)); if (atomic_read(&frame_info->frame_sched_state) == 1) { if (task && is_rt_task) { + pr_err("[lqw] update_frame_thread: (task is_rt_task)\n"); if (atomic_read(&frame_info->curr_rt_thread_num) < atomic_read(&frame_info->max_rt_thread_num)) + { atomic_inc(&frame_info->curr_rt_thread_num); + pr_err("[lqw] update_frame_thread: atomic_inc\n"); + } else + { new_prio = NOT_RT_PRIO; + pr_err("[lqw] update_frame_thread: new_prio = NOT_RT_PRIO"); + } } trace_rtg_frame_sched(frame_info->rtg->id, "curr_rt_thread_num", atomic_read(&frame_info->curr_rt_thread_num)); @@ -535,6 +559,9 @@ struct task_struct *update_frame_thread(struct frame_info *frame_info, set_frame_rtg_thread(frame_info->rtg->id, old_task, false, NOT_RT_PRIO); update_ret = set_frame_rtg_thread(frame_info->rtg->id, task, true, new_prio); + pr_err("[lqw] update_frame_thread: set_frame_rtg_thread(new_prio=%d) \n", new_prio); + pr_err("[lqw] update_frame_thread: update_ret = %d \n", update_ret); + } if (old_task) put_task_struct(old_task); diff --git a/kernel/sched/rtg/rtg_ctrl.c b/kernel/sched/rtg/rtg_ctrl.c index 164f1b2373b9a2afbf190fe445bf500ab0e0a35b..9cf7e06580dd14aa6b6892df400763de8ac7df7d 100755 --- a/kernel/sched/rtg/rtg_ctrl.c +++ b/kernel/sched/rtg/rtg_ctrl.c @@ -649,9 +649,12 @@ static int parse_add_rtg_thread(const struct rtg_grp_data *rs_data) frame_info->thread[add_index]); if (frame_info->thread[add_index]) { atomic_set(&frame_info->thread_prio[add_index], prio); + pr_err("[lqw] parse_add_rtg_thread: atomic_set prio\n"); frame_info->thread_num++; add_index = frame_info->thread_num; + pr_err("[lqw] parse_add_rtg_thread: add_index\n"); } else { + pr_err("[lqw] parse_add_rtg_thread: fail_num++\n"); fail_num++; } } @@ -717,6 +720,7 @@ long ctrl_set_rtg(int abi, void __user *uarg) ret = parse_create_rtg_grp(&rs_data); break; case CMD_ADD_RTG_THREAD: + pr_err("[lqw] CMD_ADD_RTG_THREAD"); ret = parse_add_rtg_thread(&rs_data); break; case CMD_REMOVE_RTG_THREAD: