schedule(): schedule a sleeping processes if it has pending signals

This commit is contained in:
Balazs Gerofi
2016-07-27 16:15:37 +09:00
parent 57690479bd
commit c484f766fa
4 changed files with 4 additions and 5 deletions

View File

@ -79,8 +79,6 @@
#define dkprintf(...) do { if (0) kprintf(__VA_ARGS__); } while (0) #define dkprintf(...) do { if (0) kprintf(__VA_ARGS__); } while (0)
#endif #endif
extern struct sigpending *hassigpending(struct thread *thread);
int futex_cmpxchg_enabled; int futex_cmpxchg_enabled;
/** /**

View File

@ -677,5 +677,6 @@ void chain_process(struct process *);
void chain_thread(struct thread *); void chain_thread(struct thread *);
void proc_init(); void proc_init();
void set_timer(); void set_timer();
struct sig_pending *hassigpending(struct thread *thread);
#endif #endif

View File

@ -2593,9 +2593,10 @@ redo:
if (v->flags & CPU_FLAG_NEED_MIGRATE) { if (v->flags & CPU_FLAG_NEED_MIGRATE) {
next = &cpu_local_var(idle); next = &cpu_local_var(idle);
} else { } else {
/* Pick a new running process */ /* Pick a new running process or one that has a pending signal */
list_for_each_entry_safe(thread, tmp, &(v->runq), sched_list) { list_for_each_entry_safe(thread, tmp, &(v->runq), sched_list) {
if (thread->status == PS_RUNNING) { if (thread->status == PS_RUNNING ||
(thread->status == PS_INTERRUPTIBLE && hassigpending(thread))) {
next = thread; next = thread;
break; break;
} }

View File

@ -105,7 +105,6 @@ static void calculate_time_from_tsc(struct timespec *ts);
void check_signal(unsigned long, void *, int); void check_signal(unsigned long, void *, int);
void do_signal(long rc, void *regs, struct thread *thread, struct sig_pending *pending, int num); void do_signal(long rc, void *regs, struct thread *thread, struct sig_pending *pending, int num);
extern unsigned long do_kill(struct thread *thread, int pid, int tid, int sig, struct siginfo *info, int ptracecont); extern unsigned long do_kill(struct thread *thread, int pid, int tid, int sig, struct siginfo *info, int ptracecont);
extern struct sigpending *hassigpending(struct thread *thread);
extern long alloc_debugreg(struct thread *thread); extern long alloc_debugreg(struct thread *thread);
extern int num_processors; extern int num_processors;
extern unsigned long ihk_mc_get_ns_per_tsc(void); extern unsigned long ihk_mc_get_ns_per_tsc(void);