[lkml]   [2012]   [Jul]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
    Patch in this message
    Subject[ 34/48] oprofile: perf: use NR_CPUS instead or nr_cpumask_bits for static array
    3.2-stable review patch.  If anyone has any objections, please let me know.


    From: Will Deacon <>

    commit e734568b675c985db2026848fefaac01c22977a5 upstream.

    The OProfile perf backend uses a static array to keep track of the
    perf events on the system. When compiling with CONFIG_CPUMASK_OFFSTACK=y
    && SMP, nr_cpumask_bits is not a compile-time constant and the build
    will fail with:

    oprofile_perf.c:28: error: variably modified 'perf_events' at file scope

    This patch uses NR_CPUs instead of nr_cpumask_bits for the array
    initialisation. If this causes space problems in the future, we can
    always move to dynamic allocation for the events array.

    Cc: Matt Fleming <>
    Reported-by: Russell King - ARM Linux <>
    Signed-off-by: Will Deacon <>
    Signed-off-by: Robert Richter <>
    Signed-off-by: Ben Hutchings <>
    drivers/oprofile/oprofile_perf.c | 2 +-
    1 file changed, 1 insertion(+), 1 deletion(-)

    diff --git a/drivers/oprofile/oprofile_perf.c b/drivers/oprofile/oprofile_perf.c
    index da14432..efc4b7f 100644
    --- a/drivers/oprofile/oprofile_perf.c
    +++ b/drivers/oprofile/oprofile_perf.c
    @@ -25,7 +25,7 @@ static int oprofile_perf_enabled;
    static DEFINE_MUTEX(oprofile_perf_mutex);

    static struct op_counter_config *counter_config;
    -static struct perf_event **perf_events[nr_cpumask_bits];
    +static struct perf_event **perf_events[NR_CPUS];
    static int num_counters;


     \ /
      Last update: 2012-07-01 21:02    [W:0.024 / U:4.684 seconds]
    ©2003-2017 Jasper Spaans. hosted at Digital OceanAdvertise on this site