The patch titled Subject: psi-rename-psi-fields-in-preparation-for-psi-trigger-addition-v6 has been added to the -mm tree. Its filename is psi-rename-psi-fields-in-preparation-for-psi-trigger-addition-v6.patch This patch should soon appear at http://ozlabs.org/~akpm/mmots/broken-out/psi-rename-psi-fields-in-preparation-for-psi-trigger-addition-v6.patch and later at http://ozlabs.org/~akpm/mmotm/broken-out/psi-rename-psi-fields-in-preparation-for-psi-trigger-addition-v6.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/process/submit-checklist.rst when testing your code *** The -mm tree is included into linux-next and is updated there every 3-4 working days ------------------------------------------------------ From: Suren Baghdasaryan <surenb@xxxxxxxxxx> Subject: psi-rename-psi-fields-in-preparation-for-psi-trigger-addition-v6 Link: http://lkml.kernel.org/r/20190319235619.260832-4-surenb@xxxxxxxxxx Signed-off-by: Suren Baghdasaryan <surenb@xxxxxxxxxx> Acked-by: Johannes Weiner <hannes@xxxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- --- a/include/linux/psi_types.h~psi-rename-psi-fields-in-preparation-for-psi-trigger-addition-v6 +++ a/include/linux/psi_types.h @@ -70,20 +70,19 @@ struct psi_group_cpu { struct psi_group { /* Protects data used by the aggregator */ - struct mutex update_lock; + struct mutex avgs_lock; /* Per-cpu task state & time tracking */ struct psi_group_cpu __percpu *pcpu; - struct delayed_work clock_work; - - /* Total stall times observed */ - u64 total[NR_PSI_STATES - 1]; - /* Running pressure averages */ u64 avg_total[NR_PSI_STATES - 1]; u64 avg_last_update; u64 avg_next_update; + struct delayed_work avgs_work; + + /* Total stall times and sampled pressure averages */ + u64 total[NR_PSI_STATES - 1]; unsigned long avg[NR_PSI_STATES - 1][3]; }; --- a/kernel/sched/psi.c~psi-rename-psi-fields-in-preparation-for-psi-trigger-addition-v6 +++ a/kernel/sched/psi.c @@ -165,7 +165,7 @@ static struct psi_group psi_system = { .pcpu = &system_group_pcpu, }; -static void psi_update_work(struct work_struct *work); +static void psi_avgs_work(struct work_struct *work); static void group_init(struct psi_group *group) { @@ -174,8 +174,8 @@ static void group_init(struct psi_group for_each_possible_cpu(cpu) seqcount_init(&per_cpu_ptr(group->pcpu, cpu)->seq); group->avg_next_update = sched_clock() + psi_period; - INIT_DELAYED_WORK(&group->clock_work, psi_update_work); - mutex_init(&group->update_lock); + INIT_DELAYED_WORK(&group->avgs_work, psi_avgs_work); + mutex_init(&group->avgs_lock); } void __init psi_init(void) @@ -278,7 +278,7 @@ static bool update_stats(struct psi_grou int cpu; int s; - mutex_lock(&group->update_lock); + mutex_lock(&group->avgs_lock); /* * Collect the per-cpu time buckets and average them into a @@ -363,18 +363,18 @@ static bool update_stats(struct psi_grou calc_avgs(group->avg[s], missed_periods, sample, period); } out: - mutex_unlock(&group->update_lock); + mutex_unlock(&group->avgs_lock); return nonidle_total; } -static void psi_update_work(struct work_struct *work) +static void psi_avgs_work(struct work_struct *work) { struct delayed_work *dwork; struct psi_group *group; bool nonidle; dwork = to_delayed_work(work); - group = container_of(dwork, struct psi_group, clock_work); + group = container_of(dwork, struct psi_group, avgs_work); /* * If there is task activity, periodically fold the per-cpu @@ -391,10 +391,9 @@ static void psi_update_work(struct work_ u64 now; now = sched_clock(); - if (group->avg_next_update > now) { + if (group->avg_next_update > now) delay = nsecs_to_jiffies( - group->avg_next_update - now) + 1; - } + group->avg_next_update - now) + 1; schedule_delayed_work(dwork, delay); } } @@ -548,13 +547,13 @@ void psi_task_change(struct task_struct */ if (unlikely((clear & TSK_RUNNING) && (task->flags & PF_WQ_WORKER) && - wq_worker_last_func(task) == psi_update_work)) + wq_worker_last_func(task) == psi_avgs_work)) wake_clock = false; while ((group = iterate_groups(task, &iter))) { psi_group_change(group, cpu, clear, set); - if (wake_clock && !delayed_work_pending(&group->clock_work)) - schedule_delayed_work(&group->clock_work, PSI_FREQ); + if (wake_clock && !delayed_work_pending(&group->avgs_work)) + schedule_delayed_work(&group->avgs_work, PSI_FREQ); } } @@ -651,7 +650,7 @@ void psi_cgroup_free(struct cgroup *cgro if (static_branch_likely(&psi_disabled)) return; - cancel_delayed_work_sync(&cgroup->psi.clock_work); + cancel_delayed_work_sync(&cgroup->psi.avgs_work); free_percpu(cgroup->psi.pcpu); } _ Patches currently in -mm which might be from surenb@xxxxxxxxxx are psi-introduce-state_mask-to-represent-stalled-psi-states.patch psi-make-psi_enable-static.patch psi-rename-psi-fields-in-preparation-for-psi-trigger-addition.patch psi-rename-psi-fields-in-preparation-for-psi-trigger-addition-v6.patch psi-split-update_stats-into-parts.patch psi-track-changed-states.patch refactor-header-includes-to-allow-kthreadh-inclusion-in-psi_typesh.patch psi-introduce-psi-monitor.patch