Re: [PATCH v3 10/11] perf/x86/intel: Perform rotation on Intel CQM RMIDs

From: Peter Zijlstra
Date: Fri Nov 07 2014 - 07:38:51 EST


On Fri, Nov 07, 2014 at 01:34:31PM +0100, Peter Zijlstra wrote:
>
> enum rmid_cycle_state {
> RMID_AVAILABLE = 0,
> RMID_LIMBO,
> RMID_YOUNG,
> };
>
> struct cqm_rmid_entry {
> ...
> enum rmid_cycle_state state;
> };
>
> static void __intel_sqm_stable(void *arg)
> {
> list_for_each_entry(entry, &cqm_rmid_limbo_lru, list) {
> if (entry->state == RMID_YOUNG)
> break;
>
> if (__rmid_read(entry->rmid) > __threshold)
> entry->state = RMID_LIMBO;
> }
> }
>
> static bool intel_cqm_rmid_stabilize()
> {
> unsigned long queue_time = jiffies + msecs_to_jiffies(__rotation_period);
> unsigned int nr_limbo = 0;
> ...
>
> list_for_each_entry(entry, &cqm_rmid_limbo_lru, list) {
> if (time_after(entry->queue_time, queue_time))
> break;
>
> entry->state = RMID_AVAILABLE;
> nr_limbo++;

For optional goodness:

if (nr_limbo > max_scan_size)
break;

Which will limit the number of RMIDs you'll scan from the IPI, and
thereby limit the time taken there.

> }
>
> if (!nr_limbo)
> return;
>
> on_each_cpu_mask(&cqm_cpumask, __intel_cqm_stable, NULL, true);
>
> list_for_each_entry_safe(entry, tmp, &cqm_rmid_limbo_lru, list) {
> if (entry->state == RMID_YOUNG)
> break;
>
> if (entry->state == RMID_AVAILABLE)
> list_move(&cqm_rmid_free_list, &entry->list);
> }
> }
>
>
> Would not something like that work?
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/