Skip to content
  • Linus Torvalds's avatar
    sched/headers: fix up header file dependency on <linux/sched/signal.h> · bd0f9b35
    Linus Torvalds authored
    The scheduler header file split and cleanups ended up exposing a few
    nasty header file dependencies, and in particular it showed how we in
    <linux/wait.h> ended up depending on "signal_pending()", which now comes
    from <linux/sched/signal.h>.
    
    That's a very subtle and annoying dependency, which already caused a
    semantic merge conflict (see commit e58bc927
    
     "Pull overlayfs updates
    from Miklos Szeredi", which added that fixup in the merge commit).
    
    It turns out that we can avoid this dependency _and_ improve code
    generation by moving the guts of the fairly nasty helper #define
    __wait_event_interruptible_locked() to out-of-line code.  The code that
    includes the signal_pending() check is all in the slow-path where we
    actually go to sleep waiting for the event anyway, so using a helper
    function is the right thing to do.
    
    Using a helper function is also what we already did for the non-locked
    versions, see the "__wait_event*()" macros and the "prepare_to_wait*()"
    set of helper functions.
    
    We might want to try to unify all these macro games, we have a _lot_ of
    subtly different wait-event loops.  But this is the minimal patch to fix
    the annoying header dependency.
    
    Acked-by: default avatarIngo Molnar <mingo@kernel.org>
    Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
    bd0f9b35