[lkml]   [2006]   [Mar]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
    SubjectRe: [patch 2/4] net: percpufy frequently used vars -- struct proto.memory_allocated
    On Tue, Mar 07, 2006 at 06:14:22PM -0800, Andrew Morton wrote:
    > Ravikiran G Thirumalai <> wrote:
    > >
    > > - if (atomic_read(sk->sk_prot->memory_allocated) < sk->sk_prot->sysctl_mem[0]) {
    > > + if (percpu_counter_read(sk->sk_prot->memory_allocated) <
    > > + sk->sk_prot->sysctl_mem[0]) {
    > Bear in mind that percpu_counter_read[_positive] can be inaccurate on large
    > CPU counts.
    > It might be worth running percpu_counter_sum() to get the exact count if we
    > think we're about to cause something to fail.

    The problem is percpu_counter_sum has to read all the cpus cachelines. If
    we have to use percpu_counter_sum everywhere, then might as well use plain
    per-cpu counters instead of batching ones no?

    sysctl_mem[0] is about 196K and on a 16 cpu box variance is 512 bytes, which
    is OK with just percpu_counter_read I hope. Maybe, on very large cpu counts,
    we should just change the FBC_BATCH so that variance does not go quadratic.
    Something like 32. So that variance is 32 * NR_CPUS in that case, instead
    of (NR_CPUS * NR_CPUS * 2) currently. Comments?
    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: 2006-03-08 04:09    [W:0.021 / U:3.640 seconds]
    ©2003-2017 Jasper Spaans. hosted at Digital OceanAdvertise on this site