Commit fabb6570 authored by Maxim Shchetynin's avatar Maxim Shchetynin Committed by Benjamin Herrenschmidt

powerpc/spufs: add atomic busy_spus counter to struct cbe_spu_info

As nr_active counter includes also spus waiting for syscalls to return
we need a seperate counter that only counts spus that are currently running
on spu side. This counter shall be used by a cpufreq governor that targets
a frequency dependent from the number of running spus.
Signed-off-by: default avatarChristian Krafft <krafft@de.ibm.com>
Acked-by: default avatarJeremy Kerr <jk@ozlabs.org>
Signed-off-by: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
parent 88b90c96
...@@ -994,6 +994,7 @@ void spuctx_switch_state(struct spu_context *ctx, ...@@ -994,6 +994,7 @@ void spuctx_switch_state(struct spu_context *ctx,
struct timespec ts; struct timespec ts;
struct spu *spu; struct spu *spu;
enum spu_utilization_state old_state; enum spu_utilization_state old_state;
int node;
ktime_get_ts(&ts); ktime_get_ts(&ts);
curtime = timespec_to_ns(&ts); curtime = timespec_to_ns(&ts);
...@@ -1015,6 +1016,11 @@ void spuctx_switch_state(struct spu_context *ctx, ...@@ -1015,6 +1016,11 @@ void spuctx_switch_state(struct spu_context *ctx,
spu->stats.times[old_state] += delta; spu->stats.times[old_state] += delta;
spu->stats.util_state = new_state; spu->stats.util_state = new_state;
spu->stats.tstamp = curtime; spu->stats.tstamp = curtime;
node = spu->node;
if (old_state == SPU_UTIL_USER)
atomic_dec(&cbe_spu_info[node].busy_spus);
if (new_state == SPU_UTIL_USER);
atomic_inc(&cbe_spu_info[node].busy_spus);
} }
} }
......
...@@ -191,6 +191,7 @@ struct cbe_spu_info { ...@@ -191,6 +191,7 @@ struct cbe_spu_info {
struct list_head spus; struct list_head spus;
int n_spus; int n_spus;
int nr_active; int nr_active;
atomic_t busy_spus;
atomic_t reserved_spus; atomic_t reserved_spus;
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment