25 Sep, 2012

1 commit

  • When racing with CPU hotplug, percpu_counter_sum() can return negative
    values for the number of observed events.

    This confuses fprop_new_period(), which uses unsigned type and as a
    result number of events is set to big *positive* number. From that
    moment on, things go pear shaped and can result e.g. in division by
    zero as denominator is later truncated to 32-bits.

    This bug causes a divide-by-zero oops in bdi_dirty_limit() in Borislav's
    3.6.0-rc6 based kernel.

    Fix the issue by using a signed type in fprop_new_period(). That makes
    us bail out from the function without doing anything (mistakenly)
    thinking there are no events to age. That makes aging somewhat
    inaccurate but getting accurate data would be rather hard.

    Signed-off-by: Jan Kara
    Reported-by: Borislav Petkov
    Reported-by: Srivatsa S. Bhat
    Cc: Wu Fengguang
    Cc: Peter Zijlstra
    Cc:
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Jan Kara
     

09 Jun, 2012

2 commits

  • When percpu counter function in fprop_new_period() is interrupted by an
    interrupt while holding counter lock, it can cause deadlock when the
    interrupt wants to take the lock as well. Fix the problem by disabling
    interrupts when calling percpu counter functions.

    Signed-off-by: Jan Kara
    Signed-off-by: Fengguang Wu

    Jan Kara
     
  • Implement code computing proportions of events of different type (like code in
    lib/proportions.c) but allowing periods to have different lengths. This allows
    us to have aging periods of fixed wallclock time which gives better proportion
    estimates given the hugely varying throughput of different devices - previous
    measuring of aging period by number of events has the problem that a reasonable
    period length for a system with low-end USB stick is not a reasonable period
    length for a system with high-end storage array resulting either in too slow
    proportion updates or too fluctuating proportion updates.

    Acked-by: Peter Zijlstra
    Signed-off-by: Jan Kara
    Signed-off-by: Fengguang Wu

    Jan Kara