Loading drivers/spi/spi-rockchip.c +1 −0 Original line number Diff line number Diff line Loading @@ -15,6 +15,7 @@ #include <linux/clk.h> #include <linux/dmaengine.h> #include <linux/interrupt.h> #include <linux/module.h> #include <linux/of.h> #include <linux/pinctrl/consumer.h> Loading include/linux/kthread.h +2 −1 Original line number Diff line number Diff line Loading @@ -4,7 +4,6 @@ /* Simple interface for creating and stopping kernel threads without mess. */ #include <linux/err.h> #include <linux/sched.h> #include <linux/cgroup.h> __printf(4, 5) struct task_struct *kthread_create_on_node(int (*threadfn)(void *data), Loading Loading @@ -198,6 +197,8 @@ bool kthread_cancel_delayed_work_sync(struct kthread_delayed_work *work); void kthread_destroy_worker(struct kthread_worker *worker); struct cgroup_subsys_state; #ifdef CONFIG_BLK_CGROUP void kthread_associate_blkcg(struct cgroup_subsys_state *css); struct cgroup_subsys_state *kthread_blkcg(void); Loading include/linux/sched.h +0 −1 Original line number Diff line number Diff line Loading @@ -25,7 +25,6 @@ #include <linux/latencytop.h> #include <linux/sched/prio.h> #include <linux/signal_types.h> #include <linux/psi_types.h> #include <linux/mm_types_task.h> #include <linux/task_io_accounting.h> #include <linux/rseq.h> Loading kernel/kthread.c +1 −0 Original line number Diff line number Diff line Loading @@ -11,6 +11,7 @@ #include <linux/kthread.h> #include <linux/completion.h> #include <linux/err.h> #include <linux/cgroup.h> #include <linux/cpuset.h> #include <linux/unistd.h> #include <linux/file.h> Loading kernel/sched/psi.c +48 −25 Original line number Diff line number Diff line Loading @@ -210,7 +210,8 @@ static bool test_state(unsigned int *tasks, enum psi_states state) } } static void get_recent_times(struct psi_group *group, int cpu, u32 *times) static void get_recent_times(struct psi_group *group, int cpu, u32 *times, u32 *pchanged_states) { struct psi_group_cpu *groupc = per_cpu_ptr(group->pcpu, cpu); u64 now, state_start; Loading @@ -218,6 +219,8 @@ static void get_recent_times(struct psi_group *group, int cpu, u32 *times) unsigned int seq; u32 state_mask; *pchanged_states = 0; /* Snapshot a coherent view of the CPU state */ do { seq = read_seqcount_begin(&groupc->seq); Loading Loading @@ -246,6 +249,8 @@ static void get_recent_times(struct psi_group *group, int cpu, u32 *times) groupc->times_prev[s] = times[s]; times[s] = delta; if (delta) *pchanged_states |= (1 << s); } } Loading @@ -269,17 +274,14 @@ static void calc_avgs(unsigned long avg[3], int missed_periods, avg[2] = calc_load(avg[2], EXP_300s, pct); } static bool update_stats(struct psi_group *group) static void collect_percpu_times(struct psi_group *group, u32 *pchanged_states) { u64 deltas[NR_PSI_STATES - 1] = { 0, }; unsigned long missed_periods = 0; unsigned long nonidle_total = 0; u64 now, expires, period; u32 changed_states = 0; int cpu; int s; mutex_lock(&group->avgs_lock); /* * Collect the per-cpu time buckets and average them into a * single time sample that is normalized to wallclock time. Loading @@ -291,8 +293,11 @@ static bool update_stats(struct psi_group *group) for_each_possible_cpu(cpu) { u32 times[NR_PSI_STATES]; u32 nonidle; u32 cpu_changed_states; get_recent_times(group, cpu, times); get_recent_times(group, cpu, times, &cpu_changed_states); changed_states |= cpu_changed_states; nonidle = nsecs_to_jiffies(times[PSI_NONIDLE]); nonidle_total += nonidle; Loading @@ -317,11 +322,19 @@ static bool update_stats(struct psi_group *group) for (s = 0; s < NR_PSI_STATES - 1; s++) group->total[s] += div_u64(deltas[s], max(nonidle_total, 1UL)); if (pchanged_states) *pchanged_states = changed_states; } static u64 update_averages(struct psi_group *group, u64 now) { unsigned long missed_periods = 0; u64 expires, period; u64 avg_next_update; int s; /* avgX= */ now = sched_clock(); expires = group->avg_next_update; if (now < expires) goto out; if (now - expires >= psi_period) missed_periods = div_u64(now - expires, psi_period); Loading @@ -332,7 +345,7 @@ static bool update_stats(struct psi_group *group) * But the deltas we sample out of the per-cpu buckets above * are based on the actual time elapsing between clock ticks. */ group->avg_next_update = expires + ((1 + missed_periods) * psi_period); avg_next_update = expires + ((1 + missed_periods) * psi_period); period = now - (group->avg_last_update + (missed_periods * psi_period)); group->avg_last_update = now; Loading Loading @@ -362,20 +375,27 @@ static bool update_stats(struct psi_group *group) group->avg_total[s] += sample; calc_avgs(group->avg[s], missed_periods, sample, period); } out: mutex_unlock(&group->avgs_lock); return nonidle_total; return avg_next_update; } static void psi_avgs_work(struct work_struct *work) { struct delayed_work *dwork; struct psi_group *group; u32 changed_states; bool nonidle; u64 now; dwork = to_delayed_work(work); group = container_of(dwork, struct psi_group, avgs_work); mutex_lock(&group->avgs_lock); now = sched_clock(); collect_percpu_times(group, &changed_states); nonidle = changed_states & (1 << PSI_NONIDLE); /* * If there is task activity, periodically fold the per-cpu * times and feed samples into the running averages. If things Loading @@ -383,19 +403,15 @@ static void psi_avgs_work(struct work_struct *work) * Once restarted, we'll catch up the running averages in one * go - see calc_avgs() and missed_periods. */ nonidle = update_stats(group); if (now >= group->avg_next_update) group->avg_next_update = update_averages(group, now); if (nonidle) { unsigned long delay = 0; u64 now; now = sched_clock(); if (group->avg_next_update > now) delay = nsecs_to_jiffies( group->avg_next_update - now) + 1; schedule_delayed_work(dwork, delay); schedule_delayed_work(dwork, nsecs_to_jiffies( group->avg_next_update - now) + 1); } mutex_unlock(&group->avgs_lock); } static void record_times(struct psi_group_cpu *groupc, int cpu, Loading Loading @@ -707,11 +723,18 @@ void cgroup_move_task(struct task_struct *task, struct css_set *to) int psi_show(struct seq_file *m, struct psi_group *group, enum psi_res res) { int full; u64 now; if (static_branch_likely(&psi_disabled)) return -EOPNOTSUPP; update_stats(group); /* Update averages before reporting them */ mutex_lock(&group->avgs_lock); now = sched_clock(); collect_percpu_times(group, NULL); if (now >= group->avg_next_update) group->avg_next_update = update_averages(group, now); mutex_unlock(&group->avgs_lock); for (full = 0; full < 2 - (res == PSI_CPU); full++) { unsigned long avg[3]; Loading Loading
drivers/spi/spi-rockchip.c +1 −0 Original line number Diff line number Diff line Loading @@ -15,6 +15,7 @@ #include <linux/clk.h> #include <linux/dmaengine.h> #include <linux/interrupt.h> #include <linux/module.h> #include <linux/of.h> #include <linux/pinctrl/consumer.h> Loading
include/linux/kthread.h +2 −1 Original line number Diff line number Diff line Loading @@ -4,7 +4,6 @@ /* Simple interface for creating and stopping kernel threads without mess. */ #include <linux/err.h> #include <linux/sched.h> #include <linux/cgroup.h> __printf(4, 5) struct task_struct *kthread_create_on_node(int (*threadfn)(void *data), Loading Loading @@ -198,6 +197,8 @@ bool kthread_cancel_delayed_work_sync(struct kthread_delayed_work *work); void kthread_destroy_worker(struct kthread_worker *worker); struct cgroup_subsys_state; #ifdef CONFIG_BLK_CGROUP void kthread_associate_blkcg(struct cgroup_subsys_state *css); struct cgroup_subsys_state *kthread_blkcg(void); Loading
include/linux/sched.h +0 −1 Original line number Diff line number Diff line Loading @@ -25,7 +25,6 @@ #include <linux/latencytop.h> #include <linux/sched/prio.h> #include <linux/signal_types.h> #include <linux/psi_types.h> #include <linux/mm_types_task.h> #include <linux/task_io_accounting.h> #include <linux/rseq.h> Loading
kernel/kthread.c +1 −0 Original line number Diff line number Diff line Loading @@ -11,6 +11,7 @@ #include <linux/kthread.h> #include <linux/completion.h> #include <linux/err.h> #include <linux/cgroup.h> #include <linux/cpuset.h> #include <linux/unistd.h> #include <linux/file.h> Loading
kernel/sched/psi.c +48 −25 Original line number Diff line number Diff line Loading @@ -210,7 +210,8 @@ static bool test_state(unsigned int *tasks, enum psi_states state) } } static void get_recent_times(struct psi_group *group, int cpu, u32 *times) static void get_recent_times(struct psi_group *group, int cpu, u32 *times, u32 *pchanged_states) { struct psi_group_cpu *groupc = per_cpu_ptr(group->pcpu, cpu); u64 now, state_start; Loading @@ -218,6 +219,8 @@ static void get_recent_times(struct psi_group *group, int cpu, u32 *times) unsigned int seq; u32 state_mask; *pchanged_states = 0; /* Snapshot a coherent view of the CPU state */ do { seq = read_seqcount_begin(&groupc->seq); Loading Loading @@ -246,6 +249,8 @@ static void get_recent_times(struct psi_group *group, int cpu, u32 *times) groupc->times_prev[s] = times[s]; times[s] = delta; if (delta) *pchanged_states |= (1 << s); } } Loading @@ -269,17 +274,14 @@ static void calc_avgs(unsigned long avg[3], int missed_periods, avg[2] = calc_load(avg[2], EXP_300s, pct); } static bool update_stats(struct psi_group *group) static void collect_percpu_times(struct psi_group *group, u32 *pchanged_states) { u64 deltas[NR_PSI_STATES - 1] = { 0, }; unsigned long missed_periods = 0; unsigned long nonidle_total = 0; u64 now, expires, period; u32 changed_states = 0; int cpu; int s; mutex_lock(&group->avgs_lock); /* * Collect the per-cpu time buckets and average them into a * single time sample that is normalized to wallclock time. Loading @@ -291,8 +293,11 @@ static bool update_stats(struct psi_group *group) for_each_possible_cpu(cpu) { u32 times[NR_PSI_STATES]; u32 nonidle; u32 cpu_changed_states; get_recent_times(group, cpu, times); get_recent_times(group, cpu, times, &cpu_changed_states); changed_states |= cpu_changed_states; nonidle = nsecs_to_jiffies(times[PSI_NONIDLE]); nonidle_total += nonidle; Loading @@ -317,11 +322,19 @@ static bool update_stats(struct psi_group *group) for (s = 0; s < NR_PSI_STATES - 1; s++) group->total[s] += div_u64(deltas[s], max(nonidle_total, 1UL)); if (pchanged_states) *pchanged_states = changed_states; } static u64 update_averages(struct psi_group *group, u64 now) { unsigned long missed_periods = 0; u64 expires, period; u64 avg_next_update; int s; /* avgX= */ now = sched_clock(); expires = group->avg_next_update; if (now < expires) goto out; if (now - expires >= psi_period) missed_periods = div_u64(now - expires, psi_period); Loading @@ -332,7 +345,7 @@ static bool update_stats(struct psi_group *group) * But the deltas we sample out of the per-cpu buckets above * are based on the actual time elapsing between clock ticks. */ group->avg_next_update = expires + ((1 + missed_periods) * psi_period); avg_next_update = expires + ((1 + missed_periods) * psi_period); period = now - (group->avg_last_update + (missed_periods * psi_period)); group->avg_last_update = now; Loading Loading @@ -362,20 +375,27 @@ static bool update_stats(struct psi_group *group) group->avg_total[s] += sample; calc_avgs(group->avg[s], missed_periods, sample, period); } out: mutex_unlock(&group->avgs_lock); return nonidle_total; return avg_next_update; } static void psi_avgs_work(struct work_struct *work) { struct delayed_work *dwork; struct psi_group *group; u32 changed_states; bool nonidle; u64 now; dwork = to_delayed_work(work); group = container_of(dwork, struct psi_group, avgs_work); mutex_lock(&group->avgs_lock); now = sched_clock(); collect_percpu_times(group, &changed_states); nonidle = changed_states & (1 << PSI_NONIDLE); /* * If there is task activity, periodically fold the per-cpu * times and feed samples into the running averages. If things Loading @@ -383,19 +403,15 @@ static void psi_avgs_work(struct work_struct *work) * Once restarted, we'll catch up the running averages in one * go - see calc_avgs() and missed_periods. */ nonidle = update_stats(group); if (now >= group->avg_next_update) group->avg_next_update = update_averages(group, now); if (nonidle) { unsigned long delay = 0; u64 now; now = sched_clock(); if (group->avg_next_update > now) delay = nsecs_to_jiffies( group->avg_next_update - now) + 1; schedule_delayed_work(dwork, delay); schedule_delayed_work(dwork, nsecs_to_jiffies( group->avg_next_update - now) + 1); } mutex_unlock(&group->avgs_lock); } static void record_times(struct psi_group_cpu *groupc, int cpu, Loading Loading @@ -707,11 +723,18 @@ void cgroup_move_task(struct task_struct *task, struct css_set *to) int psi_show(struct seq_file *m, struct psi_group *group, enum psi_res res) { int full; u64 now; if (static_branch_likely(&psi_disabled)) return -EOPNOTSUPP; update_stats(group); /* Update averages before reporting them */ mutex_lock(&group->avgs_lock); now = sched_clock(); collect_percpu_times(group, NULL); if (now >= group->avg_next_update) group->avg_next_update = update_averages(group, now); mutex_unlock(&group->avgs_lock); for (full = 0; full < 2 - (res == PSI_CPU); full++) { unsigned long avg[3]; Loading