[lkml]   [2011]   [Sep]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
    SubjectRe: [PATCH] percpu_counter: Put a reasonable upper bound on percpu_counter_batch

    Hi Ted,

    > Um, this was an ext4 patch and I pointed out it could cause
    > problems. (Specifically, data loss…)

    I'm a bit confused. While the comment mentions ext4, the patch is just
    putting an upper bound on the size of percpu_counter_batch and it is
    useful for percpu_counter_compare() too:

    static void compute_batch_value(void)
    int nr = num_online_cpus();

    - percpu_counter_batch = max(32, nr*2);
    + /*
    + * The cutoff point for the percpu_counter_compare() fast path grows
    + * at num_online_cpus^2 and on a big enough machine it will be
    + * unlikely to hit.
    + * We clamp the batch value to 1024 so the cutoff point only grows
    + * linearly past 512 CPUs.
    + */
    + percpu_counter_batch = clamp(nr*2, 32, 1024);

    The batch value should be opaque to the rest of the kernel. If ext4
    requires a specific batch value we can use the functions that take
    an explicit one (eg __percpu_counter_add).

    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to
    More majordomo info at
    Please read the FAQ at

     \ /
      Last update: 2011-09-07 19:09    [W:0.019 / U:8.644 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site