• Eric Dumazet's avatar
    rcu: Allow rcu_do_batch() to dynamically adjust batch sizes · cfcdef5e
    Eric Dumazet authored
    Bimodal behavior of rcu_do_batch() is not really suited to Google
    applications like gfe servers.
    
    When a process with millions of sockets exits, closing all files
    queues two rcu callbacks per socket.
    
    This eventually reaches the point where RCU enters an emergency
    mode, where rcu_do_batch() do not return until whole queue is flushed.
    
    Each rcu callback lasts at least 70 nsec, so with millions of
    elements, we easily spend more than 100 msec without rescheduling.
    
    Goal of this patch is to avoid the infamous message like following
    "need_resched set for > 51999388 ns (52 ticks) without schedule"
    
    We dynamically adjust the number of elements we process, instead
    of 10 / INFINITE choices, we use a floor of ~1 % of current entries.
    
    If the number is above 1000, we switch to a time based limit of 3 msec
    per batch, adjustable with /sys/module/rcutree/parameters/rcu_resched_ns
    Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
    [ paulmck: Forward-port and remove debug statements. ]
    Signed-off-by: default avatarPaul E. McKenney <paulmck@linux.ibm.com>
    cfcdef5e
tree.c 114 KB