Skip to content

Commit

Permalink
powerpc/spufs: add atomic busy_spus counter to struct cbe_spu_info
Browse files Browse the repository at this point in the history
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: Christian Krafft <krafft@de.ibm.com>
Acked-by: Jeremy Kerr <jk@ozlabs.org>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
  • Loading branch information
Maxim Shchetynin authored and Benjamin Herrenschmidt committed Jul 9, 2008
1 parent 88b90c9 commit fabb657
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
6 changes: 6 additions & 0 deletions arch/powerpc/platforms/cell/spufs/sched.c
Original file line number Diff line number Diff line change
Expand Up @@ -994,6 +994,7 @@ void spuctx_switch_state(struct spu_context *ctx,
struct timespec ts;
struct spu *spu;
enum spu_utilization_state old_state;
int node;

ktime_get_ts(&ts);
curtime = timespec_to_ns(&ts);
Expand All @@ -1015,6 +1016,11 @@ void spuctx_switch_state(struct spu_context *ctx,
spu->stats.times[old_state] += delta;
spu->stats.util_state = new_state;
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);
}
}

Expand Down
1 change: 1 addition & 0 deletions include/asm-powerpc/spu.h
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,7 @@ struct cbe_spu_info {
struct list_head spus;
int n_spus;
int nr_active;
atomic_t busy_spus;
atomic_t reserved_spus;
};

Expand Down

0 comments on commit fabb657

Please sign in to comment.