lkml.org 
[lkml]   [2015]   [Jul]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v3 3/8] perf: Add a flags parameter to pmu txn interfaces
On Tue, Jul 14, 2015 at 08:01:50PM -0700, Sukadev Bhattiprolu wrote:
> +DEFINE_PER_CPU(int, nop_txn_flags);
> +
> +static int nop_txn_flags_get_and_clear(void)
> +{
> + int *flagsp;
> + int flags;
> +
> + flagsp = &get_cpu_var(nop_txn_flags);
> +
> + flags = *flagsp;
> + *flagsp = 0;
> +
> + put_cpu_var(nop_txn_flags);
> +
> + return flags;
> +}
> +
> +static void nop_txn_flags_set(int flags)
> +{
> + int *flagsp;
> +
> + flagsp = &get_cpu_var(nop_txn_flags);
> + *flagsp = flags;
> + put_cpu_var(nop_txn_flags);
> +}

That's really horrible, see below:

> +static void perf_pmu_start_txn(struct pmu *pmu, int flags)
> {
__this_cpu_write(nop_txn_flags, flags);
> +
> + if (flags & ~PERF_PMU_TXN_ADD)
> + return;
> +
> perf_pmu_disable(pmu);
> }
>
> static int perf_pmu_commit_txn(struct pmu *pmu)
> {
int flags = __this_cpu_read(nop_txn_flags);
__this_cpu_write(nop_txn_flags, 0);
> +
> + if (flags & ~PERF_PMU_TXN_ADD)
> + return 0;
> +
> perf_pmu_enable(pmu);
> return 0;
> }
>
> static void perf_pmu_cancel_txn(struct pmu *pmu)
> {
int flags = __this_cpu_read(nop_txn_flags);
__this_cpu_write(nop_txn_flags, 0);
> +
> + if (flags & ~PERF_PMU_TXN_ADD)
> + return;
> +
> perf_pmu_enable(pmu);
> }


\
 
 \ /
  Last update: 2015-07-16 23:01    [W:0.486 / U:0.176 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site