Re: [RFC PATCH 10/10] psi: aggregate ongoing stall events when somebody reads pressure
From: Peter Zijlstra <peterz@infradead.org>
Date: 2018-07-17 15:13:50
Also in:
linux-mm, lkml
From: Peter Zijlstra <peterz@infradead.org>
Date: 2018-07-17 15:13:50
Also in:
linux-mm, lkml
On Thu, Jul 12, 2018 at 01:29:42PM -0400, Johannes Weiner wrote:
@@ -218,10 +216,36 @@ static bool psi_update_stats(struct psi_group *group) for_each_online_cpu(cpu) { struct psi_group_cpu *groupc = per_cpu_ptr(group->cpus, cpu); unsigned long nonidle; + struct rq_flags rf; + struct rq *rq; + u64 now; - if (!groupc->nonidle_time) + if (!groupc->nonidle_time && !groupc->nonidle) continue; + /* + * We come here for two things: 1) periodic per-cpu + * bucket flushing and averaging and 2) when the user + * wants to read a pressure file. For flushing and + * averaging, which is relatively infrequent, we can + * be lazy and tolerate some raciness with concurrent + * updates to the per-cpu counters. However, if a user + * polls the pressure state, we want to give them the + * most uptodate information we have, including any + * currently active state which hasn't been timed yet, + * because in case of an iowait or a reclaim run, that + * can be significant. + */ + if (ondemand) { + rq = cpu_rq(cpu); + rq_lock_irq(rq, &rf);
That's a DoS right there..