[ovs-git] [openvswitch/ovs] 9a3cf0: ovs-vswitchd: Fire RCU callbacks before exit to re...

GitHub noreply at github.com
Thu Feb 1 19:31:16 UTC 2018


  Branch: refs/heads/master
  Home:   https://github.com/openvswitch/ovs
  Commit: 9a3cf0ac3397555b38acd6ed7fed6e7eea5c0335
      https://github.com/openvswitch/ovs/commit/9a3cf0ac3397555b38acd6ed7fed6e7eea5c0335
  Author: Ben Pfaff <blp at ovn.org>
  Date:   2018-02-01 (Thu, 01 Feb 2018)

  Changed paths:
    M lib/ovs-rcu.c
    M lib/ovs-rcu.h
    M vswitchd/ovs-vswitchd.c

  Log Message:
  -----------
  ovs-vswitchd: Fire RCU callbacks before exit to reduce memory leak warnings.

ovs-vswitchd makes extensive use of RCU to defer freeing memory past the
latest time that it could be in use by a thread.  Until now, ovs-vswitchd
has not waited for RCU callbacks to fire before exiting.  This meant that
in many cases, when ovs-vswitchd exits, many blocks of memory are stuck in
RCU callback queues, which valgrind often reports as "possible" memory
leaks.

This commit adds a new function ovsrcu_exit() that waits and fires as many
RCU callbacks as it reasonably can.  It can only do so for the thread that
calls it and the thread that calls the callbacks, but generally speaking
ovs-vswitchd shuts down other threads before it exits anyway, so this is
pretty good.

In my testing this eliminates most valgrind warnings for tests that run
ovs-vswitchd.  This ought to make it easier to distinguish new leaks that
are real from existing non-leaks.

Signed-off-by: Ben Pfaff <blp at ovn.org>
Acked-by: William Tu <u9012063 at gmai.com>


  Commit: 93f558421aadcd4fc0ff758bd61612c23747c72a
      https://github.com/openvswitch/ovs/commit/93f558421aadcd4fc0ff758bd61612c23747c72a
  Author: Ben Pfaff <blp at ovn.org>
  Date:   2018-02-01 (Thu, 01 Feb 2018)

  Changed paths:
    M include/openvswitch/vlog.h
    M lib/vlog.c
    M tests/glibc.supp
    M vswitchd/ovs-vswitchd.c

  Log Message:
  -----------
  ovs-vswitchd: Avoid or suppress memory leak warning for glibc aio.

The asynchronous IO library in glibc starts threads that show up as memory
leaks in valgrind.  This commit attempts to avoid the warnings by flushing
all the asynchronous I/O to the log file before exiting.  This only does
part of the job for glibc since it keeps the threads around for some
undefined idle time before killing them, so in addition this commit adds a
valgrind suppression to stop displaying these warnings in any case.

Signed-off-by: Ben Pfaff <blp at ovn.org>
Acked-by: William Tu <u9012063 at gmai.com>


Compare: https://github.com/openvswitch/ovs/compare/500db308e270...93f558421aad


More information about the git mailing list