• Christoph Hellwig's avatar
    epoll: use the waitqueue lock to protect ep->wq · ee8ef0a4
    Christoph Hellwig authored
    Patch series "waitqueue lockdep annotation", v3.
    
    This series adds a strategic lockdep_assert_held to __wake_up_common to
    ensure callers really do hold the wait_queue_head lock when calling the
    unlocked wake_up variants.  It turns out epoll did not do this for a
    fairly common path (hit all the time by systemd during bootup), so the
    second patch fixed this instance as well.
    
    This patch (of 3):
    
    The epoll code currently uses the unlocked waitqueue helpers for managing
    ep->wq, but instead of holding the waitqueue lock around these calls, it
    uses its own ep->lock spinlock.  Given that the waitqueue is not exposed
    to the rest of the kernel this actually works ok at the moment, but
    prevents the epoll locking rules from being enforced using lockdep.
    Remove ep->lock and use the waitqueue lock to not only reduce the size of
    struct eventpoll but also to make sure we can assert locking invariants in
    the waitqueue code.
    
    Link: http://lkml.kernel.org/r/20171214152344.6880-2-hch@lst.deSigned-off-by: default avatarChristoph Hellwig <hch@lst.de>
    Reviewed-by: default avatarJason Baron <jbaron@akamai.com>
    Cc: Ingo Molnar <mingo@redhat.com>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Cc: Al Viro <viro@zeniv.linux.org.uk>
    Cc: Andrea Arcangeli <aarcange@redhat.com>
    Cc: Mike Rapoport <rppt@linux.vnet.ibm.com>
    Cc: Jason Baron <jbaron@akamai.com>
    Cc: Ingo Molnar <mingo@kernel.org>
    Cc: Matthew Wilcox <willy@infradead.org>
    Cc: Davidlohr Bueso <dave@stgolabs.net>
    Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
    Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
    ee8ef0a4
eventpoll.c 62.8 KB