All of lore.kernel.org
 help / color / mirror / Atom feed
* [GIT PULL] sched.h split-up
@ 2017-03-03  1:36 Ingo Molnar
  2017-03-03 20:13 ` Linus Torvalds
  0 siblings, 1 reply; 14+ messages in thread
From: Ingo Molnar @ 2017-03-03  1:36 UTC (permalink / raw)
  To: Linus Torvalds
  Cc: linux-kernel, Peter Zijlstra, Thomas Gleixner, Andrew Morton

Linus,

Please pull the sched.h splitup git tree from:

   git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git WIP.sched-core-for-linus

   # HEAD: 5eca1c10cbaa9c366c18ca79f81f21c731e3dcc7 sched/headers: Clean up <linux/sched.h>

The point of these changes is to significantly reduce the <linux/sched.h> header 
footprint, to speed up the kernel build and to have a cleaner header structure.

After these changes the new <linux/sched.h>'s typical preprocessed size goes down 
from a previous ~0.68 MB (~22K lines) to ~0.45 MB (~15K lines), which is around 
40% faster to build on typical configs.

Not much changed from the last version (-v2) posted three weeks ago: I eliminated 
quirks, backmerged fixes plus I rebased it to an upstream SHA1 from yesterday that 
includes most changes queued up in -next plus all sched.h changes that were 
pending from Andrew.

I've re-tested the series both on x86 and on cross-arch defconfigs, and did a 
bisectability test at a number of random points.

I tried to test as many build configurations as possible, but some build breakage 
is probably still left - but it should be mostly limited to architectures that 
have no cross-compiler binaries available on kernel.org, and non-default 
configurations.

 Thanks,

	Ingo

------------------>
Ingo Molnar (146):
      sched/headers: Make all include/linux/sched/*.h headers build standalone
      sched/core: Convert ___assert_task_state() link time assert to BUILD_BUG_ON()
      sched/core: Move the get_preempt_disable_ip() inline to sched/core.c
      sched/core: Remove the tsk_cpus_allowed() wrapper
      sched/core: Remove the tsk_nr_cpus_allowed() wrapper
      rcu: Separate the RCU synchronization types and APIs into <linux/rcupdate_wait.h>
      sched/headers, cgroups: Remove the threadgroup_change_*() wrappery
      mm/vmacache, sched/headers: Introduce 'struct vmacache' and move it from <linux/sched.h> to <linux/mm_types>
      kasan, sched/headers: Uninline kasan_enable/disable_current()
      sched/headers: Prepare for new header dependencies before moving code to <linux/sched/topology.h>
      sched/headers: Prepare for new header dependencies before moving code to <linux/sched/idle.h>
      sched/headers: Prepare for new header dependencies before moving code to <linux/sched/wake_q.h>
      sched/headers: Prepare for new header dependencies before moving code to <linux/sched/clock.h>
      sched/headers: Prepare for new header dependencies before moving code to <uapi/linux/sched/types.h>
      sched/headers: Prepare for new header dependencies before moving code to <linux/sched/loadavg.h>
      sched/headers: Prepare for new header dependencies before moving code to <linux/sched/autogroup.h>
      sched/headers: Prepare for new header dependencies before moving code to <linux/sched/mm.h>
      sched/headers: Prepare for new header dependencies before moving code to <linux/sched/coredump.h>
      sched/headers: Prepare for new header dependencies before moving code to <linux/sched/signal.h>
      sched/headers: Prepare for new header dependencies before moving code to <linux/sched/user.h>
      sched/headers: Prepare for new header dependencies before moving code to <linux/sched/nmi.h>
      sched/headers: Prepare for new header dependencies before moving code to <linux/sched/cpufreq.h>
      sched/headers: Prepare for new header dependencies before moving more code to <linux/sched/mm.h>
      sched/headers: Prepare for new header dependencies before moving code to <linux/sched/numa_balancing.h>
      sched/headers: Prepare for new header dependencies before moving code to <linux/sched/jobctl.h>
      sched/headers: Prepare header dependency changes, move the <asm/paravirt.h> include to kernel/sched/sched.h
      sched/headers: Prepare to remove <linux/cred.h> inclusion from <linux/sched.h>
      sched/headers: Prepare for the removal of <asm/ptrace.h> from <linux/sched.h>
      sched/headers: Prepare for the removal of <linux/rtmutex.h> from <linux/sched.h>
      sched/headers: Prepare for the removal of various unrelated headers from <linux/sched.h>
      sched/headers: Prepare for new header dependencies before moving code to <linux/sched/xacct.h>
      sched/headers: Prepare to move signal wakeup & sigpending methods from <linux/sched.h> into <linux/sched/signal.h>
      sched/headers: Prepare to move the memalloc_noio_*() APIs to <linux/sched/mm.h>
      sched/headers: Prepare to remove the <linux/gfp.h> include from <linux/sched.h>
      sched/headers: Prepare for new header dependencies before moving code to <linux/sched/stat.h>
      sched/headers: Prepare for new header dependencies before moving code to <linux/sched/nohz.h>
      sched/headers: Prepare for new header dependencies before moving code to <linux/sched/debug.h>
      sched/headers: Prepare for new header dependencies before moving code to <linux/sched/hotplug.h>
      sched/headers: Prepare for new header dependencies before moving code to <linux/sched/task.h>
      sched/headers: Prepare for new header dependencies before moving code to <linux/sched/task_stack.h>
      sched/headers: Prepare to move the 'root_task_group' declaration to <linux/sched/autogroup.h>
      signals: Prepare to split out <linux/signal_types.h> from <linux/signal.h>
      sched/headers: Prepare for the reduction of <linux/sched.h>'s signal API dependency
      mm/headers, sched/headers: Prepare to split <linux/mm_types_task.h> out of <linux/mm_types.h>
      sched/headers: Prepare to remove the <linux/mm_types.h> dependency from <linux/sched.h>
      sched/headers: Prepare to move 'init_task' and 'init_thread_union' from <linux/sched.h> to <linux/sched/task.h>
      sched/headers: Prepare to use <linux/rcuupdate.h> instead of <linux/rculist.h> in <linux/sched.h>
      sched/headers: Prepare to move the task_lock()/unlock() APIs to <linux/sched/task.h>
      sched/headers: Prepare to move cputime functionality from <linux/sched.h> into <linux/sched/cputime.h>
      sched/headers: Prepare to move sched_info_on() and force_schedstat_enabled() from <linux/sched.h> to <linux/sched/stat.h>
      sched/headers, vfs/execve: Prepare to move the do_execve*() prototypes from <linux/sched.h> to <linux/binfmts.h>
      sched/headers: Prepare to move kstack_end() from <linux/sched.h> to <linux/sched/task_stack.h>
      sched/headers: Prepare to move exit_files() and exit_itimers() from <linux/sched.h> to <linux/sched/task.h>
      sched/headers: Prepare to move _init() prototypes from <linux/sched.h> to <linux/sched/init.h>
      sched/headers: Prepare to move the get_task_struct()/put_task_struct() and related APIs from <linux/sched.h> to <linux/sched/task.h>
      sched/headers: Prepare to remove the <linux/magic.h> include from <linux/sched/task_stack.h>
      sched/headers: Prepare to remove spurious <linux/sched.h> inclusion dependencies
      sched/headers: Move scheduler topology interfaces to <linux/sched/topology.h>
      sched/headers: Move the 'cpu_idle_type' enum from <linux/sched.h> to <linux/sched/idle.h>
      sched/headers: Move the wake_up_if_idle() prototype to <linux/sched/idle.h>
      sched/headers: Move idle polling methods to <linux/sched/idle.h>
      sched/headers: Move the wake-queue types and interfaces from sched.h into <linux/sched/wake_q.h>
      sched/headers: Move scheduler clock interfaces to <linux/sched/clock.h>
      sched/headers, delayacct: Move the 'struct task_delay_info' definition from <linux/sched.h> to <linux/delayacct.h>
      sched/headers: Move various ABI definitions to <uapi/linux/sched/types.h>
      sched/headers: Move loadavg related definitions from <linux/sched.h> to <linux/sched/loadavg.h>
      sched/headers: Move autogroup APIs into <linux/sched/autogroup.h>
      sched/headers: Move task->mm handling methods to <linux/sched/mm.h>
      sched/headers: Move task->mm coredumping related defines and methods from <linux/sched.h> to <linux/sched/coredump.h>
      sched/headers: Move task_struct::signal and task_struct::sighand types and accessors into <linux/sched/signal.h>
      sched/headers: Move 'struct user_struct' definition and APIs to the new <linux/sched/user.h> header
      sched/headers: Move softlockup detector watchdog methods to <linux/nmi.h>
      sched/headers: Move 'struct pacct_struct' and 'struct cpu_itimer' form <linux/sched.h> to <linux/sched/signal.h>
      sched/headers: Move the cpufreq interfaces to <linux/sched/cpufreq.h>
      sched/headers: Move more mm_struct related functionality from <linux/sched.h> to <linux/sched/mm.h>
      sched/headers: Move the 'init_mm' declaration from <linux/sched.h> to <linux/mm_types.h>
      sched/headers: Move in_vfork() from <linux/sched.h> to <linux/sched/mm.h>
      sched/headers: Move the NUMA balancing interfaces from <linux/sched.h> to <linux/sched/numa_balancing.h>
      sched/headers: Move the JOBCTL_ defines and methods from <linux/sched.h> to <linux/sched/jobctl.h>
      sched/headers: Remove various unrelated headers from <linux/sched.h>
      sched/headers: Move CONFIG_TASK_XACCT bits from <linux/sched.h> to <linux/sched/xacct.h>
      sched/headers: Move signal wakeup & sigpending methods from <linux/sched.h> into <linux/sched/signal.h>
      sched/headers: Move the memalloc_noio_*() APIs to <linux/sched/mm.h>
      sched/headers: Move task statistics APIs from <linux/sched.h> to <linux/sched/stat.h>
      sched/headers: Move the NOHZ APIs from <linux/sched.h> to <linux/sched/nohz.h>
      sched/headers: Move debugging functions from <linux/sched.h> to <linux/sched/debug.h>
      sched/headers, time/timekeeping: Move the xtime_update() prototype from <linux/sched.h> to <linux/time.h>
      sched/headers: Move <asm/current.h> include from the middle of <linux/sched.h> to the header portion
      sched/headers: Split hotplug CPU interfaces out of <linux/sched.h> into <linux/sched/hotplug.h>
      sched/headers: Move task lifetime APIs from <linux/sched.h> to <linux/sched/task.h>
      sched/headers, RCU: Move rcu_copy_process() from <linux/sched/task.h> to kernel/fork.c
      sched/core: Move, sort and clean up <linux/sched.h> structure predeclarations
      sched/headers: Move the PREEMPT_COUNT defines from <linux/sched.h> to <linux/preempt.h>
      sched/headers: Move task-stack related APIs from <linux/sched.h> to <linux/sched/task_stack.h>
      sched/headers: Move the 'root_task_group' declaration to <linux/sched/autogroup.h>
      signals: Move signal data types from <linux/signal.h> to <linux/signal_types.h>
      mm/headers, sched/headers: Move task related MM types from <linux/mm_types.> to <linux/mm_types_task.h>
      sched/headers: Remove the <linux/mm_types.h> dependency from <linux/sched.h>
      sched/headers: Move 'init_task' and 'init_thread_union' from <linux/sched.h> to <linux/sched/task.h>
      sched/headers: Move the task_lock()/unlock() APIs to <linux/sched/task.h>
      sched/headers: Move cputime functionality from <linux/sched.h> and <linux/cputime.h> into <linux/sched/cputime.h>
      sched/headers: Move sched_info_on() and force_schedstat_enabled() from <linux/sched.h> to <linux/sched/stat.h>
      sched/headers, vfs/execve: Move the do_execve*() prototypes from <linux/sched.h> to <linux/binfmts.h>
      sched/headers: Move kstack_end() from <linux/sched.h> to <linux/sched/task_stack.h>
      sched/headers: Move exit_files() and exit_itimers() from <linux/sched.h> to <linux/sched/task.h>
      sched/headers: Move _init() prototypes from <linux/sched.h> to <linux/sched/init.h>
      sched/headers, timekeeping: Move the timer tick function prototypes to <linux/timekeeping.h>
      sched/headers, mm: Move 'struct tlbflush_unmap_batch' from <linux/sched.h> to <linux/mm_types_task.h>
      sched/headers: Move the get_task_struct()/put_task_struct() and related APIs from <linux/sched.h> to <linux/sched/task.h>
      sched/headers: Move the sched_exec() prototype to <linux/sched/task.h>
      sched/headers: Remove <linux/sched.h> from <linux/sched/topology.h>
      sched/headers: Remove tsk_is_polling()
      sched/headers: Remove <linux/sched.h> from <linux/sched/clock.h>
      sched/headers: Remove <linux/sched.h> and <linux/slab.h> from <linux/delayacct.h>
      sched/headers: Remove <linux/sched.h> from <linux/sched/loadavg.h>
      sched/headers: Remove <linux/sched.h> from <linux/sched/autogroup.h>
      sched/headers: Remove <linux/sched.h> from <linux/sched/mm.h>
      sched/headers: Remove <linux/sched.h> from <linux/sched/coredump.h>
      sched/headers: Remove unused 'task_can_switch_user()' prototype
      sched/headers: Remove <linux/sched.h> from <linux/sched/user.h>
      sched/headers: Remove #include <linux/capability.h> from <linux/sched.h>
      sched/headers: Remove <linux/cgroup-defs.h> from <linux/sched.h>
      sched/headers: Remove <linux/sched.h> from <linux/sched/cpufreq.h>
      kasan, sched/headers: Remove <linux/sched.h> from <linux/kasan.h>
      sched/headers: Remove <linux/cred.h> inclusion from <linux/sched.h>
      sched/headers: Remove <asm/ptrace.h> from <linux/sched.h>
      sched/headers: Remove <linux/rtmutex.h> from <linux/sched.h>
      sched/headers: Remove the <linux/gfp.h> include from <linux/sched.h>
      sched/headers: Remove <linux/sched.h> from <linux/sched/stat.h>
      sched/headers: Remove <linux/sched.h> from <linux/sched/nohz.h>
      sched/headers: Remove <linux/sched.h> from <linux/sched/debug.h>
      sched/headers: Remove <linux/sched.h> from <linux/sched/hotplug.h>
      sched/headers: Remove the runqueue_is_locked() prototype
      sched/headers: Remove <linux/rwsem.h> from <linux/sched.h>
      sched/headers: Remove <linux/signal.h> from <linux/sched.h>
      sched/headers: Remove the 'init_pid_ns' prototype from <linux/sched.h>
      sched/headers: Remove <linux/rculist.h> from <linux/sched.h>
      sched/core: Remove unused prefetch_stack()
      sched/headers: Remove <linux/sched.h> from <linux/sched/init.h>
      sched/headers: Remove <linux/magic.h> from <linux/sched/task_stack.h>
      sched/headers, timers: Remove the <linux/sysctl.h> include from <linux/timer.h>
      sched/headers, x86/apic: Remove the <linux/pm.h> header inclusion from <asm/apic.h>
      sched/headers, hrtimer: Remove the <linux/wait.h> include from <linux/hrtimer.h>
      sched/headers: Remove the <linux/topology.h> include from <linux/sched.h>
      sched/headers: Remove #ifdefs from <linux/sched.h>
      sched/headers: Clean up <linux/sched.h>


 arch/alpha/include/asm/a.out-core.h                |    1 +
 arch/alpha/include/asm/mmu_context.h               |    2 +
 arch/alpha/kernel/osf_sys.c                        |    5 +-
 arch/alpha/kernel/process.c                        |    3 +
 arch/alpha/kernel/ptrace.c                         |    1 +
 arch/alpha/kernel/signal.c                         |    3 +-
 arch/alpha/kernel/smp.c                            |    2 +-
 arch/alpha/kernel/traps.c                          |    3 +-
 arch/alpha/math-emu/math.c                         |    1 +
 arch/alpha/mm/fault.c                              |    2 +-
 arch/arc/include/asm/mmu_context.h                 |    1 +
 arch/arc/kernel/ctx_sw.c                           |    1 +
 arch/arc/kernel/kgdb.c                             |    1 +
 arch/arc/kernel/process.c                          |    3 +
 arch/arc/kernel/ptrace.c                           |    1 +
 arch/arc/kernel/signal.c                           |    2 +
 arch/arc/kernel/smp.c                              |    2 +-
 arch/arc/kernel/stacktrace.c                       |    2 +
 arch/arc/kernel/traps.c                            |    2 +-
 arch/arc/kernel/troubleshoot.c                     |    3 +
 arch/arc/mm/fault.c                                |    2 +-
 arch/arc/mm/mmap.c                                 |    3 +-
 arch/arc/mm/tlb.c                                  |    2 +
 arch/arm/common/bL_switcher.c                      |    3 +-
 arch/arm/include/asm/mmu_context.h                 |    2 +
 arch/arm/include/asm/tlbflush.h                    |    7 +-
 arch/arm/kernel/perf_regs.c                        |    1 +
 arch/arm/kernel/process.c                          |    3 +
 arch/arm/kernel/ptrace.c                           |    3 +-
 arch/arm/kernel/smp.c                              |    4 +-
 arch/arm/kernel/stacktrace.c                       |    1 +
 arch/arm/kernel/suspend.c                          |    1 +
 arch/arm/kernel/swp_emulate.c                      |    1 +
 arch/arm/kernel/sys_oabi-compat.c                  |    1 +
 arch/arm/kernel/topology.c                         |    1 +
 arch/arm/kernel/traps.c                            |    4 +-
 arch/arm/mach-bcm/platsmp.c                        |    1 +
 arch/arm/mach-omap2/pm-debug.c                     |    1 +
 arch/arm/mach-rpc/ecard.c                          |    1 +
 arch/arm/mm/alignment.c                            |    3 +-
 arch/arm/mm/fault.c                                |    3 +-
 arch/arm/mm/idmap.c                                |    1 +
 arch/arm/mm/init.c                                 |    2 +
 arch/arm/mm/mmap.c                                 |    3 +-
 arch/arm/nwfpe/fpmodule.c                          |    2 +-
 arch/arm/probes/kprobes/core.c                     |    1 +
 arch/arm/probes/kprobes/test-core.c                |    1 +
 arch/arm/vfp/vfpmodule.c                           |    2 +-
 arch/arm64/include/asm/compat.h                    |    1 +
 arch/arm64/include/asm/mmu_context.h               |    2 +
 arch/arm64/kernel/debug-monitors.c                 |    1 +
 arch/arm64/kernel/fpsimd.c                         |    2 +-
 arch/arm64/kernel/kgdb.c                           |    2 +
 arch/arm64/kernel/perf_regs.c                      |    1 +
 arch/arm64/kernel/probes/kprobes.c                 |    1 +
 arch/arm64/kernel/process.c                        |    3 +
 arch/arm64/kernel/ptrace.c                         |    3 +-
 arch/arm64/kernel/setup.c                          |    1 +
 arch/arm64/kernel/smp.c                            |    4 +-
 arch/arm64/kernel/stacktrace.c                     |    2 +
 arch/arm64/kernel/sys_compat.c                     |    1 +
 arch/arm64/kernel/topology.c                       |    1 +
 arch/arm64/kernel/traps.c                          |    5 +-
 arch/arm64/mm/fault.c                              |    3 +-
 arch/arm64/mm/kasan_init.c                         |    1 +
 arch/arm64/mm/mmap.c                               |    3 +-
 arch/avr32/include/asm/mmu_context.h               |    2 +
 arch/avr32/kernel/nmi_debug.c                      |    1 +
 arch/avr32/kernel/process.c                        |    3 +
 arch/avr32/kernel/ptrace.c                         |    1 +
 arch/avr32/kernel/stacktrace.c                     |    1 +
 arch/avr32/kernel/traps.c                          |    2 +-
 arch/blackfin/include/asm/mmu_context.h            |    2 +
 arch/blackfin/kernel/dumpstack.c                   |    2 +
 arch/blackfin/kernel/early_printk.c                |    1 +
 arch/blackfin/kernel/flat.c                        |    1 +
 arch/blackfin/kernel/nmi.c                         |    1 +
 arch/blackfin/kernel/process.c                     |    4 +
 arch/blackfin/kernel/ptrace.c                      |    1 +
 arch/blackfin/kernel/signal.c                      |    1 +
 arch/blackfin/kernel/stacktrace.c                  |    1 +
 arch/blackfin/kernel/trace.c                       |    4 +-
 arch/blackfin/kernel/traps.c                       |    2 +
 arch/blackfin/mach-common/ints-priority.c          |    1 +
 arch/blackfin/mach-common/smp.c                    |    3 +-
 arch/blackfin/mm/isram-driver.c                    |    1 +
 arch/blackfin/mm/sram-alloc.c                      |    2 +
 arch/c6x/kernel/process.c                          |    2 +
 arch/c6x/kernel/ptrace.c                           |    1 +
 arch/c6x/kernel/traps.c                            |    1 +
 arch/cris/arch-v10/drivers/sync_serial.c           |    2 +-
 arch/cris/arch-v10/kernel/process.c                |    3 +
 arch/cris/arch-v10/kernel/ptrace.c                 |    1 +
 arch/cris/arch-v10/kernel/signal.c                 |    1 +
 arch/cris/arch-v10/kernel/traps.c                  |    2 +
 arch/cris/arch-v10/mm/tlb.c                        |    2 +
 arch/cris/arch-v32/drivers/sync_serial.c           |    2 +-
 arch/cris/arch-v32/kernel/process.c                |    3 +
 arch/cris/arch-v32/kernel/ptrace.c                 |    1 +
 arch/cris/arch-v32/kernel/signal.c                 |    1 +
 arch/cris/arch-v32/kernel/traps.c                  |    2 +
 arch/cris/arch-v32/mm/tlb.c                        |    1 +
 arch/cris/include/asm/pgtable.h                    |    2 +-
 arch/cris/kernel/irq.c                             |    1 +
 arch/cris/kernel/process.c                         |    1 +
 arch/cris/kernel/stacktrace.c                      |    2 +-
 arch/cris/kernel/time.c                            |    2 +-
 arch/cris/kernel/traps.c                           |    1 +
 arch/cris/mm/fault.c                               |    1 +
 arch/cris/mm/tlb.c                                 |    2 +
 arch/frv/kernel/process.c                          |    3 +
 arch/frv/kernel/traps.c                            |    3 +-
 arch/frv/mm/elf-fdpic.c                            |    1 +
 arch/frv/mm/init.c                                 |    1 +
 arch/frv/mm/mmu-context.c                          |    2 +
 arch/h8300/kernel/process.c                        |    3 +
 arch/h8300/kernel/ptrace_s.c                       |    2 +-
 arch/h8300/kernel/signal.c                         |    1 +
 arch/h8300/kernel/traps.c                          |    2 +
 arch/hexagon/include/asm/mmu_context.h             |    2 +
 arch/hexagon/kernel/kgdb.c                         |    1 +
 arch/hexagon/kernel/process.c                      |    3 +
 arch/hexagon/kernel/ptrace.c                       |    1 +
 arch/hexagon/kernel/signal.c                       |    2 +
 arch/hexagon/kernel/smp.c                          |    3 +-
 arch/hexagon/kernel/stacktrace.c                   |    1 +
 arch/hexagon/kernel/traps.c                        |    4 +-
 arch/hexagon/kernel/vm_events.c                    |    1 +
 arch/hexagon/mm/vm_fault.c                         |    1 +
 arch/ia64/hp/sim/simserial.c                       |    1 +
 arch/ia64/include/asm/mmu_context.h                |    1 +
 arch/ia64/include/asm/pgtable.h                    |    2 +-
 arch/ia64/include/asm/processor.h                  |    2 -
 arch/ia64/kernel/asm-offsets.c                     |    2 +-
 arch/ia64/kernel/brl_emu.c                         |    2 +-
 arch/ia64/kernel/entry.S                           |   23 -
 arch/ia64/kernel/mca.c                             |    4 +-
 arch/ia64/kernel/perfmon.c                         |    2 +
 arch/ia64/kernel/process.c                         |    4 +
 arch/ia64/kernel/ptrace.c                          |    2 +
 arch/ia64/kernel/setup.c                           |    5 +-
 arch/ia64/kernel/sys_ia64.c                        |    2 +
 arch/ia64/kernel/time.c                            |    3 +-
 arch/ia64/kernel/traps.c                           |    3 +-
 arch/ia64/kernel/unaligned.c                       |    2 +-
 arch/ia64/kernel/uncached.c                        |    1 +
 arch/ia64/mm/fault.c                               |    2 +-
 arch/ia64/mm/init.c                                |    1 +
 arch/ia64/sn/kernel/sn2/sn2_smp.c                  |    1 +
 arch/m32r/include/asm/mmu_context.h                |    2 +
 arch/m32r/kernel/process.c                         |    3 +
 arch/m32r/kernel/ptrace.c                          |    1 +
 arch/m32r/kernel/setup.c                           |    2 +-
 arch/m32r/kernel/smpboot.c                         |    1 +
 arch/m32r/kernel/traps.c                           |    4 +
 arch/m68k/include/asm/a.out-core.h                 |    1 +
 arch/m68k/include/asm/mmu_context.h                |    1 +
 arch/m68k/kernel/process.c                         |    3 +
 arch/m68k/kernel/ptrace.c                          |    1 +
 arch/m68k/kernel/time.c                            |    1 +
 arch/m68k/kernel/traps.c                           |    1 +
 arch/m68k/mac/macints.c                            |    1 +
 arch/m68k/sun3/mmu_emu.c                           |    1 +
 arch/metag/include/asm/mmu_context.h               |    1 +
 arch/metag/kernel/process.c                        |    3 +
 arch/metag/kernel/ptrace.c                         |    2 +
 arch/metag/kernel/signal.c                         |    1 +
 arch/metag/kernel/smp.c                            |    4 +-
 arch/metag/kernel/stacktrace.c                     |    2 +
 arch/metag/kernel/traps.c                          |    3 +
 arch/metag/mm/fault.c                              |    1 +
 arch/metag/mm/init.c                               |    1 +
 arch/microblaze/include/asm/mmu_context_mm.h       |    2 +
 arch/microblaze/kernel/exceptions.c                |    1 +
 arch/microblaze/kernel/heartbeat.c                 |    1 +
 arch/microblaze/kernel/process.c                   |    3 +
 arch/microblaze/kernel/ptrace.c                    |    1 +
 arch/microblaze/kernel/timer.c                     |    1 +
 arch/microblaze/kernel/traps.c                     |    1 +
 arch/microblaze/kernel/unwind.c                    |    1 +
 arch/microblaze/mm/pgtable.c                       |    1 +
 arch/mips/cavium-octeon/smp.c                      |    1 +
 arch/mips/include/asm/abi.h                        |    2 +
 arch/mips/include/asm/elf.h                        |    2 +
 arch/mips/include/asm/fpu.h                        |    1 +
 arch/mips/include/asm/mmu_context.h                |    2 +
 arch/mips/kernel/branch.c                          |    2 +-
 arch/mips/kernel/crash.c                           |    1 +
 arch/mips/kernel/mips-mt-fpaff.c                   |    2 +
 arch/mips/kernel/perf_event.c                      |    1 +
 arch/mips/kernel/process.c                         |    3 +
 arch/mips/kernel/ptrace.c                          |    1 +
 arch/mips/kernel/ptrace32.c                        |    1 +
 arch/mips/kernel/rtlx.c                            |    2 +
 arch/mips/kernel/signal_o32.c                      |    1 +
 arch/mips/kernel/smp-bmips.c                       |    1 +
 arch/mips/kernel/smp-cps.c                         |    3 +-
 arch/mips/kernel/smp.c                             |    2 +-
 arch/mips/kernel/stacktrace.c                      |    2 +
 arch/mips/kernel/syscall.c                         |    1 +
 arch/mips/kernel/traps.c                           |    3 +-
 arch/mips/kvm/mips.c                               |    2 +
 arch/mips/loongson64/loongson-3/smp.c              |    2 +
 arch/mips/math-emu/dsemul.c                        |    2 +
 arch/mips/mm/ioremap.c                             |    1 +
 arch/mips/mm/mmap.c                                |    3 +-
 arch/mips/paravirt/paravirt-smp.c                  |    1 +
 arch/mips/sgi-ip22/ip22-berr.c                     |    2 +-
 arch/mips/sgi-ip22/ip22-reset.c                    |    2 +-
 arch/mips/sgi-ip22/ip28-berr.c                     |    1 +
 arch/mips/sgi-ip27/ip27-berr.c                     |    1 +
 arch/mips/sgi-ip27/ip27-smp.c                      |    1 +
 arch/mips/sgi-ip32/ip32-berr.c                     |    1 +
 arch/mips/sgi-ip32/ip32-irq.c                      |    1 +
 arch/mips/sibyte/bcm1480/smp.c                     |    1 +
 arch/mips/sibyte/sb1250/smp.c                      |    2 +-
 arch/mn10300/include/asm/mmu_context.h             |    2 +
 arch/mn10300/kernel/fpu.c                          |    2 +
 arch/mn10300/kernel/process.c                      |    3 +
 arch/mn10300/kernel/ptrace.c                       |    1 +
 arch/mn10300/kernel/smp.c                          |    3 +-
 arch/mn10300/kernel/time.c                         |    1 +
 arch/mn10300/kernel/traps.c                        |    1 +
 arch/mn10300/mm/tlb-smp.c                          |    2 +-
 arch/nios2/include/asm/mmu_context.h               |    2 +
 arch/nios2/kernel/process.c                        |    4 +
 arch/nios2/kernel/ptrace.c                         |    1 +
 arch/nios2/kernel/setup.c                          |    1 +
 arch/nios2/kernel/traps.c                          |    1 +
 arch/nios2/mm/fault.c                              |    1 +
 arch/openrisc/kernel/process.c                     |    3 +
 arch/openrisc/kernel/ptrace.c                      |    1 +
 arch/openrisc/kernel/traps.c                       |    2 +
 arch/openrisc/mm/fault.c                           |    2 +-
 arch/parisc/kernel/cache.c                         |    1 +
 arch/parisc/kernel/pa7300lc.c                      |    1 +
 arch/parisc/kernel/process.c                       |    3 +
 arch/parisc/kernel/setup.c                         |    1 +
 arch/parisc/kernel/signal.c                        |    1 +
 arch/parisc/kernel/smp.c                           |    2 +-
 arch/parisc/kernel/sys_parisc.c                    |    2 +
 arch/parisc/kernel/time.c                          |    1 +
 arch/parisc/kernel/traps.c                         |    1 +
 arch/parisc/kernel/unaligned.c                     |    3 +-
 arch/parisc/math-emu/driver.c                      |    3 +-
 arch/parisc/mm/fault.c                             |    1 +
 arch/parisc/mm/hugetlbpage.c                       |    1 +
 arch/powerpc/kernel/io-workarounds.c               |    2 +-
 arch/powerpc/kernel/paca.c                         |    1 +
 arch/powerpc/kernel/process.c                      |    3 +
 arch/powerpc/kernel/smp.c                          |    5 +-
 arch/powerpc/kernel/stacktrace.c                   |    1 +
 arch/powerpc/kernel/swsusp_64.c                    |    1 +
 arch/powerpc/kernel/time.c                         |    3 +-
 arch/powerpc/kernel/traps.c                        |    1 +
 arch/powerpc/kvm/book3s_64_vio.c                   |    1 +
 arch/powerpc/kvm/book3s_hv.c                       |    3 +-
 arch/powerpc/kvm/book3s_mmu_hpte.c                 |    1 +
 arch/powerpc/kvm/e500_mmu_host.c                   |    2 +-
 arch/powerpc/kvm/powerpc.c                         |    1 +
 arch/powerpc/lib/feature-fixups.c                  |    1 +
 arch/powerpc/mm/fault.c                            |    1 +
 arch/powerpc/mm/hash_utils_64.c                    |    2 +-
 arch/powerpc/mm/mmap.c                             |    3 +-
 arch/powerpc/mm/mmu_context_iommu.c                |    2 +-
 arch/powerpc/mm/pgtable-book3s64.c                 |    2 +
 arch/powerpc/mm/pgtable-hash64.c                   |    2 +
 arch/powerpc/mm/pgtable-radix.c                    |    2 +-
 arch/powerpc/mm/slb.c                              |    2 +
 arch/powerpc/perf/perf_regs.c                      |    1 +
 arch/powerpc/platforms/83xx/suspend.c              |    1 +
 arch/powerpc/platforms/85xx/smp.c                  |    1 +
 arch/powerpc/platforms/cell/cpufreq_spudemand.c    |    1 +
 arch/powerpc/platforms/cell/spufs/context.c        |    2 +
 arch/powerpc/platforms/cell/spufs/fault.c          |    2 +-
 arch/powerpc/platforms/cell/spufs/sched.c          |    5 +-
 arch/powerpc/platforms/cell/spufs/spufs.h          |    1 +
 arch/powerpc/platforms/powermac/smp.c              |    1 +
 arch/powerpc/platforms/powernv/smp.c               |    1 +
 arch/powerpc/platforms/pseries/hotplug-cpu.c       |    1 +
 arch/powerpc/xmon/xmon.c                           |    2 +-
 arch/s390/appldata/appldata_base.c                 |    1 +
 arch/s390/appldata/appldata_os.c                   |    2 +
 arch/s390/crypto/prng.c                            |    2 +
 arch/s390/include/asm/compat.h                     |    1 +
 arch/s390/include/asm/elf.h                        |    2 +-
 arch/s390/include/asm/kprobes.h                    |    1 +
 arch/s390/include/asm/mmu_context.h                |    1 +
 arch/s390/kernel/compat_signal.c                   |    1 +
 arch/s390/kernel/dumpstack.c                       |    2 +
 arch/s390/kernel/idle.c                            |    2 +-
 arch/s390/kernel/nmi.c                             |    3 +
 arch/s390/kernel/process.c                         |    3 +
 arch/s390/kernel/processor.c                       |    3 +
 arch/s390/kernel/ptrace.c                          |    1 +
 arch/s390/kernel/runtime_instr.c                   |    2 +
 arch/s390/kernel/setup.c                           |    2 +
 arch/s390/kernel/signal.c                          |    1 +
 arch/s390/kernel/smp.c                             |    2 +
 arch/s390/kernel/stacktrace.c                      |    1 +
 arch/s390/kernel/time.c                            |    1 +
 arch/s390/kernel/topology.c                        |    1 +
 arch/s390/kernel/traps.c                           |    1 +
 arch/s390/kernel/uprobes.c                         |    2 +
 arch/s390/kernel/vtime.c                           |    2 +-
 arch/s390/kvm/gaccess.c                            |    2 +
 arch/s390/kvm/kvm-s390.c                           |    2 +
 arch/s390/kvm/priv.c                               |    2 +
 arch/s390/kvm/vsie.c                               |    2 +
 arch/s390/mm/fault.c                               |    1 +
 arch/s390/mm/mmap.c                                |    2 +
 arch/score/include/asm/mmu_context.h               |    2 +
 arch/score/kernel/process.c                        |    2 +
 arch/score/kernel/ptrace.c                         |    1 +
 arch/score/kernel/traps.c                          |    5 +-
 arch/sh/drivers/heartbeat.c                        |    1 +
 arch/sh/include/asm/fpu.h                          |    2 +
 arch/sh/include/asm/mmu_context.h                  |    2 +
 arch/sh/kernel/cpu/fpu.c                           |    5 +-
 arch/sh/kernel/cpu/sh2a/fpu.c                      |    2 +-
 arch/sh/kernel/cpu/sh4/fpu.c                       |    3 +-
 arch/sh/kernel/disassemble.c                       |    2 +
 arch/sh/kernel/dumpstack.c                         |    2 +
 arch/sh/kernel/hw_breakpoint.c                     |    1 +
 arch/sh/kernel/kgdb.c                              |    2 +
 arch/sh/kernel/nmi_debug.c                         |    1 +
 arch/sh/kernel/process.c                           |    4 +-
 arch/sh/kernel/process_32.c                        |    3 +
 arch/sh/kernel/process_64.c                        |    3 +
 arch/sh/kernel/ptrace_32.c                         |    1 +
 arch/sh/kernel/ptrace_64.c                         |    1 +
 arch/sh/kernel/signal_32.c                         |    1 +
 arch/sh/kernel/smp.c                               |    3 +-
 arch/sh/kernel/stacktrace.c                        |    1 +
 arch/sh/kernel/sys_sh32.c                          |    1 +
 arch/sh/kernel/traps.c                             |    4 +
 arch/sh/kernel/traps_32.c                          |    2 +
 arch/sh/kernel/traps_64.c                          |    1 +
 arch/sh/math-emu/math.c                            |    2 +-
 arch/sh/mm/asids-debugfs.c                         |    3 +
 arch/sh/mm/extable_32.c                            |    2 +
 arch/sh/mm/fault.c                                 |    1 +
 arch/sh/mm/mmap.c                                  |    1 +
 arch/sparc/include/asm/mmu_context_64.h            |    2 +
 arch/sparc/include/asm/pgtable_64.h                |    3 +
 arch/sparc/kernel/asm-offsets.c                    |    1 +
 arch/sparc/kernel/ds.c                             |    1 +
 arch/sparc/kernel/led.c                            |    1 +
 arch/sparc/kernel/leon_smp.c                       |    2 +-
 arch/sparc/kernel/process_32.c                     |    3 +
 arch/sparc/kernel/process_64.c                     |    3 +
 arch/sparc/kernel/ptrace_64.c                      |    1 +
 arch/sparc/kernel/smp_64.c                         |    3 +-
 arch/sparc/kernel/stacktrace.c                     |    1 +
 arch/sparc/kernel/sun4d_smp.c                      |    2 +-
 arch/sparc/kernel/sun4m_irq.c                      |    1 +
 arch/sparc/kernel/sun4m_smp.c                      |    2 +-
 arch/sparc/kernel/sys_sparc_32.c                   |    4 +-
 arch/sparc/kernel/sys_sparc_64.c                   |    4 +-
 arch/sparc/kernel/sysfs.c                          |    2 +-
 arch/sparc/kernel/traps_32.c                       |    4 +-
 arch/sparc/kernel/traps_64.c                       |    3 +-
 arch/sparc/kernel/unaligned_32.c                   |    2 +-
 arch/sparc/kernel/viohs.c                          |    1 +
 arch/sparc/mm/fault_64.c                           |    1 +
 arch/sparc/mm/hugetlbpage.c                        |    1 +
 arch/sparc/mm/tsb.c                                |    2 +
 arch/tile/include/asm/mmu_context.h                |    2 +
 arch/tile/include/asm/stack.h                      |    2 +
 arch/tile/kernel/compat_signal.c                   |    1 +
 arch/tile/kernel/kgdb.c                            |    2 +
 arch/tile/kernel/process.c                         |    3 +
 arch/tile/kernel/ptrace.c                          |    2 +
 arch/tile/kernel/signal.c                          |    2 +
 arch/tile/kernel/smpboot.c                         |    3 +-
 arch/tile/kernel/stack.c                           |    2 +
 arch/tile/kernel/time.c                            |    1 +
 arch/tile/kernel/traps.c                           |    1 +
 arch/tile/kernel/unaligned.c                       |    2 +
 arch/tile/mm/fault.c                               |    3 +
 arch/tile/mm/hugetlbpage.c                         |    1 +
 arch/tile/mm/mmap.c                                |    3 +-
 arch/um/drivers/line.c                             |    3 +-
 arch/um/drivers/mconsole_kern.c                    |    1 +
 arch/um/drivers/random.c                           |    2 +-
 arch/um/include/asm/mmu_context.h                  |    2 +
 arch/um/kernel/exec.c                              |    4 +-
 arch/um/kernel/process.c                           |    3 +
 arch/um/kernel/reboot.c                            |    4 +-
 arch/um/kernel/skas/mmu.c                          |    3 +-
 arch/um/kernel/skas/process.c                      |    5 +-
 arch/um/kernel/sysrq.c                             |    3 +
 arch/um/kernel/tlb.c                               |    3 +-
 arch/um/kernel/trap.c                              |    3 +-
 arch/um/kernel/um_arch.c                           |    2 +
 arch/unicore32/kernel/fpu-ucf64.c                  |    2 +-
 arch/unicore32/kernel/process.c                    |    3 +
 arch/unicore32/kernel/ptrace.c                     |    1 +
 arch/unicore32/kernel/stacktrace.c                 |    1 +
 arch/unicore32/kernel/traps.c                      |    3 +
 arch/unicore32/mm/alignment.c                      |    1 +
 arch/unicore32/mm/fault.c                          |    2 +-
 arch/x86/entry/common.c                            |    1 +
 arch/x86/entry/vdso/vma.c                          |    1 +
 arch/x86/entry/vsyscall/vsyscall_64.c              |    2 +
 arch/x86/events/amd/ibs.c                          |    1 +
 arch/x86/events/core.c                             |    3 +-
 arch/x86/ia32/ia32_aout.c                          |    1 +
 arch/x86/ia32/ia32_signal.c                        |    1 +
 arch/x86/include/asm/a.out-core.h                  |    2 +
 arch/x86/include/asm/apic.h                        |    1 -
 arch/x86/include/asm/intel_rdt.h                   |    1 +
 arch/x86/include/asm/mpx.h                         |    2 +
 arch/x86/include/asm/mwait.h                       |    1 +
 arch/x86/kernel/amd_gart_64.c                      |    1 +
 arch/x86/kernel/apm_32.c                           |    3 +-
 arch/x86/kernel/cpu/amd.c                          |    1 +
 arch/x86/kernel/cpu/centaur.c                      |    1 +
 arch/x86/kernel/cpu/common.c                       |    4 +-
 arch/x86/kernel/cpu/cyrix.c                        |    1 +
 arch/x86/kernel/cpu/intel.c                        |    1 +
 arch/x86/kernel/cpu/intel_cacheinfo.c              |    1 +
 arch/x86/kernel/cpu/intel_rdt_rdtgroup.c           |    3 +-
 arch/x86/kernel/cpu/transmeta.c                    |    1 +
 arch/x86/kernel/doublefault.c                      |    1 +
 arch/x86/kernel/dumpstack.c                        |    2 +
 arch/x86/kernel/dumpstack_32.c                     |    1 +
 arch/x86/kernel/dumpstack_64.c                     |    1 +
 arch/x86/kernel/fpu/init.c                         |    1 +
 arch/x86/kernel/fpu/regset.c                       |    1 +
 arch/x86/kernel/ioport.c                           |    1 +
 arch/x86/kernel/irq_64.c                           |    1 +
 arch/x86/kernel/kprobes/core.c                     |    1 +
 arch/x86/kernel/kvmclock.c                         |    1 +
 arch/x86/kernel/nmi.c                              |    2 +
 arch/x86/kernel/perf_regs.c                        |    1 +
 arch/x86/kernel/process.c                          |    4 +
 arch/x86/kernel/process_32.c                       |    2 +
 arch/x86/kernel/process_64.c                       |    2 +
 arch/x86/kernel/ptrace.c                           |    1 +
 arch/x86/kernel/pvclock.c                          |    2 +
 arch/x86/kernel/signal.c                           |    1 +
 arch/x86/kernel/smpboot.c                          |    3 +
 arch/x86/kernel/stacktrace.c                       |    2 +
 arch/x86/kernel/step.c                             |    1 +
 arch/x86/kernel/sys_x86_64.c                       |    1 +
 arch/x86/kernel/traps.c                            |    1 +
 arch/x86/kernel/tsc.c                              |    1 +
 arch/x86/kernel/unwind_frame.c                     |    2 +
 arch/x86/kernel/vm86_32.c                          |    1 +
 arch/x86/kvm/cpuid.c                               |    2 +
 arch/x86/kvm/hyperv.c                              |    2 +
 arch/x86/kvm/irq_comm.c                            |    2 +
 arch/x86/kvm/mmu.c                                 |    1 +
 arch/x86/kvm/page_track.c                          |    2 +
 arch/x86/kvm/x86.c                                 |    2 +
 arch/x86/mm/extable.c                              |    2 +
 arch/x86/mm/fault.c                                |    1 +
 arch/x86/mm/hugetlbpage.c                          |    1 +
 arch/x86/mm/kasan_init_64.c                        |    1 +
 arch/x86/mm/mmap.c                                 |    3 +-
 arch/x86/mm/mpx.c                                  |    1 +
 arch/x86/platform/uv/uv_nmi.c                      |    1 +
 arch/x86/um/syscalls_64.c                          |    1 +
 arch/x86/um/sysrq_32.c                             |    1 +
 arch/x86/um/sysrq_64.c                             |    1 +
 arch/x86/xen/mmu.c                                 |    2 +-
 arch/x86/xen/smp.c                                 |    1 +
 arch/xtensa/include/asm/mmu_context.h              |    1 +
 arch/xtensa/kernel/process.c                       |    3 +
 arch/xtensa/kernel/ptrace.c                        |    1 +
 arch/xtensa/kernel/signal.c                        |    1 +
 arch/xtensa/kernel/smp.c                           |    3 +
 arch/xtensa/kernel/syscall.c                       |    1 +
 arch/xtensa/kernel/traps.c                         |    4 +-
 block/blk-cgroup.c                                 |    1 +
 block/blk-ioc.c                                    |    1 +
 block/blk-map.c                                    |    1 +
 block/blk-mq.c                                     |    2 +
 block/blk-softirq.c                                |    1 +
 block/cfq-iosched.c                                |    1 +
 block/ioprio.c                                     |    3 +
 crypto/algboss.c                                   |    2 +-
 crypto/algif_aead.c                                |    1 +
 crypto/algif_skcipher.c                            |    1 +
 crypto/api.c                                       |    2 +-
 crypto/crypto_engine.c                             |    1 +
 crypto/mcryptd.c                                   |    1 +
 drivers/acpi/acpi_pad.c                            |    1 +
 drivers/acpi/apei/ghes.c                           |    1 +
 drivers/android/binder.c                           |    3 +-
 drivers/atm/horizon.c                              |    1 +
 drivers/base/core.c                                |    1 +
 drivers/base/power/main.c                          |    1 +
 drivers/base/power/runtime.c                       |    2 +-
 drivers/base/power/wakeup.c                        |    2 +-
 drivers/block/drbd/drbd_int.h                      |    2 +-
 drivers/block/drbd/drbd_main.c                     |    1 +
 drivers/block/drbd/drbd_receiver.c                 |    2 +
 drivers/block/drbd/drbd_worker.c                   |    2 +-
 drivers/block/swim3.c                              |    2 +-
 drivers/char/applicom.c                            |    2 +-
 drivers/char/hpet.c                                |    1 +
 drivers/char/hw_random/core.c                      |    1 +
 drivers/char/ipmi/ipmi_watchdog.c                  |    1 +
 drivers/char/lp.c                                  |    2 +-
 drivers/char/ppdev.c                               |    2 +-
 drivers/char/rtc.c                                 |    2 +-
 drivers/char/snsc.c                                |    2 +-
 drivers/char/snsc_event.c                          |    2 +-
 drivers/clocksource/arm_arch_timer.c               |    1 +
 drivers/clocksource/pxa_timer.c                    |    1 +
 drivers/clocksource/timer-digicolor.c              |    1 +
 drivers/cpufreq/cpufreq_governor.c                 |    1 -
 drivers/cpufreq/cpufreq_governor.h                 |    1 +
 drivers/cpufreq/cpufreq_ondemand.c                 |    1 +
 drivers/cpufreq/intel_pstate.c                     |    2 +-
 drivers/cpufreq/sparc-us2e-cpufreq.c               |    4 +-
 drivers/cpufreq/sparc-us3-cpufreq.c                |    4 +-
 drivers/cpuidle/cpuidle.c                          |    1 +
 drivers/cpuidle/driver.c                           |    1 +
 drivers/cpuidle/governors/menu.c                   |    2 +
 drivers/dax/dax.c                                  |    1 +
 drivers/dma-buf/dma-fence.c                        |    1 +
 drivers/dma/dmatest.c                              |    1 +
 drivers/firmware/psci_checker.c                    |    1 +
 drivers/firmware/tegra/bpmp.c                      |    1 +
 drivers/gpu/drm/amd/amdkfd/kfd_events.c            |    2 +-
 drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_cik.c   |    2 +
 drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_vi.c    |    2 +
 drivers/gpu/drm/amd/amdkfd/kfd_process.c           |    1 +
 drivers/gpu/drm/amd/scheduler/gpu_scheduler.c      |    1 +
 drivers/gpu/drm/drm_lock.c                         |    2 +
 drivers/gpu/drm/etnaviv/etnaviv_gem.c              |    2 +
 drivers/gpu/drm/i915/i915_gem_request.c            |    3 +
 drivers/gpu/drm/i915/i915_gem_userptr.c            |    1 +
 drivers/gpu/drm/i915/intel_breadcrumbs.c           |    1 +
 drivers/gpu/drm/i915/intel_drv.h                   |    1 +
 drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c    |    2 +-
 drivers/gpu/drm/ttm/ttm_lock.c                     |    2 +-
 drivers/gpu/drm/vc4/vc4_gem.c                      |    1 +
 drivers/gpu/vga/vgaarb.c                           |    2 +-
 drivers/hid/hid-debug.c                            |    2 +-
 drivers/hid/hid-roccat.c                           |    2 +-
 drivers/hid/hidraw.c                               |    2 +-
 drivers/hid/usbhid/hiddev.c                        |    1 +
 drivers/hsi/clients/cmt_speech.c                   |    2 +-
 drivers/hv/vmbus_drv.c                             |    2 +
 drivers/i2c/busses/i2c-ibm_iic.c                   |    2 +
 drivers/i2c/busses/i2c-mpc.c                       |    2 +-
 drivers/ide/ide-cd.c                               |    1 +
 drivers/ide/ide-taskfile.c                         |    1 +
 drivers/iio/industrialio-buffer.c                  |    2 +-
 drivers/infiniband/core/umem.c                     |    3 +-
 drivers/infiniband/core/umem_odp.c                 |    2 +
 drivers/infiniband/hw/cxgb3/iwch_provider.c        |    2 +-
 drivers/infiniband/hw/cxgb4/iw_cxgb4.h             |    2 +-
 drivers/infiniband/hw/hfi1/affinity.c              |    2 +-
 drivers/infiniband/hw/hfi1/file_ops.c              |    1 +
 drivers/infiniband/hw/hfi1/sdma.c                  |    2 +-
 drivers/infiniband/hw/hfi1/user_pages.c            |    2 +-
 drivers/infiniband/hw/mlx4/main.c                  |    3 +
 drivers/infiniband/hw/mlx5/main.c                  |    2 +
 drivers/infiniband/hw/qib/qib_user_pages.c         |    1 +
 drivers/infiniband/hw/usnic/usnic_uiom.c           |    3 +-
 drivers/infiniband/ulp/ipoib/ipoib_cm.c            |    1 +
 drivers/infiniband/ulp/ipoib/ipoib_vlan.c          |    1 +
 drivers/iommu/amd_iommu_v2.c                       |    1 +
 drivers/iommu/intel-svm.c                          |    1 +
 drivers/isdn/capi/kcapi.c                          |    2 +-
 drivers/isdn/i4l/isdn_tty.c                        |    1 +
 drivers/isdn/mISDN/l1oip_core.c                    |    2 +
 drivers/isdn/mISDN/stack.c                         |    3 +
 drivers/isdn/mISDN/timerdev.c                      |    2 +
 drivers/leds/trigger/ledtrig-heartbeat.c           |    1 +
 drivers/lguest/core.c                              |    1 +
 drivers/lguest/lguest_user.c                       |    1 +
 drivers/macintosh/adb.c                            |    2 +-
 drivers/macintosh/smu.c                            |    1 +
 drivers/macintosh/via-pmu.c                        |    2 +-
 drivers/mailbox/mailbox-test.c                     |    1 +
 drivers/md/bcache/bset.c                           |    1 +
 drivers/md/bcache/btree.c                          |    3 +
 drivers/md/bcache/closure.h                        |    1 +
 drivers/md/bcache/sysfs.c                          |    1 +
 drivers/md/bcache/util.c                           |    1 +
 drivers/md/bcache/util.h                           |    1 +
 drivers/md/bcache/writeback.c                      |    1 +
 drivers/md/dm-bufio.c                              |    1 +
 drivers/md/dm-ioctl.c                              |    1 +
 drivers/md/dm.c                                    |    1 +
 drivers/md/md.c                                    |    1 +
 drivers/md/persistent-data/dm-block-manager.c      |    1 +
 drivers/md/raid1.c                                 |    3 +
 drivers/md/raid5.c                                 |    2 +
 drivers/media/dvb-core/dvb_ca_en50221.c            |    2 +-
 drivers/media/dvb-core/dvb_demux.c                 |    2 +-
 drivers/media/dvb-core/dvb_frontend.c              |    2 +-
 drivers/media/pci/cx18/cx18-driver.h               |    2 +-
 drivers/media/pci/ivtv/ivtv-driver.c               |    1 +
 drivers/media/pci/ivtv/ivtv-driver.h               |   35 +-
 drivers/media/pci/pt1/pt1.c                        |    1 +
 drivers/media/pci/pt3/pt3.c                        |    1 +
 drivers/media/pci/solo6x10/solo6x10-i2c.c          |    1 +
 drivers/media/pci/zoran/zoran_device.c             |    1 +
 drivers/media/platform/vivid/vivid-radio-rx.c      |    2 +
 drivers/media/platform/vivid/vivid-radio-tx.c      |    1 +
 drivers/media/rc/lirc_dev.c                        |    2 +-
 drivers/media/usb/cpia2/cpia2_core.c               |    1 +
 drivers/media/usb/gspca/cpia1.c                    |    2 +
 drivers/media/v4l2-core/videobuf-dma-sg.c          |    2 +-
 drivers/misc/cxl/fault.c                           |    3 +-
 drivers/misc/cxl/file.c                            |    2 +-
 drivers/misc/cxl/main.c                            |    2 +
 drivers/misc/cxl/native.c                          |    1 +
 drivers/misc/eeprom/eeprom.c                       |    1 +
 drivers/misc/genwqe/card_dev.c                     |    2 +-
 drivers/misc/ibmasm/r_heartbeat.c                  |    2 +-
 drivers/misc/kgdbts.c                              |    2 +
 drivers/misc/lis3lv02d/lis3lv02d.c                 |    1 +
 drivers/misc/lkdtm_heap.c                          |    1 +
 drivers/misc/lkdtm_usercopy.c                      |    1 +
 drivers/misc/mei/bus.c                             |    2 +-
 drivers/misc/mei/client.c                          |    2 +-
 drivers/misc/mei/main.c                            |    2 +-
 drivers/misc/mic/cosm/cosm_scif_server.c           |    2 +
 drivers/misc/mic/cosm_client/cosm_scif_client.c    |    2 +
 drivers/misc/mic/scif/scif_main.h                  |    2 +-
 drivers/misc/mic/scif/scif_rma.c                   |    3 +
 drivers/misc/vexpress-syscfg.c                     |    2 +-
 drivers/misc/vmw_vmci/vmci_context.c               |    1 +
 drivers/misc/vmw_vmci/vmci_event.c                 |    1 +
 drivers/misc/vmw_vmci/vmci_host.c                  |    1 +
 drivers/misc/vmw_vmci/vmci_resource.c              |    1 +
 drivers/mmc/core/sdio_irq.c                        |    1 +
 drivers/mtd/nand/gpmi-nand/gpmi-nand.c             |    1 +
 drivers/mtd/nand/nand_base.c                       |    1 +
 drivers/mtd/tests/mtd_test.h                       |    2 +-
 drivers/net/bonding/bond_options.c                 |    2 +
 drivers/net/bonding/bond_sysfs.c                   |    2 +-
 drivers/net/can/softing/softing_fw.c               |    2 +-
 drivers/net/ethernet/broadcom/tg3.c                |    1 +
 drivers/net/ethernet/cavium/liquidio/octeon_main.h |    2 +
 drivers/net/ethernet/sfc/falcon/falcon.c           |    2 +
 drivers/net/irda/pxaficp_ir.c                      |    1 +
 drivers/net/irda/stir4200.c                        |    1 +
 drivers/net/macvtap.c                              |    2 +-
 drivers/net/ppp/ppp_generic.c                      |    1 +
 drivers/net/slip/slip.c                            |    2 +-
 drivers/net/tap.c                                  |    2 +-
 drivers/net/tun.c                                  |    1 +
 drivers/net/usb/hso.c                              |    2 +-
 drivers/net/usb/qmi_wwan.c                         |    1 +
 drivers/net/wan/cosa.c                             |    2 +-
 drivers/net/wireless/ath/ath6kl/cfg80211.c         |    1 +
 drivers/net/wireless/broadcom/b43legacy/main.c     |    2 +-
 .../wireless/broadcom/brcm80211/brcmfmac/sdio.c    |    2 +-
 drivers/net/wireless/intersil/hostap/hostap_hw.c   |    2 +-
 .../net/wireless/intersil/hostap/hostap_ioctl.c    |    2 +-
 drivers/net/xen-netback/interface.c                |    1 +
 drivers/nvme/target/admin-cmd.c                    |    2 +
 drivers/nvme/target/core.c                         |    2 +
 drivers/oprofile/buffer_sync.c                     |    2 +
 drivers/oprofile/cpu_buffer.c                      |    2 +
 drivers/oprofile/event_buffer.c                    |    2 +-
 drivers/parisc/power.c                             |    2 +-
 drivers/parport/daisy.c                            |    2 +-
 drivers/parport/ieee1284.c                         |    2 +-
 drivers/parport/ieee1284_ops.c                     |    2 +-
 drivers/parport/parport_ip32.c                     |    2 +-
 drivers/parport/parport_pc.c                       |    2 +-
 drivers/parport/share.c                            |    2 +-
 drivers/pci/access.c                               |    2 +-
 drivers/pci/hotplug/cpci_hotplug_core.c            |    1 +
 drivers/pci/hotplug/cpqphp.h                       |    2 +-
 drivers/pci/hotplug/pciehp.h                       |    2 +-
 drivers/pci/hotplug/shpchp.h                       |    2 +-
 drivers/perf/arm_pmu.c                             |    1 +
 drivers/platform/x86/intel_ips.c                   |    1 +
 drivers/ps3/ps3-sys-manager.c                      |    1 +
 drivers/rtc/rtc-dev.c                              |    2 +-
 drivers/s390/char/fs3270.c                         |    1 +
 drivers/s390/char/keyboard.c                       |    2 +-
 drivers/s390/cio/cio.c                             |    2 +-
 drivers/s390/cio/device.c                          |    1 +
 drivers/s390/cio/qdio_thinint.c                    |    2 +
 drivers/scsi/bnx2fc/bnx2fc.h                       |    2 +-
 drivers/scsi/bnx2i/bnx2i.h                         |    2 +-
 drivers/scsi/libfc/fc_disc.c                       |    2 +
 drivers/scsi/libfc/fc_rport.c                      |    2 +
 drivers/scsi/libiscsi.c                            |    1 +
 drivers/scsi/lpfc/lpfc_vport.c                     |    1 +
 drivers/scsi/osst.c                                |    2 +-
 drivers/scsi/st.c                                  |    2 +-
 drivers/soc/fsl/qbman/dpaa_sys.h                   |    1 +
 drivers/spi/spi.c                                  |    1 +
 drivers/staging/android/ion/ion.c                  |    1 +
 drivers/staging/android/ion/ion_heap.c             |    1 +
 drivers/staging/android/lowmemorykiller.c          |    2 +-
 drivers/staging/comedi/comedi_fops.c               |    2 +-
 drivers/staging/dgnc/dgnc_tty.c                    |    2 +-
 drivers/staging/dgnc/dgnc_utils.c                  |    2 +-
 drivers/staging/greybus/uart.c                     |    2 +-
 .../staging/lustre/lnet/libcfs/linux/linux-prim.c  |    2 +-
 .../lustre/lustre/include/lustre/lustre_user.h     |    1 +
 .../staging/lustre/lustre/include/lustre_compat.h  |    1 +
 drivers/staging/lustre/lustre/include/lustre_lib.h |    2 +-
 .../staging/lustre/lustre/include/obd_support.h    |    2 +
 drivers/staging/lustre/lustre/ptlrpc/sec.c         |    2 +
 drivers/staging/media/lirc/lirc_sir.c              |    2 +-
 drivers/staging/media/lirc/lirc_zilog.c            |    2 +-
 drivers/staging/rtl8188eu/include/osdep_service.h  |    2 +-
 drivers/staging/rtl8712/osdep_service.h            |    2 +-
 drivers/staging/rtl8712/rtl8712_cmd.c              |    1 +
 drivers/staging/speakup/speakup_soft.c             |    2 +-
 .../vc04_services/interface/vchiq_arm/vchiq_arm.c  |    1 +
 .../vc04_services/interface/vchiq_arm/vchiq_util.h |    2 +-
 drivers/target/iscsi/cxgbit/cxgbit_target.c        |    2 +
 drivers/target/iscsi/iscsi_target.c                |    1 +
 drivers/target/iscsi/iscsi_target_erl0.c           |    2 +
 drivers/target/iscsi/iscsi_target_login.c          |    1 +
 drivers/target/iscsi/iscsi_target_nego.c           |    1 +
 drivers/thermal/intel_powerclamp.c                 |    1 +
 drivers/tty/n_gsm.c                                |    2 +-
 drivers/tty/pty.c                                  |    2 +-
 drivers/tty/serial/crisv10.c                       |    2 +-
 drivers/tty/serial/sc16is7xx.c                     |    1 +
 drivers/tty/serial/serial_core.c                   |    1 +
 drivers/tty/sysrq.c                                |    4 +-
 drivers/tty/tty_io.c                               |    3 +-
 drivers/tty/tty_ioctl.c                            |    2 +-
 drivers/tty/tty_ldsem.c                            |    2 +
 drivers/tty/tty_port.c                             |    2 +-
 drivers/tty/vt/keyboard.c                          |    4 +-
 drivers/tty/vt/vt.c                                |    2 +-
 drivers/tty/vt/vt_ioctl.c                          |    2 +-
 drivers/uio/uio.c                                  |    2 +-
 drivers/usb/atm/usbatm.c                           |    2 +-
 drivers/usb/class/cdc-acm.c                        |    1 +
 drivers/usb/class/usblp.c                          |    2 +-
 drivers/usb/core/devio.c                           |    1 +
 drivers/usb/core/hub.c                             |    2 +-
 drivers/usb/gadget/function/f_fs.c                 |    1 +
 drivers/usb/gadget/function/f_mass_storage.c       |    1 +
 drivers/usb/image/mdc800.c                         |    2 +-
 drivers/usb/misc/adutux.c                          |    1 +
 drivers/usb/misc/idmouse.c                         |    1 +
 drivers/usb/misc/rio500.c                          |    2 +-
 drivers/usb/misc/uss720.c                          |    1 +
 drivers/usb/mon/mon_bin.c                          |    1 +
 drivers/usb/mon/mon_text.c                         |    1 +
 drivers/usb/serial/digi_acceleport.c               |    1 +
 drivers/usb/serial/generic.c                       |    1 +
 drivers/usb/usbip/usbip_common.h                   |    1 +
 drivers/vfio/vfio_iommu_spapr_tce.c                |    3 +
 drivers/vfio/vfio_iommu_type1.c                    |    3 +-
 drivers/vhost/net.c                                |    2 +
 drivers/vhost/vhost.c                              |    2 +
 drivers/video/fbdev/auo_k190x.c                    |    1 +
 drivers/video/fbdev/cobalt_lcdfb.c                 |    1 +
 drivers/video/fbdev/nvidia/nv_accel.c              |    2 +
 .../fbdev/omap2/omapfb/displays/panel-dsi-cm.c     |    2 +-
 drivers/virtio/virtio_balloon.c                    |    1 +
 drivers/w1/w1_family.c                             |    2 +-
 drivers/w1/w1_int.c                                |    1 +
 drivers/xen/balloon.c                              |    1 +
 drivers/xen/gntdev.c                               |    1 +
 fs/9p/v9fs.c                                       |    1 +
 fs/affs/inode.c                                    |    1 +
 fs/affs/super.c                                    |    1 +
 fs/afs/rxrpc.c                                     |    2 +
 fs/aio.c                                           |    2 +-
 fs/attr.c                                          |    1 +
 fs/autofs4/autofs_i.h                              |    1 +
 fs/autofs4/dev-ioctl.c                             |    1 +
 fs/autofs4/waitq.c                                 |    1 +
 fs/befs/linuxvfs.c                                 |    1 +
 fs/binfmt_aout.c                                   |    1 +
 fs/binfmt_elf.c                                    |    4 +
 fs/binfmt_elf_fdpic.c                              |    3 +
 fs/binfmt_flat.c                                   |    1 +
 fs/binfmt_misc.c                                   |    2 +-
 fs/btrfs/ctree.h                                   |    1 +
 fs/btrfs/extent-tree.c                             |    1 +
 fs/btrfs/free-space-cache.c                        |    1 +
 fs/buffer.c                                        |    1 +
 fs/cachefiles/internal.h                           |    1 +
 fs/ceph/addr.c                                     |    1 +
 fs/ceph/caps.c                                     |    2 +-
 fs/cifs/connect.c                                  |    1 +
 fs/cifs/inode.c                                    |    2 +
 fs/coda/psdev.c                                    |    2 +-
 fs/coda/upcall.c                                   |    2 +-
 fs/compat.c                                        |    1 +
 fs/coredump.c                                      |    4 +-
 fs/dax.c                                           |    1 +
 fs/dlm/user.c                                      |    1 +
 fs/ecryptfs/read_write.c                           |    2 +
 fs/eventfd.c                                       |    2 +-
 fs/eventpoll.c                                     |    2 +-
 fs/exec.c                                          |   11 +-
 fs/exportfs/expfs.c                                |    1 +
 fs/ext2/balloc.c                                   |    1 +
 fs/ext4/ext4.h                                     |    1 +
 fs/ext4/ialloc.c                                   |    2 +
 fs/f2fs/data.c                                     |    1 +
 fs/fcntl.c                                         |    1 +
 fs/file.c                                          |    2 +-
 fs/file_table.c                                    |    1 +
 fs/fs_struct.c                                     |    3 +-
 fs/fuse/dev.c                                      |    1 +
 fs/gfs2/inode.c                                    |    1 +
 fs/gfs2/lock_dlm.c                                 |    1 +
 fs/gfs2/super.c                                    |    2 +-
 fs/gfs2/sys.c                                      |    1 +
 fs/hfs/inode.c                                     |    1 +
 fs/hfsplus/inode.c                                 |    1 +
 fs/hpfs/hpfs_fn.h                                  |    2 +-
 fs/hugetlbfs/inode.c                               |    2 +-
 fs/ioctl.c                                         |    2 +
 fs/iomap.c                                         |    2 +
 fs/isofs/inode.c                                   |    1 +
 fs/jffs2/background.c                              |    2 +-
 fs/jffs2/fs.c                                      |    1 +
 fs/jffs2/nodemgmt.c                                |    2 +-
 fs/kernfs/file.c                                   |    2 +-
 fs/libfs.c                                         |    1 +
 fs/lockd/svc.c                                     |    2 +-
 fs/namespace.c                                     |    3 +
 fs/ncpfs/inode.c                                   |    1 +
 fs/ncpfs/ioctl.c                                   |    1 +
 fs/ncpfs/sock.c                                    |    1 +
 fs/nfs/callback.c                                  |    1 +
 fs/nfs/inode.c                                     |    2 +-
 fs/nfsd/nfssvc.c                                   |    2 +-
 fs/nilfs2/segment.c                                |    2 +
 fs/notify/fanotify/fanotify.c                      |    1 +
 fs/notify/fanotify/fanotify_user.c                 |    1 +
 fs/notify/inotify/inotify_fsnotify.c               |    1 +
 fs/notify/inotify/inotify_user.c                   |    2 +-
 fs/ntfs/file.c                                     |    2 +-
 fs/ocfs2/alloc.c                                   |    1 +
 fs/ocfs2/cluster/tcp.c                             |    1 +
 fs/ocfs2/dlm/dlmdomain.c                           |    1 +
 fs/ocfs2/dlmfs/userdlm.c                           |    1 +
 fs/ocfs2/dlmglue.c                                 |    1 +
 fs/ocfs2/super.c                                   |    1 +
 fs/omfs/inode.c                                    |    1 +
 fs/orangefs/orangefs-kernel.h                      |    2 +-
 fs/overlayfs/copy_up.c                             |    3 +-
 fs/overlayfs/inode.c                               |    1 +
 fs/overlayfs/namei.c                               |    1 +
 fs/overlayfs/super.c                               |    1 +
 fs/overlayfs/util.c                                |    1 +
 fs/posix_acl.c                                     |    1 +
 fs/proc/array.c                                    |    4 +
 fs/proc/base.c                                     |    5 +
 fs/proc/fd.c                                       |    2 +-
 fs/proc/internal.h                                 |    2 +
 fs/proc/kcore.c                                    |    1 +
 fs/proc/loadavg.c                                  |    2 +
 fs/proc/proc_net.c                                 |    1 +
 fs/proc/proc_sysctl.c                              |    1 +
 fs/proc/root.c                                     |    2 +
 fs/proc/stat.c                                     |    3 +-
 fs/proc/task_mmu.c                                 |    1 +
 fs/proc/task_nommu.c                               |    2 +
 fs/proc_namespace.c                                |    2 +
 fs/quota/dquot.c                                   |    1 +
 fs/read_write.c                                    |    3 +-
 fs/select.c                                        |    4 +-
 fs/splice.c                                        |    2 +
 fs/stat.c                                          |    1 +
 fs/userfaultfd.c                                   |    3 +-
 fs/xfs/kmem.c                                      |    1 +
 fs/xfs/xfs_buf.c                                   |    1 +
 fs/xfs/xfs_ioctl.c                                 |    1 +
 fs/xfs/xfs_linux.h                                 |    2 +-
 include/drm/drm_mm.h                               |    1 +
 include/drm/drm_os_linux.h                         |    1 +
 include/linux/binfmts.h                            |   10 +
 include/linux/blkdev.h                             |    1 +
 include/linux/cgroup-defs.h                        |   13 +-
 include/linux/cpu.h                                |    2 +
 include/linux/cpuset.h                             |    2 +
 include/linux/cputime.h                            |   13 -
 include/linux/cred.h                               |    3 +-
 include/linux/dcache.h                             |    1 +
 include/linux/delayacct.h                          |   38 +-
 include/linux/dmar.h                               |    2 +-
 include/linux/elfcore.h                            |    2 +
 include/linux/fault-inject.h                       |    2 +
 include/linux/hrtimer.h                            |    1 -
 include/linux/i2c.h                                |    1 +
 include/linux/init_task.h                          |    4 +-
 include/linux/kasan.h                              |   11 +-
 include/linux/khugepaged.h                         |    3 +-
 include/linux/ksm.h                                |    1 +
 include/linux/mm_types.h                           |   45 +-
 include/linux/mm_types_task.h                      |   87 +
 include/linux/nmi.h                                |   37 +
 include/linux/oom.h                                |    2 +-
 include/linux/perf_regs.h                          |    2 +
 include/linux/pid.h                                |    2 +-
 include/linux/preempt.h                            |   21 +
 include/linux/ptrace.h                             |    1 +
 include/linux/rcupdate.h                           |   40 -
 include/linux/rcupdate_wait.h                      |   50 +
 include/linux/rcutiny.h                            |   11 +-
 include/linux/rhashtable.h                         |    2 +-
 include/linux/sched.h                              | 4155 +++++---------------
 include/linux/sched/autogroup.h                    |   31 +
 include/linux/sched/clock.h                        |  104 +
 include/linux/sched/coredump.h                     |   74 +
 include/linux/sched/cpufreq.h                      |   27 +
 include/linux/sched/cputime.h                      |  187 +
 include/linux/sched/deadline.h                     |    8 +-
 include/linux/sched/debug.h                        |   50 +
 include/linux/sched/hotplug.h                      |   24 +
 include/linux/sched/idle.h                         |   86 +
 include/linux/sched/init.h                         |   11 +
 include/linux/sched/jobctl.h                       |   36 +
 include/linux/sched/loadavg.h                      |   31 +
 include/linux/sched/mm.h                           |  174 +
 include/linux/sched/nohz.h                         |   43 +
 include/linux/sched/numa_balancing.h               |   46 +
 include/linux/sched/prio.h                         |    6 +-
 include/linux/sched/rt.h                           |   10 +-
 include/linux/sched/signal.h                       |  613 +++
 include/linux/sched/stat.h                         |   40 +
 include/linux/sched/sysctl.h                       |   10 +-
 include/linux/sched/task.h                         |  139 +
 include/linux/sched/task_stack.h                   |  121 +
 include/linux/sched/topology.h                     |  226 ++
 include/linux/sched/user.h                         |   61 +
 include/linux/sched/wake_q.h                       |   53 +
 include/linux/sched/xacct.h                        |   48 +
 include/linux/signal.h                             |   57 +-
 include/linux/signal_types.h                       |   66 +
 include/linux/signalfd.h                           |    2 +-
 include/linux/skbuff.h                             |    1 +
 include/linux/sunrpc/types.h                       |    1 +
 include/linux/taskstats_kern.h                     |    2 +-
 include/linux/timekeeping.h                        |    4 +
 include/linux/timer.h                              |    2 +-
 include/linux/user_namespace.h                     |    3 +
 include/linux/vmacache.h                           |    2 +-
 include/linux/wait.h                               |    1 +
 include/media/v4l2-ioctl.h                         |    1 +
 include/net/bluetooth/hci_core.h                   |    2 +
 include/net/busy_poll.h                            |    2 +
 include/net/scm.h                                  |    1 +
 include/rdma/ib.h                                  |    1 +
 include/sound/control.h                            |    1 +
 include/target/target_core_base.h                  |    2 +
 include/trace/events/sched.h                       |    2 +-
 include/uapi/linux/sched/types.h                   |   74 +
 init/init_task.c                                   |    1 +
 init/main.c                                        |    5 +
 ipc/mqueue.c                                       |    3 +
 ipc/msg.c                                          |    2 +-
 ipc/namespace.c                                    |    2 +
 ipc/sem.c                                          |    1 +
 kernel/acct.c                                      |    2 +
 kernel/bpf/syscall.c                               |    1 +
 kernel/cgroup/cgroup-v1.c                          |    3 +
 kernel/cgroup/cgroup.c                             |    1 +
 kernel/cgroup/cpuset.c                             |    2 +
 kernel/cgroup/namespace.c                          |    2 +-
 kernel/cgroup/pids.c                               |    2 +-
 kernel/cpu.c                                       |    4 +-
 kernel/cred.c                                      |    1 +
 kernel/debug/debug_core.c                          |    5 +-
 kernel/debug/gdbstub.c                             |    1 +
 kernel/debug/kdb/kdb_bt.c                          |    3 +-
 kernel/debug/kdb/kdb_main.c                        |    3 +
 kernel/delayacct.c                                 |    2 +
 kernel/events/callchain.c                          |    2 +
 kernel/events/core.c                               |    2 +
 kernel/events/uprobes.c                            |    2 +
 kernel/exit.c                                      |    6 +
 kernel/fork.c                                      |   31 +-
 kernel/futex.c                                     |    2 +
 kernel/hung_task.c                                 |    3 +
 kernel/irq/manage.c                                |    2 +
 kernel/kmod.c                                      |    2 +
 kernel/kthread.c                                   |    2 +
 kernel/latencytop.c                                |    2 +
 kernel/locking/lockdep.c                           |    2 +
 kernel/locking/locktorture.c                       |    2 +
 kernel/locking/mutex.c                             |    4 +-
 kernel/locking/qspinlock_stat.h                    |    1 +
 kernel/locking/rtmutex-debug.c                     |    1 +
 kernel/locking/rtmutex.c                           |    4 +-
 kernel/locking/rtmutex_common.h                    |    1 +
 kernel/locking/rwsem-spinlock.c                    |    3 +-
 kernel/locking/rwsem-xadd.c                        |    4 +-
 kernel/locking/rwsem.c                             |    1 +
 kernel/locking/semaphore.c                         |    1 +
 kernel/panic.c                                     |    1 +
 kernel/pid.c                                       |    1 +
 kernel/pid_namespace.c                             |    3 +
 kernel/power/hibernate.c                           |    1 +
 kernel/power/process.c                             |    2 +
 kernel/power/snapshot.c                            |    1 +
 kernel/printk/printk.c                             |    3 +
 kernel/profile.c                                   |    2 +
 kernel/ptrace.c                                    |    3 +
 kernel/rcu/rcuperf.c                               |    1 +
 kernel/rcu/rcutorture.c                            |    3 +-
 kernel/rcu/srcu.c                                  |    2 +-
 kernel/rcu/tiny.c                                  |   14 +-
 kernel/rcu/tree.c                                  |    4 +-
 kernel/rcu/tree.h                                  |    1 +
 kernel/rcu/tree_plugin.h                           |    2 +
 kernel/rcu/update.c                                |    4 +-
 kernel/sched/autogroup.h                           |    1 +
 kernel/sched/clock.c                               |    2 +
 kernel/sched/completion.c                          |    3 +-
 kernel/sched/core.c                                |   39 +-
 kernel/sched/cpudeadline.c                         |    4 +-
 kernel/sched/cpufreq_schedutil.c                   |    1 +
 kernel/sched/cpupri.c                              |    4 +-
 kernel/sched/cputime.c                             |    6 +-
 kernel/sched/deadline.c                            |   35 +-
 kernel/sched/debug.c                               |    3 +-
 kernel/sched/fair.c                                |   29 +-
 kernel/sched/idle.c                                |    1 +
 kernel/sched/loadavg.c                             |    1 +
 kernel/sched/rt.c                                  |   29 +-
 kernel/sched/sched.h                               |   24 +-
 kernel/sched/stats.h                               |  111 -
 kernel/sched/swait.c                               |    2 +-
 kernel/sched/wait.c                                |    3 +-
 kernel/seccomp.c                                   |    1 +
 kernel/signal.c                                    |   13 +-
 kernel/smp.c                                       |    1 +
 kernel/smpboot.c                                   |    1 +
 kernel/sys.c                                       |    7 +
 kernel/sysctl.c                                    |    1 +
 kernel/time/alarmtimer.c                           |    2 +
 kernel/time/hrtimer.c                              |    4 +-
 kernel/time/itimer.c                               |    2 +
 kernel/time/posix-cpu-timers.c                     |    3 +-
 kernel/time/posix-timers.c                         |    1 +
 kernel/time/sched_clock.c                          |    1 +
 kernel/time/tick-sched.c                           |    6 +-
 kernel/time/timekeeping.c                          |    2 +
 kernel/time/timer.c                                |    4 +-
 kernel/torture.c                                   |    1 +
 kernel/trace/ftrace.c                              |    1 +
 kernel/trace/ring_buffer.c                         |    1 +
 kernel/trace/ring_buffer_benchmark.c               |    1 +
 kernel/trace/trace_clock.c                         |    1 +
 kernel/trace/trace_events_hist.c                   |    1 +
 kernel/trace/trace_events_trigger.c                |    1 +
 kernel/trace/trace_hwlat.c                         |    1 +
 kernel/trace/trace_kprobe.c                        |    1 +
 kernel/trace/trace_output.c                        |    2 +
 kernel/trace/trace_selftest.c                      |    1 +
 kernel/trace/trace_stack.c                         |    1 +
 kernel/trace/trace_uprobe.c                        |    1 +
 kernel/tracepoint.c                                |    3 +-
 kernel/tsacct.c                                    |    4 +-
 kernel/ucount.c                                    |    1 +
 kernel/uid16.c                                     |    1 +
 kernel/user.c                                      |    1 +
 kernel/user_namespace.c                            |    1 +
 kernel/utsname.c                                   |    2 +
 kernel/utsname_sysctl.c                            |    1 +
 kernel/watchdog.c                                  |    3 +
 kernel/watchdog_hld.c                              |    2 +
 lib/bug.c                                          |    1 +
 lib/debugobjects.c                                 |    1 +
 lib/dma-debug.c                                    |    2 +
 lib/dump_stack.c                                   |    1 +
 lib/is_single_threaded.c                           |    5 +-
 lib/nmi_backtrace.c                                |    1 +
 lib/percpu_ida.c                                   |    3 +-
 lib/plist.c                                        |    1 +
 lib/rhashtable.c                                   |    1 +
 lib/sbitmap.c                                      |    1 +
 lib/smp_processor_id.c                             |    2 +-
 lib/syscall.c                                      |    1 +
 mm/compaction.c                                    |    1 +
 mm/filemap.c                                       |    1 +
 mm/gup.c                                           |    2 +-
 mm/huge_memory.c                                   |    2 +
 mm/hugetlb.c                                       |    1 +
 mm/kasan/kasan.c                                   |   11 +
 mm/khugepaged.c                                    |    2 +
 mm/kmemleak.c                                      |    4 +-
 mm/ksm.c                                           |    2 +
 mm/memcontrol.c                                    |    1 +
 mm/memory-failure.c                                |    3 +-
 mm/memory.c                                        |    4 +
 mm/memory_hotplug.c                                |    1 +
 mm/mempolicy.c                                     |    3 +
 mm/migrate.c                                       |    1 +
 mm/mlock.c                                         |    1 +
 mm/mmu_context.c                                   |    2 +
 mm/mmu_notifier.c                                  |    1 +
 mm/nommu.c                                         |    3 +-
 mm/oom_kill.c                                      |    3 +
 mm/page-writeback.c                                |    1 +
 mm/page_alloc.c                                    |    1 +
 mm/process_vm_access.c                             |    1 +
 mm/rmap.c                                          |    2 +
 mm/shmem.c                                         |    1 +
 mm/slab.c                                          |    1 +
 mm/swapfile.c                                      |    2 +
 mm/usercopy.c                                      |    3 +
 mm/userfaultfd.c                                   |    1 +
 mm/util.c                                          |    2 +
 mm/vmacache.c                                      |   13 +-
 mm/vmalloc.c                                       |    2 +-
 mm/vmscan.c                                        |    1 +
 mm/zsmalloc.c                                      |    1 +
 net/9p/client.c                                    |    2 +-
 net/atm/common.c                                   |    2 +-
 net/atm/svc.c                                      |    2 +-
 net/ax25/af_ax25.c                                 |    2 +-
 net/bluetooth/af_bluetooth.c                       |    2 +
 net/bluetooth/cmtp/capi.c                          |    2 +-
 net/bluetooth/hci_request.c                        |    2 +
 net/bluetooth/l2cap_sock.c                         |    1 +
 net/bluetooth/rfcomm/sock.c                        |    1 +
 net/bluetooth/sco.c                                |    1 +
 net/bridge/br_sysfs_br.c                           |    1 +
 net/bridge/br_sysfs_if.c                           |    1 +
 net/caif/caif_socket.c                             |    2 +-
 net/ceph/crypto.c                                  |    1 +
 net/core/ethtool.c                                 |    2 +-
 net/core/net-sysfs.c                               |    1 +
 net/core/net_namespace.c                           |    2 +
 net/core/netclassid_cgroup.c                       |    2 +
 net/core/netprio_cgroup.c                          |    2 +
 net/core/scm.c                                     |    1 +
 net/core/stream.c                                  |    1 +
 net/dccp/output.c                                  |    1 +
 net/decnet/af_decnet.c                             |    2 +-
 net/dns_resolver/dns_query.c                       |    2 +
 net/ipv4/devinet.c                                 |    1 +
 net/ipv4/tcp_cdg.c                                 |    2 +
 net/ipv6/addrconf.c                                |    1 +
 net/irda/af_irda.c                                 |    1 +
 net/irda/ircomm/ircomm_tty.c                       |    2 +-
 net/irda/irnet/irnet_ppp.c                         |    3 +-
 net/iucv/af_iucv.c                                 |    2 +-
 net/kcm/kcmsock.c                                  |    2 +
 net/llc/af_llc.c                                   |    2 +
 net/mac80211/mesh_plink.c                          |    2 +
 net/mac802154/llsec.c                              |    2 +
 net/netfilter/xt_owner.c                           |    2 +
 net/netrom/af_netrom.c                             |    2 +-
 net/nfc/llcp_sock.c                                |    1 +
 net/phonet/pep.c                                   |    1 +
 net/phonet/socket.c                                |    2 +
 net/rose/af_rose.c                                 |    2 +-
 net/rxrpc/conn_client.c                            |    2 +
 net/rxrpc/recvmsg.c                                |    2 +
 net/rxrpc/sendmsg.c                                |    2 +
 net/sched/em_meta.c                                |    1 +
 net/sctp/socket.c                                  |    1 +
 net/smc/af_smc.c                                   |    2 +
 net/smc/smc_clc.c                                  |    2 +
 net/smc/smc_close.c                                |    2 +
 net/smc/smc_rx.c                                   |    2 +
 net/smc/smc_tx.c                                   |    2 +
 net/sunrpc/auth.c                                  |    1 +
 net/sunrpc/svc.c                                   |    2 +-
 net/tipc/socket.c                                  |    2 +
 net/unix/af_unix.c                                 |    2 +-
 net/vmw_vsock/af_vsock.c                           |    1 +
 net/vmw_vsock/virtio_transport_common.c            |    1 +
 net/x25/af_x25.c                                   |    2 +-
 samples/trace_events/trace-events-sample.c         |    2 +-
 security/apparmor/policy.c                         |    2 +
 security/integrity/evm/evm_main.c                  |    2 +
 security/keys/internal.h                           |    1 +
 security/keys/keyctl.c                             |    2 +
 security/keys/persistent.c                         |    2 +
 security/keys/process_keys.c                       |    1 +
 security/selinux/hooks.c                           |    3 +-
 security/tomoyo/domain.c                           |    2 +
 security/tomoyo/group.c                            |    2 +
 security/tomoyo/util.c                             |    2 +
 sound/core/control.c                               |    1 +
 sound/core/hwdep.c                                 |    1 +
 sound/core/oss/pcm_oss.c                           |    1 +
 sound/core/pcm_lib.c                               |    1 +
 sound/core/pcm_native.c                            |    1 +
 sound/core/rawmidi.c                               |    2 +-
 sound/core/seq/oss/seq_oss_device.h                |    2 +-
 sound/core/seq/oss/seq_oss_writeq.c                |    1 +
 sound/core/seq/seq_fifo.c                          |    2 +
 sound/core/seq/seq_memory.c                        |    1 +
 sound/core/timer.c                                 |    1 +
 sound/firewire/bebob/bebob.h                       |    1 +
 sound/firewire/dice/dice.h                         |    1 +
 sound/firewire/digi00x/digi00x.h                   |    1 +
 sound/firewire/fireworks/fireworks.h               |    1 +
 sound/firewire/oxfw/oxfw.h                         |    1 +
 sound/firewire/tascam/tascam.h                     |    1 +
 sound/isa/gus/gus_pcm.c                            |    2 +
 sound/isa/msnd/msnd.c                              |    1 +
 sound/isa/sb/emu8000.c                             |    2 +-
 sound/isa/sb/emu8000_patch.c                       |    2 +
 sound/isa/sb/emu8000_pcm.c                         |    2 +
 sound/isa/wavefront/wavefront_synth.c              |    1 +
 sound/oss/dmabuf.c                                 |    2 +
 sound/oss/dmasound/dmasound_core.c                 |    1 +
 sound/oss/midibuf.c                                |    2 +
 sound/oss/msnd_pinnacle.c                          |    2 +
 sound/oss/sound_config.h                           |    1 +
 sound/oss/swarm_cs4297a.c                          |    2 +-
 virt/kvm/async_pf.c                                |    1 +
 virt/kvm/kvm_main.c                                |    4 +-
 1218 files changed, 5559 insertions(+), 3908 deletions(-)
 delete mode 100644 include/linux/cputime.h
 create mode 100644 include/linux/mm_types_task.h
 create mode 100644 include/linux/rcupdate_wait.h
 create mode 100644 include/linux/sched/autogroup.h
 create mode 100644 include/linux/sched/clock.h
 create mode 100644 include/linux/sched/coredump.h
 create mode 100644 include/linux/sched/cpufreq.h
 create mode 100644 include/linux/sched/cputime.h
 create mode 100644 include/linux/sched/debug.h
 create mode 100644 include/linux/sched/hotplug.h
 create mode 100644 include/linux/sched/idle.h
 create mode 100644 include/linux/sched/init.h
 create mode 100644 include/linux/sched/jobctl.h
 create mode 100644 include/linux/sched/loadavg.h
 create mode 100644 include/linux/sched/mm.h
 create mode 100644 include/linux/sched/nohz.h
 create mode 100644 include/linux/sched/numa_balancing.h
 create mode 100644 include/linux/sched/signal.h
 create mode 100644 include/linux/sched/stat.h
 create mode 100644 include/linux/sched/task.h
 create mode 100644 include/linux/sched/task_stack.h
 create mode 100644 include/linux/sched/topology.h
 create mode 100644 include/linux/sched/user.h
 create mode 100644 include/linux/sched/wake_q.h
 create mode 100644 include/linux/sched/xacct.h
 create mode 100644 include/linux/signal_types.h
 create mode 100644 include/uapi/linux/sched/types.h

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [GIT PULL] sched.h split-up
  2017-03-03  1:36 [GIT PULL] sched.h split-up Ingo Molnar
@ 2017-03-03 20:13 ` Linus Torvalds
  2017-03-04  7:30   ` Ingo Molnar
  2017-03-07 23:33   ` Linus Torvalds
  0 siblings, 2 replies; 14+ messages in thread
From: Linus Torvalds @ 2017-03-03 20:13 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: Linux Kernel Mailing List, Peter Zijlstra, Thomas Gleixner,
	Andrew Morton

On Thu, Mar 2, 2017 at 5:36 PM, Ingo Molnar <mingo@kernel.org> wrote:
>
> I tried to test as many build configurations as possible, but some build breakage
> is probably still left - but it should be mostly limited to architectures that
> have no cross-compiler binaries available on kernel.org, and non-default
> configurations.

So I merged this, and it's pushed out, but it showed a real annoyance
almost immediately.

That annoyance is also pushed out - it's the pull of the overlayfs
updates. And the reason that was annoying was that that pull caused
this build error due to a subtle semantic clash:

   fs/overlayfs/util.c: In function ‘ovl_copy_up_start’:
   ./include/linux/wait.h:634:7: error: implicit declaration of
function ‘signal_pending’ [-Werror=implicit-function-declaration]
      if (signal_pending(current)) {    \
          ^
   ./include/linux/wait.h:679:9: note: in expansion of macro
‘__wait_event_interruptible_locked’
      ? 0 : __wait_event_interruptible_locked(wq, condition, 0, 0))
            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   fs/overlayfs/util.c:275:8: note: in expansion of macro
‘wait_event_interruptible_locked’
     err = wait_event_interruptible_locked(ofs->copyup_wq, !oe->copying);
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

and that's just complete bullshit.

The thing is, fs/overlayfs/util.c included <linux/fs.h>, which in turn
includes <linux/wait.h>

So using "wait_event_interruptible_locked()" should damn well have worked.

The fact that you can include <linux/wait.h>, and then cannot use the
wait event functions because you're missing "signal_pending()" is
complete garbage. This needs to be fixed.

The most obvious way to fix it is likely to just shrink that
__wait_event_interruptible_locked() macro.

Yes, yes, some of it absolutely does need to remain as a macro,
because it has that

   do { .. } while (condition);

part of it, but I think the stuff inside that while loop could be made
into a function of its own. Actually, maybe two different functions
(for the "irq" case on/off).

Anyway, I fixed the semantic merge error by just including thar
<linux/sched/signal.h> file, but this is just not acceptable.

Having to have files know that if they use the wait-event functins
(well, _some_ of them), they not only need to include <linux/wait.h>,
they need to completely illogically also include
<linux/sched/signal.h> is just not maintainable.

And who knows what similar semantic cases I _won't_ notice, because
they occur in code I don't build even with my allmodconfig builds?

                     Linus

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [GIT PULL] sched.h split-up
  2017-03-03 20:13 ` Linus Torvalds
@ 2017-03-04  7:30   ` Ingo Molnar
  2017-03-07 23:33   ` Linus Torvalds
  1 sibling, 0 replies; 14+ messages in thread
From: Ingo Molnar @ 2017-03-04  7:30 UTC (permalink / raw)
  To: Linus Torvalds
  Cc: Linux Kernel Mailing List, Peter Zijlstra, Thomas Gleixner,
	Andrew Morton


* Linus Torvalds <torvalds@linux-foundation.org> wrote:

> Anyway, I fixed the semantic merge error by just including thar
> <linux/sched/signal.h> file, but this is just not acceptable.
> 
> Having to have files know that if they use the wait-event functins
> (well, _some_ of them), they not only need to include <linux/wait.h>,
> they need to completely illogically also include
> <linux/sched/signal.h> is just not maintainable.

Absolutely and agreed, will fix this ASAP!

wait.h generates too large functions anyway, so uninlining parts of it will be an 
improvement anyway.

> And who knows what similar semantic cases I _won't_ notice, because
> they occur in code I don't build even with my allmodconfig builds?

I did a fair amount of allyes/allno/allmod plus randconfig testing on x86, and 
caught and fixed a number of cases, so that angle should be covered to a fair 
degree.

On non-x86 I did allyes/allno/allmod testing as well, but not randconfig testing - 
plus some of the architectures have a large amount of defconfigs which I couldn't 
all test through.

So I'd expect build breakages to be concentrated into newly upstreamed code (such 
as this one) - which risk I tried to reduce by re-testing them on the almost-last 
day of the merge window.

Thanks,

	Ingo

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [GIT PULL] sched.h split-up
  2017-03-03 20:13 ` Linus Torvalds
  2017-03-04  7:30   ` Ingo Molnar
@ 2017-03-07 23:33   ` Linus Torvalds
  2017-03-08  0:04     ` Linus Torvalds
  2017-03-08  8:37     ` [RFC PATCH] sched/wait: Introduce new, more compact wait_event*() primitives Ingo Molnar
  1 sibling, 2 replies; 14+ messages in thread
From: Linus Torvalds @ 2017-03-07 23:33 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: Linux Kernel Mailing List, Peter Zijlstra, Thomas Gleixner,
	Andrew Morton

[-- Attachment #1: Type: text/plain, Size: 1138 bytes --]

On Fri, Mar 3, 2017 at 12:13 PM, Linus Torvalds
<torvalds@linux-foundation.org> wrote:
>
> The fact that you can include <linux/wait.h>, and then cannot use the
> wait event functions because you're missing "signal_pending()" is
> complete garbage. This needs to be fixed.

Here's a (totally untested) patch that tries to do exactly that.

It moves the stuff inside the wait-loop into two helper functions -
one for "interrupts off" and one for "interrupts on" case - and does
the meat of the whole __wait_event_interruptible_locked() out of line.

NOTE! This is all the slow case, when we will schedule and mess around
with spinlocks. The fast case will have been taken care of by the
macros that then use the whole "__wait_event_interruptible_locked()"
machinery.

So moving it out of line not only makes the build simpler (no need for
<linux/sched/signal.h> for the "signal_pending()" thing), but seems to
be the right thing to do from a code size standpoint too.

But as mentioned - this is untested. It seems to build, and it looks
"ObviouslyCorrect(tm)", but I didn't actually try to boot it.

Comments?

                     Linus

[-- Attachment #2: patch.diff --]
[-- Type: text/plain, Size: 4275 bytes --]

 include/linux/wait.h | 31 ++++++++++---------------------
 kernel/sched/wait.c  | 39 +++++++++++++++++++++++++++++++++++++++
 2 files changed, 49 insertions(+), 21 deletions(-)

diff --git a/include/linux/wait.h b/include/linux/wait.h
index aacb1282d19a..db076ca7f11d 100644
--- a/include/linux/wait.h
+++ b/include/linux/wait.h
@@ -620,30 +620,19 @@ do {									\
 	__ret;								\
 })
 
+extern int do_wait_intr(wait_queue_head_t *, wait_queue_t *);
+extern int do_wait_intr_irq(wait_queue_head_t *, wait_queue_t *);
 
-#define __wait_event_interruptible_locked(wq, condition, exclusive, irq) \
+#define __wait_event_interruptible_locked(wq, condition, exclusive, fn) \
 ({									\
-	int __ret = 0;							\
+	int __ret;							\
 	DEFINE_WAIT(__wait);						\
 	if (exclusive)							\
 		__wait.flags |= WQ_FLAG_EXCLUSIVE;			\
 	do {								\
-		if (likely(list_empty(&__wait.task_list)))		\
-			__add_wait_queue_tail(&(wq), &__wait);		\
-		set_current_state(TASK_INTERRUPTIBLE);			\
-		if (signal_pending(current)) {				\
-			__ret = -ERESTARTSYS;				\
+		__ret = fn(&(wq), &__wait);				\
+		if (__ret)						\
 			break;						\
-		}							\
-		if (irq)						\
-			spin_unlock_irq(&(wq).lock);			\
-		else							\
-			spin_unlock(&(wq).lock);			\
-		schedule();						\
-		if (irq)						\
-			spin_lock_irq(&(wq).lock);			\
-		else							\
-			spin_lock(&(wq).lock);				\
 	} while (!(condition));						\
 	__remove_wait_queue(&(wq), &__wait);				\
 	__set_current_state(TASK_RUNNING);				\
@@ -676,7 +665,7 @@ do {									\
  */
 #define wait_event_interruptible_locked(wq, condition)			\
 	((condition)							\
-	 ? 0 : __wait_event_interruptible_locked(wq, condition, 0, 0))
+	 ? 0 : __wait_event_interruptible_locked(wq, condition, 0, do_wait_intr))
 
 /**
  * wait_event_interruptible_locked_irq - sleep until a condition gets true
@@ -703,7 +692,7 @@ do {									\
  */
 #define wait_event_interruptible_locked_irq(wq, condition)		\
 	((condition)							\
-	 ? 0 : __wait_event_interruptible_locked(wq, condition, 0, 1))
+	 ? 0 : __wait_event_interruptible_locked(wq, condition, 0, do_wait_intr_irq))
 
 /**
  * wait_event_interruptible_exclusive_locked - sleep exclusively until a condition gets true
@@ -734,7 +723,7 @@ do {									\
  */
 #define wait_event_interruptible_exclusive_locked(wq, condition)	\
 	((condition)							\
-	 ? 0 : __wait_event_interruptible_locked(wq, condition, 1, 0))
+	 ? 0 : __wait_event_interruptible_locked(wq, condition, 1, do_wait_intr))
 
 /**
  * wait_event_interruptible_exclusive_locked_irq - sleep until a condition gets true
@@ -765,7 +754,7 @@ do {									\
  */
 #define wait_event_interruptible_exclusive_locked_irq(wq, condition)	\
 	((condition)							\
-	 ? 0 : __wait_event_interruptible_locked(wq, condition, 1, 1))
+	 ? 0 : __wait_event_interruptible_locked(wq, condition, 1, do_wait_intr_irq))
 
 
 #define __wait_event_killable(wq, condition)				\
diff --git a/kernel/sched/wait.c b/kernel/sched/wait.c
index 4d2ea6f25568..b8c84c6dee64 100644
--- a/kernel/sched/wait.c
+++ b/kernel/sched/wait.c
@@ -242,6 +242,45 @@ long prepare_to_wait_event(wait_queue_head_t *q, wait_queue_t *wait, int state)
 }
 EXPORT_SYMBOL(prepare_to_wait_event);
 
+/*
+ * Note! These two wait functions are entered with the
+ * wait-queue lock held (and interrupts off in the _irq
+ * case), so there is no race with testing the wakeup
+ * condition in the caller before they add the wait
+ * entry to the wake queue.
+ */
+int do_wait_intr(wait_queue_head_t *wq, wait_queue_t *wait)
+{
+	if (likely(list_empty(&wait->task_list)))
+		__add_wait_queue_tail(wq, wait);
+
+	set_current_state(TASK_INTERRUPTIBLE);
+	if (signal_pending(current))
+		return -ERESTARTSYS;
+
+	spin_unlock(&wq->lock);
+	schedule();
+	spin_lock(&wq->lock);
+	return 0;
+}
+EXPORT_SYMBOL(do_wait_intr);
+
+int do_wait_intr_irq(wait_queue_head_t *wq, wait_queue_t *wait)
+{
+	if (likely(list_empty(&wait->task_list)))
+		__add_wait_queue_tail(wq, wait);
+
+	set_current_state(TASK_INTERRUPTIBLE);
+	if (signal_pending(current))
+		return -ERESTARTSYS;
+
+	spin_unlock_irq(&wq->lock);
+	schedule();
+	spin_lock_irq(&wq->lock);
+	return 0;
+}
+EXPORT_SYMBOL(do_wait_intr_irq);
+
 /**
  * finish_wait - clean up after waiting in a queue
  * @q: waitqueue waited on

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* Re: [GIT PULL] sched.h split-up
  2017-03-07 23:33   ` Linus Torvalds
@ 2017-03-08  0:04     ` Linus Torvalds
  2017-03-08 17:24       ` Ingo Molnar
  2017-03-08  8:37     ` [RFC PATCH] sched/wait: Introduce new, more compact wait_event*() primitives Ingo Molnar
  1 sibling, 1 reply; 14+ messages in thread
From: Linus Torvalds @ 2017-03-08  0:04 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: Linux Kernel Mailing List, Peter Zijlstra, Thomas Gleixner,
	Andrew Morton

On Tue, Mar 7, 2017 at 3:33 PM, Linus Torvalds
<torvalds@linux-foundation.org> wrote:
>
> But as mentioned - this is untested. It seems to build, and it looks
> "ObviouslyCorrect(tm)", but I didn't actually try to boot it.

Well, it boots, but it's not like there are all that many users of the
wait_event_interruptible*_locked*() interfaces, so it's dubious that I
actually exercised the changes all that much (if at all).

Of course, that's just more reason to *not* have it be some big macro
expansion in a header file that requires other includes. Basically,
this interface isn't worth the header inclusion pain.

And no, I didn't try to see how many

   #include <linux/sched/signal.h>

I could try to remove with this.

But I *did* verify that I could now build that fs/overlayfs/util.c
file with that #include removed.

That's the case that caused a semantic merge issue for me - but I
don't know how many others Ingo added as part of the split-up.

                   Linus

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [RFC PATCH] sched/wait: Introduce new, more compact wait_event*() primitives
  2017-03-07 23:33   ` Linus Torvalds
  2017-03-08  0:04     ` Linus Torvalds
@ 2017-03-08  8:37     ` Ingo Molnar
  2017-03-08  9:17       ` [RFC PATCH] sched/wait: Add <linux/sched/signal.h> dependency for now Ingo Molnar
                         ` (3 more replies)
  1 sibling, 4 replies; 14+ messages in thread
From: Ingo Molnar @ 2017-03-08  8:37 UTC (permalink / raw)
  To: Linus Torvalds
  Cc: Linux Kernel Mailing List, Peter Zijlstra, Thomas Gleixner,
	Andrew Morton


* Linus Torvalds <torvalds@linux-foundation.org> wrote:

> On Fri, Mar 3, 2017 at 12:13 PM, Linus Torvalds
> <torvalds@linux-foundation.org> wrote:
> >
> > The fact that you can include <linux/wait.h>, and then cannot use the
> > wait event functions because you're missing "signal_pending()" is
> > complete garbage. This needs to be fixed.
> 
> Here's a (totally untested) patch that tries to do exactly that.

Sorry, I didn't forget about this problem, I worked on it over the weekend, it 
just turned out to be a lot more complex than I expected.

I took a more radical approach than you, and here's the patches I have so far:

0c32c5717beb sched/wait: Introduce new, more compact wait_event*() primitives
67b01ca3fda2 sched/wait: Disambiguate wq_entry->task_list and wq_head->task_list naming
48af925509bc sched/wait: Move bit_wait_table[] and related functionality from sched/core.c to sched/wait_bit.c
bc151d1fd3e9 sched/wait: Split out the wait_bit*() APIs from <linux/wait.h> into <linux/wait_bit.h>
b2d294b5824c sched/wait: Re-adjust macro line continuation backslashes in <linux/wait.h>
e9bbf53778c2 sched/wait: Improve the bit-wait API parameter names in the API function prototypes
6a6899db8e5a sched/wait: Standardize wait_bit_queue naming
8e060b6e033c sched/wait: Standardize 'struct wait_bit_queue' wait-queue entry field name
139793f6ac6f sched/wait: Standardize internal naming of wait-queue heads
bb393b1a7e11 sched/wait: Standardize internal naming of wait-queue entries
28376289373c sched/wait: Rename wait_queue_t => wait_queue_entry_t

You can find the latest (WIP, frequently rebased) version in:

  git git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git WIP.sched/core

The first 10 patches reshape the waitqueue code to be more hackable (to me!), 
because I kept bumping into confusing names all the time, but the real change 
you'd be most interested in is, in an RFC (to be rebased!) form, the following 
one:

  0c32c5717beb sched/wait: Introduce new, more compact wait_event*() primitives

I've attached that patch below as well.

The idea is to allow call sites to supply the 'condition' function as free-form C 
code, while pushing everything else into non-macro form: there's a 'struct 
wait_event_state' on stack, and a state machine. The waiting logic is converted 
from procedural form to a state machine, because we have to call out into the 
'condition' code in different circumstances.

It's a pretty weird construct, but it works I think, and has quite a few 
advantages (and a few disadvantages ...).

There's a lot of caveats with this RFC patch:

 - Not signed off, I'm not 100% sure it's fully correct yet, but superficial 
   testing suggests that it appears to boot - but PeterZ saw a boot hang on a
   server machine ...

 - NOTE: the v1/v2 structure is just a hack to make it easier to test - the final
   version wouldn't have such a construct.

 - Peter doesn't like the bool's in the struct - we could use char instead.

 - It needs a proper state machine diagram and more documentation - this is just a
   very quick prototype to see whether the concept has any chance of working.

The main advantage is the much reduced call site overhead, plus the fact that we 
move much of the logic into the .c space.

Right now event_wait() [which is in fact the smallest wait-event primitive!] 
generates this humunguous amount of inlined code on x86-64 defconfig:

	long test_flag;

	DECLARE_WAIT_QUEUE_HEAD(test_waitqueue_head);

	void test_function(void)
	{
	        wait_event(test_waitqueue_head, test_flag != 0);
	}

00000000000084e0 <test_function>:
    84e0:	55                   	push   %rbp
    84e1:	48 89 e5             	mov    %rsp,%rbp
    84e4:	48 83 ec 28          	sub    $0x28,%rsp

    84e8:	65 8b 05 00 00 00 00 	mov    %gs:0x0(%rip),%eax        # 84ef <test_function+0xf>
    84ef:	85 c0                	test   %eax,%eax
    84f1:	74 4f                	je     8542 <test_function+0x62>
    84f3:	48 83 3d 00 00 00 00 	cmpq   $0x0,0x0(%rip)        # 84fb <test_function+0x1b>
    84fa:	00 
    84fb:	74 02                	je     84ff <test_function+0x1f>

    84fd:	c9                   	leaveq 
    84fe:	c3                   	retq   

    84ff:	48 8d 7d d8          	lea    -0x28(%rbp),%rdi
    8503:	31 f6                	xor    %esi,%esi
    8505:	e8 00 00 00 00       	callq  850a <test_function+0x2a>
    850a:	eb 05                	jmp    8511 <test_function+0x31>
    850c:	e8 00 00 00 00       	callq  8511 <test_function+0x31>
    8511:	48 8d 75 d8          	lea    -0x28(%rbp),%rsi
    8515:	ba 02 00 00 00       	mov    $0x2,%edx
    851a:	48 c7 c7 00 00 00 00 	mov    $0x0,%rdi
    8521:	e8 00 00 00 00       	callq  8526 <test_function+0x46>
    8526:	48 83 3d 00 00 00 00 	cmpq   $0x0,0x0(%rip)        # 852e <test_function+0x4e>
    852d:	00 
    852e:	74 dc                	je     850c <test_function+0x2c>
    8530:	48 8d 75 d8          	lea    -0x28(%rbp),%rsi
    8534:	48 c7 c7 00 00 00 00 	mov    $0x0,%rdi
    853b:	e8 00 00 00 00       	callq  8540 <test_function+0x60>
    8540:	c9                   	leaveq 
    8541:	c3                   	retq   
    8542:	e8 00 00 00 00       	callq  8547 <test_function+0x67>
    8547:	eb aa                	jmp    84f3 <test_function+0x13>

That's 5 inlined function calls (!).

Note that it's even worse with some of the more complex wait_event*() constructs, 
for example the popular wait_event_interruptible_timeout() API generates this much 
code per call site:

00000000000084d0 <test_function_timeout>:
    84d0:	55                   	push   %rbp
    84d1:	48 89 e5             	mov    %rsp,%rbp
    84d4:	53                   	push   %rbx
    84d5:	48 83 ec 28          	sub    $0x28,%rsp
    84d9:	65 8b 05 00 00 00 00 	mov    %gs:0x0(%rip),%eax        # 84e0 <test_function_timeout+0x10>
    84e0:	85 c0                	test   %eax,%eax
    84e2:	0f 84 a0 00 00 00    	je     8588 <test_function_timeout+0xb8>
    84e8:	48 83 3d 00 00 00 00 	cmpq   $0x0,0x0(%rip)        # 84f0 <test_function_timeout+0x20>
    84ef:	00 
    84f0:	74 07                	je     84f9 <test_function_timeout+0x29>
    84f2:	48 83 c4 28          	add    $0x28,%rsp
    84f6:	5b                   	pop    %rbx
    84f7:	5d                   	pop    %rbp
    84f8:	c3                   	retq   
    84f9:	48 8d 7d d0          	lea    -0x30(%rbp),%rdi
    84fd:	31 f6                	xor    %esi,%esi
    84ff:	bb 10 27 00 00       	mov    $0x2710,%ebx
    8504:	e8 00 00 00 00       	callq  8509 <test_function_timeout+0x39>
    8509:	48 8d 75 d0          	lea    -0x30(%rbp),%rsi
    850d:	ba 01 00 00 00       	mov    $0x1,%edx
    8512:	48 c7 c7 00 00 00 00 	mov    $0x0,%rdi
    8519:	e8 00 00 00 00       	callq  851e <test_function_timeout+0x4e>
    851e:	48 83 3d 00 00 00 00 	cmpq   $0x0,0x0(%rip)        # 8526 <test_function_timeout+0x56>
    8525:	00 
    8526:	0f 95 c2             	setne  %dl
    8529:	31 c9                	xor    %ecx,%ecx
    852b:	84 d2                	test   %dl,%dl
    852d:	75 42                	jne    8571 <test_function_timeout+0xa1>
    852f:	84 c9                	test   %cl,%cl
    8531:	75 3e                	jne    8571 <test_function_timeout+0xa1>
    8533:	48 85 c0             	test   %rax,%rax
    8536:	75 ba                	jne    84f2 <test_function_timeout+0x22>
    8538:	48 89 df             	mov    %rbx,%rdi
    853b:	e8 00 00 00 00       	callq  8540 <test_function_timeout+0x70>
    8540:	48 8d 75 d0          	lea    -0x30(%rbp),%rsi
    8544:	ba 01 00 00 00       	mov    $0x1,%edx
    8549:	48 c7 c7 00 00 00 00 	mov    $0x0,%rdi
    8550:	48 89 c3             	mov    %rax,%rbx
    8553:	e8 00 00 00 00       	callq  8558 <test_function_timeout+0x88>
    8558:	48 83 3d 00 00 00 00 	cmpq   $0x0,0x0(%rip)        # 8560 <test_function_timeout+0x90>
    855f:	00 
    8560:	0f 95 c2             	setne  %dl
    8563:	48 85 db             	test   %rbx,%rbx
    8566:	0f 94 c1             	sete   %cl
    8569:	84 d2                	test   %dl,%dl
    856b:	74 c2                	je     852f <test_function_timeout+0x5f>
    856d:	84 c9                	test   %cl,%cl
    856f:	74 ba                	je     852b <test_function_timeout+0x5b>
    8571:	48 8d 75 d0          	lea    -0x30(%rbp),%rsi
    8575:	48 c7 c7 00 00 00 00 	mov    $0x0,%rdi
    857c:	e8 00 00 00 00       	callq  8581 <test_function_timeout+0xb1>
    8581:	48 83 c4 28          	add    $0x28,%rsp
    8585:	5b                   	pop    %rbx
    8586:	5d                   	pop    %rbp
    8587:	c3                   	retq   
    8588:	e8 00 00 00 00       	callq  858d <test_function_timeout+0xbd>
    858d:	e9 56 ff ff ff       	jmpq   84e8 <test_function_timeout+0x18>

Which is about 50 instructions (!!!), and about 180 bytes of text overheaed.

We have over 1,900 wait_event() call sites:

  triton:~/tip> git grep -E 'wait_event.*\(' | wc -l
  1972

which means that with an average per call site overhead of 100 bytes code, this 
means a total text bloat of about ~190 KB...

This was pretty much hidden from common forms of bloat and overhead analysis so 
far, because it's all inlined at the CPP level and hidden 'inside' various normal 
functions.

With my patch it's just a loop with a single function call, and much lower call 
site impact:

0000000000008490 <test_function>:
    8490:	55                   	push   %rbp
    8491:	48 89 e5             	mov    %rsp,%rbp
    8494:	48 83 ec 38          	sub    $0x38,%rsp

    8498:	c6 45 c8 00          	movb   $0x0,-0x38(%rbp)
    849c:	31 d2                	xor    %edx,%edx
    849e:	48 83 3d 00 00 00 00 	cmpq   $0x0,0x0(%rip)        # 84a6 <test_function+0x16>
    84a5:	00 
    84a6:	48 8d 75 c8          	lea    -0x38(%rbp),%rsi
    84aa:	48 c7 c7 00 00 00 00 	mov    $0x0,%rdi
    84b1:	0f 95 c2             	setne  %dl
    84b4:	e8 00 00 00 00       	callq  84b9 <test_function+0x29>
    84b9:	80 7d ca 00          	cmpb   $0x0,-0x36(%rbp)
    84bd:	74 dd                	je     849c <test_function+0xc>

    84bf:	c9                   	leaveq 
    84c0:	c3                   	retq   

Which is about 9 instructions.

So with the wait-event state machine it's a very sweet, compact construct with 
only a single function call - 9 instructions total, even with more complex API 
variants. The original version generates over 20-50 instructions depending on 
complexity.

Also note that if we uninline much of the iterator with my approach, we could more 
aggressively inline _that_ central state machine function and get rid of the many 
function calls it does internally.

I.e. it's not just debloating but an all around speedup for the actual-waiting 
case, which does happen frequently. For the doesn't-wait case there's a bit more 
overhead due to the extra function call.

But, the never ending quest of an uncaring universe makes our life more difficult, 
because there are disadvantages of a state machine as well:

 - State machines are so hellishly difficult to read, to get right and to 
   maintain.

 - While most wait_event() constructs actually do end up schedule()ing for real, 
   but still the 'wait condition is already true' case gets burdened with an extra 
   function call, because we have to call into wait.c. We could inline that first 
   check, at the cost of more inlining overhead.

OTOH with this method we'd only have to get the state machine right roughly once, 
and have all the API variants in the wait.c space. We could use proper function 
pointers with inlining and other meta coding constructs within wait.c to reduce 
the number of variants in the source code space without adding runtime overhead. 
In fact I think we could optimize and form these functions a lot better within 
wait.c than in the macro space.

In any case, it's clear that this stuff is in no way v4.11 material, so as a 
bridging fix I propose we add a sched/signal.h include to wait.h (or just move 
signal_pending() temporarily), until it's all resolved for real for v4.12.

Thoughts?

Thanks,

	Ingo

=================>
>From 0c32c5717beb4a5895cd80b3941246867afe1004 Mon Sep 17 00:00:00 2001
From: Ingo Molnar <mingo@kernel.org>
Date: Sun, 5 Mar 2017 14:28:09 +0100
Subject: [PATCH] sched/wait: Introduce new, more compact wait_event*() primitives

Turn the wait_event() interface into a state machine.

Only very lightly tested, but should demonstrate the principle.

Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: linux-kernel@vger.kernel.org
NOT-Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
 include/linux/wait.h | 29 +++++++++++++++++++++++++-
 kernel/sched/wait.c  | 58 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 86 insertions(+), 1 deletion(-)

diff --git a/include/linux/wait.h b/include/linux/wait.h
index ead731ef5632..285f282c928e 100644
--- a/include/linux/wait.h
+++ b/include/linux/wait.h
@@ -225,6 +225,31 @@ void __wake_up_sync(struct wait_queue_head *wq_head, unsigned int mode, int nr);
 
 extern void init_wait_entry(struct wait_queue_entry *wq_entry, int flags);
 
+struct wait_event_state {
+	bool				queued;
+	bool				prepared;
+	bool				done;
+
+	long				ret;
+	struct wait_queue_entry		wq_entry;
+};
+
+extern long wait_event_loop(struct wait_queue_head *wq_head, struct wait_event_state *wes, int condition);
+
+#define wait_event_v2(wq_head, condition)					\
+({										\
+	struct wait_event_state __wes;						\
+	long __ret;								\
+										\
+	__wes.queued = 0;							\
+										\
+	do {									\
+		__ret = wait_event_loop(&(wq_head), &__wes, (condition) != 0);	\
+	} while (!__wes.done);							\
+										\
+	__ret;									\
+})
+
 /*
  * The below macro ___wait_event() has an explicit shadow of the __ret
  * variable when used from the wait_event_*() macros.
@@ -277,7 +302,7 @@ __out:	__ret;									\
  * wake_up() has to be called after changing any variable that could
  * change the result of the wait condition.
  */
-#define wait_event(wq_head, condition)						\
+#define wait_event_v1(wq_head, condition)					\
 do {										\
 	might_sleep();								\
 	if (condition)								\
@@ -285,6 +310,8 @@ do {										\
 	__wait_event(wq_head, condition);					\
 } while (0)
 
+#define wait_event wait_event_v2
+
 #define __io_wait_event(wq_head, condition)					\
 	(void)___wait_event(wq_head, condition, TASK_UNINTERRUPTIBLE, 0, 0,	\
 			    io_schedule())
diff --git a/kernel/sched/wait.c b/kernel/sched/wait.c
index 48794482d9ac..4542d9f6a5a4 100644
--- a/kernel/sched/wait.c
+++ b/kernel/sched/wait.c
@@ -293,6 +293,64 @@ static inline bool is_kthread_should_stop(void)
 }
 
 /*
+ * The main wait_event*() event loop iteration state machine.
+ *
+ * Note that this function itself does not loop, it returns to
+ * the caller to evaluate the call site dependent condition in
+ * every iteration.
+ */
+long wait_event_loop(struct wait_queue_head *wq_head, struct wait_event_state *wes, int condition)
+{
+	if (!wes->queued) {
+		might_sleep();
+
+		/*
+		 * If we are not initialized yet and the condition is already
+		 * met, we can return immediately:
+		 */
+		if (condition) {
+			wes->done = 1;
+			return 0;
+		}
+
+		/* Set up the wait-queue entry: */
+		init_wait_entry(&wes->wq_entry, 0);
+
+		wes->done = 0;
+		wes->queued = 1;
+		wes->prepared = 0;
+		wes->ret = 0;
+	} else {
+		/* Here is where we notice an updated wait condition: */
+		if (condition) {
+			finish_wait(wq_head, &wes->wq_entry);
+			wes->done = 1;
+			return 0;
+		}
+	}
+
+	if (!wes->prepared) {
+prepare_again:
+		wes->ret = prepare_to_wait_event(wq_head, &wes->wq_entry, 0);
+		wes->prepared = 1;
+
+		return 0;
+	}
+
+	if (___wait_is_interruptible(0) && wes->ret) {
+		/* We already got dequeued, so mark it done: */
+		wes->done = 1;
+
+		/* But return any eventual interruption code: */
+		return wes->ret;
+	}
+
+	schedule();
+	goto prepare_again;
+}
+EXPORT_SYMBOL_GPL(wait_event_loop);
+
+/*
  * DEFINE_WAIT_FUNC(wait, woken_wake_func);
  *
  * add_wait_queue(&wq_head, &wait);

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [RFC PATCH] sched/wait: Add <linux/sched/signal.h> dependency for now
  2017-03-08  8:37     ` [RFC PATCH] sched/wait: Introduce new, more compact wait_event*() primitives Ingo Molnar
@ 2017-03-08  9:17       ` Ingo Molnar
  2017-03-08 10:11         ` [PATCH -v2] " Ingo Molnar
  2017-03-08 11:55       ` [RFC PATCH] sched/wait: Introduce new, more compact wait_event*() primitives Ingo Molnar
                         ` (2 subsequent siblings)
  3 siblings, 1 reply; 14+ messages in thread
From: Ingo Molnar @ 2017-03-08  9:17 UTC (permalink / raw)
  To: Linus Torvalds
  Cc: Linux Kernel Mailing List, Peter Zijlstra, Thomas Gleixner,
	Andrew Morton


* Ingo Molnar <mingo@kernel.org> wrote:

> In any case, it's clear that this stuff is in no way v4.11 material, so as a 
> bridging fix I propose we add a sched/signal.h include to wait.h (or just move 
> signal_pending() temporarily), until it's all resolved for real for v4.12.

I.e. I propose the patch below as the v4.11 solution.

The two dependency quirks are not very elegant, plus to add insult to injury we 
now revert to the original situation in v4.10 where wait.h includes sched/signal.h 
and sched/signal.h includes wait.h (which the header guards sort out properly), 
but it appears to build fine here in (still very light, x86-defconfig) build 
testing.

Note that there's some dependency fallout from the cred.h change, but it's all 
correctly adding a dependency for types/APIs that are defined in cred.h - i.e. 
it's improving things in that regard. (Could split this patch into two patches: 
first the cred.h change, then the signal types hack.)

I'll do more testing over the day to see how well this approach works. Not yet 
signed off by me. I'll post updated versions over the day if there's any changes.

This removes the time pressure to untangle the wait.h mess for v4.11.

Thanks,

	Ingo

======================>
>From 2ddf85215d5ded5abfa592da69a8d84d6fcaf34b Mon Sep 17 00:00:00 2001
From: Ingo Molnar <mingo@kernel.org>
Date: Wed, 8 Mar 2017 09:42:52 +0100
Subject: [PATCH] sched/wait: Add <linux/sched/signal.h> dependency for now

The wait_event_interruptible*() APIs are using signal_pending(), so
include its header to not build-break users of those APIs.

Note that this is overkill as most wait_event*() users don't care
about signals - but solving that problem turned out to be more
complex.

Note two dependency quirks:

- the <linux/sched/signal.h> include line needs to be last in
  wait.h, because that header itself depends on wait-queue types.

- we shouldn't include cred.h from sched/signal.h, because cred.h is
  a complex header that will create a circular dependency if we do so.
  Instead we include wait.h to gain the waitqueue types, plus we
  predeclare 'struct cred' for a function prototype.

Note that the cred.h change has some knock-on effects.

Reported-by: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: linux-kernel@vger.kernel.org
Not-Yet-Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
 include/linux/audit.h        | 2 ++
 include/linux/fs.h           | 1 +
 include/linux/sched/signal.h | 8 +++++---
 include/linux/wait.h         | 3 +++
 kernel/tsacct.c              | 1 +
 5 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/include/linux/audit.h b/include/linux/audit.h
index 504e784b7ffa..57b3d6c07875 100644
--- a/include/linux/audit.h
+++ b/include/linux/audit.h
@@ -25,6 +25,8 @@
 
 #include <linux/sched.h>
 #include <linux/ptrace.h>
+#include <linux/cred.h>
+
 #include <uapi/linux/audit.h>
 
 #define AUDIT_INO_UNSET ((unsigned long)-1)
diff --git a/include/linux/fs.h b/include/linux/fs.h
index aad3fd0ff5f8..bf51dc2dc14a 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -3,6 +3,7 @@
 
 #include <linux/linkage.h>
 #include <linux/wait.h>
+#include <linux/cred.h>
 #include <linux/kdev_t.h>
 #include <linux/dcache.h>
 #include <linux/path.h>
diff --git a/include/linux/sched/signal.h b/include/linux/sched/signal.h
index 2cf446704cd4..0a5abc3dc937 100644
--- a/include/linux/sched/signal.h
+++ b/include/linux/sched/signal.h
@@ -6,7 +6,7 @@
 #include <linux/sched.h>
 #include <linux/sched/jobctl.h>
 #include <linux/sched/task.h>
-#include <linux/cred.h>
+#include <linux/wait.h>
 
 /*
  * Types defining task->signal and task->sighand and APIs using them:
@@ -289,8 +289,10 @@ extern int force_sigsegv(int, struct task_struct *);
 extern int force_sig_info(int, struct siginfo *, struct task_struct *);
 extern int __kill_pgrp_info(int sig, struct siginfo *info, struct pid *pgrp);
 extern int kill_pid_info(int sig, struct siginfo *info, struct pid *pid);
-extern int kill_pid_info_as_cred(int, struct siginfo *, struct pid *,
-				const struct cred *, u32);
+
+struct cred;
+extern int kill_pid_info_as_cred(int, struct siginfo *, struct pid *, const struct cred *, u32);
+
 extern int kill_pgrp(struct pid *pid, int sig, int priv);
 extern int kill_pid(struct pid *pid, int sig, int priv);
 extern int kill_proc_info(int, struct siginfo *, pid_t);
diff --git a/include/linux/wait.h b/include/linux/wait.h
index aacb1282d19a..e8e5a2ea3bbd 100644
--- a/include/linux/wait.h
+++ b/include/linux/wait.h
@@ -1224,4 +1224,7 @@ int wait_on_atomic_t(atomic_t *val, int (*action)(atomic_t *), unsigned mode)
 	return out_of_line_wait_on_atomic_t(val, action, mode);
 }
 
+/* NOTE: this is temporary, and it needs to come last, due to type dependencies: */
+#include <linux/sched/signal.h>
+
 #endif /* _LINUX_WAIT_H */
diff --git a/kernel/tsacct.c b/kernel/tsacct.c
index 370724b45391..63834bd86639 100644
--- a/kernel/tsacct.c
+++ b/kernel/tsacct.c
@@ -23,6 +23,7 @@
 #include <linux/tsacct_kern.h>
 #include <linux/acct.h>
 #include <linux/jiffies.h>
+#include <linux/cred.h>
 #include <linux/mm.h>
 
 /*

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH -v2] sched/wait: Add <linux/sched/signal.h> dependency for now
  2017-03-08  9:17       ` [RFC PATCH] sched/wait: Add <linux/sched/signal.h> dependency for now Ingo Molnar
@ 2017-03-08 10:11         ` Ingo Molnar
  0 siblings, 0 replies; 14+ messages in thread
From: Ingo Molnar @ 2017-03-08 10:11 UTC (permalink / raw)
  To: Linus Torvalds
  Cc: Linux Kernel Mailing List, Peter Zijlstra, Thomas Gleixner,
	Andrew Morton


* Ingo Molnar <mingo@kernel.org> wrote:

> I'll do more testing over the day to see how well this approach works. Not yet 
> signed off by me. I'll post updated versions over the day if there's any 
> changes.
> 
> This removes the time pressure to untangle the wait.h mess for v4.11.

I've completed a full [allno|def|allmod|allyes]config test on x86, plus 
[allno|def]config builds on 20+ architectures, and beyond a single obvious
Alpha build fix, the patch held up pretty well.

So if we can live with the ugliness temporarily, this approach might work as a 
stop-gap measure. I'll push out the patch to get the various build bots active
as well.

I've attached -v2 below.

Also as a test I removed the <linux/sched/signal.h> from fs/overlayfs/util.c, and 
the build failure you saw originally does not trigger anymore.

Since I'm not aware of this particular dependency bug having appeared in anything 
else but the overlayfs bug you worked around in the merge window (there's some 
pending build fixes but they are unrelated), I could also wait for a linux-next 
test iteration to get more cross-arch build coverage of this patch and send this 
fix to you in about two days.

But feel free to apply it from email as well.

Thoughts?

Thanks,

	Ingo

====================>
>From 65eb2b3976f1b78563a8be7120c7fe3de27a1258 Mon Sep 17 00:00:00 2001
From: Ingo Molnar <mingo@kernel.org>
Date: Wed, 8 Mar 2017 09:42:52 +0100
Subject: [PATCH] sched/wait: Add <linux/sched/signal.h> dependency for now

The wait_event_interruptible*() APIs are using signal_pending(), so
include its header to not build-break users of those APIs.

Note that this is overkill as most wait_event*() users don't care
about signals - but solving that problem turned out to be more
complex.

Note two dependency quirks:

- the <linux/sched/signal.h> include line needs to be last in
  wait.h, because that header itself depends on wait-queue types.

- we shouldn't include cred.h from sched/signal.h, because cred.h is
  a complex header that will create a circular dependency if we do so.
  Instead we include wait.h to gain the waitqueue types, plus we
  predeclare 'struct cred' for a function prototype.

Note that the cred.h change has some knock-on effects.

Reported-by: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
 arch/alpha/kernel/asm-offsets.c | 2 ++
 include/linux/audit.h           | 2 ++
 include/linux/fs.h              | 1 +
 include/linux/sched/signal.h    | 8 +++++---
 include/linux/wait.h            | 3 +++
 kernel/tsacct.c                 | 1 +
 6 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/arch/alpha/kernel/asm-offsets.c b/arch/alpha/kernel/asm-offsets.c
index 6ff8886e7e22..357632578142 100644
--- a/arch/alpha/kernel/asm-offsets.c
+++ b/arch/alpha/kernel/asm-offsets.c
@@ -9,6 +9,8 @@
 #include <linux/sched.h>
 #include <linux/ptrace.h>
 #include <linux/kbuild.h>
+#include <linux/cred.h>
+
 #include <asm/io.h>
 
 void foo(void)
diff --git a/include/linux/audit.h b/include/linux/audit.h
index 504e784b7ffa..57b3d6c07875 100644
--- a/include/linux/audit.h
+++ b/include/linux/audit.h
@@ -25,6 +25,8 @@
 
 #include <linux/sched.h>
 #include <linux/ptrace.h>
+#include <linux/cred.h>
+
 #include <uapi/linux/audit.h>
 
 #define AUDIT_INO_UNSET ((unsigned long)-1)
diff --git a/include/linux/fs.h b/include/linux/fs.h
index aad3fd0ff5f8..bf51dc2dc14a 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -3,6 +3,7 @@
 
 #include <linux/linkage.h>
 #include <linux/wait.h>
+#include <linux/cred.h>
 #include <linux/kdev_t.h>
 #include <linux/dcache.h>
 #include <linux/path.h>
diff --git a/include/linux/sched/signal.h b/include/linux/sched/signal.h
index 2cf446704cd4..0a5abc3dc937 100644
--- a/include/linux/sched/signal.h
+++ b/include/linux/sched/signal.h
@@ -6,7 +6,7 @@
 #include <linux/sched.h>
 #include <linux/sched/jobctl.h>
 #include <linux/sched/task.h>
-#include <linux/cred.h>
+#include <linux/wait.h>
 
 /*
  * Types defining task->signal and task->sighand and APIs using them:
@@ -289,8 +289,10 @@ extern int force_sigsegv(int, struct task_struct *);
 extern int force_sig_info(int, struct siginfo *, struct task_struct *);
 extern int __kill_pgrp_info(int sig, struct siginfo *info, struct pid *pgrp);
 extern int kill_pid_info(int sig, struct siginfo *info, struct pid *pid);
-extern int kill_pid_info_as_cred(int, struct siginfo *, struct pid *,
-				const struct cred *, u32);
+
+struct cred;
+extern int kill_pid_info_as_cred(int, struct siginfo *, struct pid *, const struct cred *, u32);
+
 extern int kill_pgrp(struct pid *pid, int sig, int priv);
 extern int kill_pid(struct pid *pid, int sig, int priv);
 extern int kill_proc_info(int, struct siginfo *, pid_t);
diff --git a/include/linux/wait.h b/include/linux/wait.h
index aacb1282d19a..e8e5a2ea3bbd 100644
--- a/include/linux/wait.h
+++ b/include/linux/wait.h
@@ -1224,4 +1224,7 @@ int wait_on_atomic_t(atomic_t *val, int (*action)(atomic_t *), unsigned mode)
 	return out_of_line_wait_on_atomic_t(val, action, mode);
 }
 
+/* NOTE: this is temporary, and it needs to come last, due to type dependencies: */
+#include <linux/sched/signal.h>
+
 #endif /* _LINUX_WAIT_H */
diff --git a/kernel/tsacct.c b/kernel/tsacct.c
index 370724b45391..63834bd86639 100644
--- a/kernel/tsacct.c
+++ b/kernel/tsacct.c
@@ -23,6 +23,7 @@
 #include <linux/tsacct_kern.h>
 #include <linux/acct.h>
 #include <linux/jiffies.h>
+#include <linux/cred.h>
 #include <linux/mm.h>
 
 /*

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* Re: [RFC PATCH] sched/wait: Introduce new, more compact wait_event*() primitives
  2017-03-08  8:37     ` [RFC PATCH] sched/wait: Introduce new, more compact wait_event*() primitives Ingo Molnar
  2017-03-08  9:17       ` [RFC PATCH] sched/wait: Add <linux/sched/signal.h> dependency for now Ingo Molnar
@ 2017-03-08 11:55       ` Ingo Molnar
  2017-03-08 12:10       ` [RFC PATCH, -v2] " Ingo Molnar
  2017-03-08 16:37       ` [RFC PATCH] " Linus Torvalds
  3 siblings, 0 replies; 14+ messages in thread
From: Ingo Molnar @ 2017-03-08 11:55 UTC (permalink / raw)
  To: Linus Torvalds
  Cc: Linux Kernel Mailing List, Peter Zijlstra, Thomas Gleixner,
	Andrew Morton


* Ingo Molnar <mingo@kernel.org> wrote:

> You can find the latest (WIP, frequently rebased) version in:
> 
>   git git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git WIP.sched/core
> 
> The first 10 patches reshape the waitqueue code to be more hackable (to me!), 
> because I kept bumping into confusing names all the time, but the real change 
> you'd be most interested in is, in an RFC (to be rebased!) form, the following 
> one:
> 
>   0c32c5717beb sched/wait: Introduce new, more compact wait_event*() primitives
> 
> I've attached that patch below as well.

Note that I rebased it meanwhile so the SHA1's changed. The commit titles should 
still be the same though.

Thanks,

	Ingo

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [RFC PATCH, -v2] sched/wait: Introduce new, more compact wait_event*() primitives
  2017-03-08  8:37     ` [RFC PATCH] sched/wait: Introduce new, more compact wait_event*() primitives Ingo Molnar
  2017-03-08  9:17       ` [RFC PATCH] sched/wait: Add <linux/sched/signal.h> dependency for now Ingo Molnar
  2017-03-08 11:55       ` [RFC PATCH] sched/wait: Introduce new, more compact wait_event*() primitives Ingo Molnar
@ 2017-03-08 12:10       ` Ingo Molnar
  2017-03-09 16:25         ` Peter Zijlstra
  2017-03-08 16:37       ` [RFC PATCH] " Linus Torvalds
  3 siblings, 1 reply; 14+ messages in thread
From: Ingo Molnar @ 2017-03-08 12:10 UTC (permalink / raw)
  To: Linus Torvalds
  Cc: Linux Kernel Mailing List, Peter Zijlstra, Thomas Gleixner,
	Andrew Morton


* Ingo Molnar <mingo@kernel.org> wrote:

> +	if (___wait_is_interruptible(0) && wes->ret) {

So that line is dumb and bogus, it should be:

	if (___wait_is_interruptible(TASK_UNINTERRUPTIBLE) && wes->ret) {

... which in the final version will be passed in parametrically within wait.c 
itself (but probably not passed in from the macro space, to lower the call site 
overhead), that is why I preserved the __wait_is_interruptible() check to begin 
with.

(This bug could perhaps explain the boot hang Peter saw.)

I also removed the bool state variables Peter disliked and added (a tiny ...) bit 
more documentation, the latest version is attached below.

Still not signed off, due to the _v1/_v2 devel hack - and it's of course still 
very incomplete, as only wait_event() is converted.

But this should be a reviewable demo of the new wait-event state machine logic.

I'd hesitate to put much more work into this without first having consensus over 
whether this is a good idea to begin with.

Thanks,

	Ingo

======================>
>From 2a918b9bb21e1e1daf047797f598cadb75bba241 Mon Sep 17 00:00:00 2001
From: Ingo Molnar <mingo@kernel.org>
Date: Sun, 5 Mar 2017 14:28:09 +0100
Subject: [PATCH] sched/wait: Introduce new, more compact wait_event*() primitives

Turn the wait_event() interface into a state machine.

Only very lightly tested, but should demonstrate the principle.

Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: linux-kernel@vger.kernel.org
Not-Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
 include/linux/wait.h | 34 ++++++++++++++++++++++++++++++-
 kernel/sched/wait.c  | 57 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 90 insertions(+), 1 deletion(-)

diff --git a/include/linux/wait.h b/include/linux/wait.h
index bdcca46ae54a..b1291cdb9b53 100644
--- a/include/linux/wait.h
+++ b/include/linux/wait.h
@@ -226,6 +226,36 @@ void __wake_up_sync(struct wait_queue_head *wq_head, unsigned int mode, int nr);
 extern void init_wait_entry(struct wait_queue_entry *wq_entry, int flags);
 
 /*
+ * The current state that the wait_event() loop operates
+ * over. This minimally initialized by the macro and then
+ * iterated inside the wait_event_loop() iterator:
+ */
+struct wait_event_state {
+	char				queued;
+	char				prepared;
+	char				done;
+
+	long				ret;
+	struct wait_queue_entry		wq_entry;
+};
+
+extern long wait_event_loop(struct wait_queue_head *wq_head, struct wait_event_state *wes, int condition);
+
+#define wait_event_v2(wq_head, condition)					\
+({										\
+	struct wait_event_state __wes;						\
+	long __ret;								\
+										\
+	__wes.queued = 0;							\
+										\
+	do {									\
+		__ret = wait_event_loop(&(wq_head), &__wes, (condition) != 0);	\
+	} while (!__wes.done);							\
+										\
+	__ret;									\
+})
+
+/*
  * The below macro ___wait_event() has an explicit shadow of the __ret
  * variable when used from the wait_event_*() macros.
  *
@@ -277,7 +307,7 @@ __out:	__ret;									\
  * wake_up() has to be called after changing any variable that could
  * change the result of the wait condition.
  */
-#define wait_event(wq_head, condition)						\
+#define wait_event_v1(wq_head, condition)					\
 do {										\
 	might_sleep();								\
 	if (condition)								\
@@ -285,6 +315,8 @@ do {										\
 	__wait_event(wq_head, condition);					\
 } while (0)
 
+#define wait_event wait_event_v2
+
 #define __io_wait_event(wq_head, condition)					\
 	(void)___wait_event(wq_head, condition, TASK_UNINTERRUPTIBLE, 0, 0,	\
 			    io_schedule())
diff --git a/kernel/sched/wait.c b/kernel/sched/wait.c
index 48794482d9ac..6d1e1139d5d3 100644
--- a/kernel/sched/wait.c
+++ b/kernel/sched/wait.c
@@ -293,6 +293,63 @@ static inline bool is_kthread_should_stop(void)
 }
 
 /*
+ * The main wait_event*() event loop iteration state machine.
+ *
+ * Note that this function itself does not loop, it returns to
+ * the caller to evaluate the call site dependent condition in
+ * every iteration.
+ */
+long wait_event_loop(struct wait_queue_head *wq_head, struct wait_event_state *wes, int condition)
+{
+	if (!wes->queued) {
+		might_sleep();
+		/*
+		 * If we are not initialized yet and the condition is already
+		 * met, we can return immediately:
+		 */
+		if (condition) {
+			wes->done = 1;
+			return 0;
+		}
+
+		/* Set up the wait-queue entry: */
+		init_wait_entry(&wes->wq_entry, 0);
+
+		wes->done	= 0;
+		wes->queued	= 1;
+		wes->prepared	= 0;
+		wes->ret	= 0;
+	} else {
+		/* Here is where we notice an updated wait condition: */
+		if (condition) {
+			finish_wait(wq_head, &wes->wq_entry);
+			wes->done = 1;
+			return 0;
+		}
+	}
+
+	if (!wes->prepared) {
+prepare_again:
+		wes->ret = prepare_to_wait_event(wq_head, &wes->wq_entry, 0);
+		wes->prepared = 1;
+
+		return 0;
+	}
+
+	if (___wait_is_interruptible(TASK_UNINTERRUPTIBLE) && wes->ret) {
+		/* We already got dequeued, so mark it done: */
+		wes->done = 1;
+
+		/* But return any eventual interruption code: */
+		return wes->ret;
+	}
+
+	schedule();
+	goto prepare_again;
+}
+EXPORT_SYMBOL_GPL(wait_event_loop);
+
+/*
  * DEFINE_WAIT_FUNC(wait, woken_wake_func);
  *
  * add_wait_queue(&wq_head, &wait);

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* Re: [RFC PATCH] sched/wait: Introduce new, more compact wait_event*() primitives
  2017-03-08  8:37     ` [RFC PATCH] sched/wait: Introduce new, more compact wait_event*() primitives Ingo Molnar
                         ` (2 preceding siblings ...)
  2017-03-08 12:10       ` [RFC PATCH, -v2] " Ingo Molnar
@ 2017-03-08 16:37       ` Linus Torvalds
  2017-03-08 17:16         ` Ingo Molnar
  3 siblings, 1 reply; 14+ messages in thread
From: Linus Torvalds @ 2017-03-08 16:37 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: Linux Kernel Mailing List, Peter Zijlstra, Thomas Gleixner,
	Andrew Morton

On Wed, Mar 8, 2017 at 12:37 AM, Ingo Molnar <mingo@kernel.org> wrote:
>
> The idea is to allow call sites to supply the 'condition' function as free-form C
> code, while pushing everything else into non-macro form: there's a 'struct
> wait_event_state' on stack, and a state machine. The waiting logic is converted
> from procedural form to a state machine, because we have to call out into the
> 'condition' code in different circumstances.

Ok, I think the concept is fine, but you don't actually fix the
problem with the locked version that needs to unlock (with irq
versions etc) around the schedule.

And using "bool" in a struct is disgusting and wrong, and hides the
fact that the compiler will just turn it into "char" (or even "int"
for platforms where "char'" is slow, like alpha).

So it would be better with a "state" variable that just has fields, I suspect.

.. and as mentioned, it doesn't actually fix the case that hit the
signal_pending() problem.

Honestly, I think my "pass in a waiter function" model was both less
subtle and indirect, and more generic.

And we can actually *fix* the problem with it for 4.11, instead of
adding the stupid header file includes.

                     Linus

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [RFC PATCH] sched/wait: Introduce new, more compact wait_event*() primitives
  2017-03-08 16:37       ` [RFC PATCH] " Linus Torvalds
@ 2017-03-08 17:16         ` Ingo Molnar
  0 siblings, 0 replies; 14+ messages in thread
From: Ingo Molnar @ 2017-03-08 17:16 UTC (permalink / raw)
  To: Linus Torvalds
  Cc: Linux Kernel Mailing List, Peter Zijlstra, Thomas Gleixner,
	Andrew Morton


* Linus Torvalds <torvalds@linux-foundation.org> wrote:

> On Wed, Mar 8, 2017 at 12:37 AM, Ingo Molnar <mingo@kernel.org> wrote:
> >
> > The idea is to allow call sites to supply the 'condition' function as free-form C
> > code, while pushing everything else into non-macro form: there's a 'struct
> > wait_event_state' on stack, and a state machine. The waiting logic is converted
> > from procedural form to a state machine, because we have to call out into the
> > 'condition' code in different circumstances.
> 
> Ok, I think the concept is fine, but you don't actually fix the
> problem with the locked version that needs to unlock (with irq
> versions etc) around the schedule.

Indeed it doesn't, yet.

> And using "bool" in a struct is disgusting and wrong, and hides the
> fact that the compiler will just turn it into "char" (or even "int"
> for platforms where "char'" is slow, like alpha).
> 
> So it would be better with a "state" variable that just has fields, I suspect.
> 
> .. and as mentioned, it doesn't actually fix the case that hit the
> signal_pending() problem.
> 
> Honestly, I think my "pass in a waiter function" model was both less
> subtle and indirect, and more generic.

True!

> And we can actually *fix* the problem with it for 4.11, instead of
> adding the stupid header file includes.

Ok - I'm perfectly fine with your patch too, if you think it's v4.11 material!

Thanks,

	Ingo

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [GIT PULL] sched.h split-up
  2017-03-08  0:04     ` Linus Torvalds
@ 2017-03-08 17:24       ` Ingo Molnar
  0 siblings, 0 replies; 14+ messages in thread
From: Ingo Molnar @ 2017-03-08 17:24 UTC (permalink / raw)
  To: Linus Torvalds
  Cc: Linux Kernel Mailing List, Peter Zijlstra, Thomas Gleixner,
	Andrew Morton


* Linus Torvalds <torvalds@linux-foundation.org> wrote:

> On Tue, Mar 7, 2017 at 3:33 PM, Linus Torvalds
> <torvalds@linux-foundation.org> wrote:
> >
> > But as mentioned - this is untested. It seems to build, and it looks
> > "ObviouslyCorrect(tm)", but I didn't actually try to boot it.
> 
> Well, it boots, but it's not like there are all that many users of the
> wait_event_interruptible*_locked*() interfaces, so it's dubious that I
> actually exercised the changes all that much (if at all).
> 
> Of course, that's just more reason to *not* have it be some big macro
> expansion in a header file that requires other includes. Basically,
> this interface isn't worth the header inclusion pain.
> 
> And no, I didn't try to see how many
> 
>    #include <linux/sched/signal.h>
> 
> I could try to remove with this.
> 
> But I *did* verify that I could now build that fs/overlayfs/util.c
> file with that #include removed.
> 
> That's the case that caused a semantic merge issue for me - but I
> don't know how many others Ingo added as part of the split-up.

I suspect wait_event_hrtimeout*() has a similar conceptual problem with 
linux/hrtimer.h, because it uses hrtimer APIs but doesn't include the header - but 
fortunately that API variant does not appear to be used much at the moment: only 
fs/aio.c uses wait_event_interruptible_hrtimeout(), but it includes sched.h which 
includes hrtimer.h.

So Ack on your patch.

Also, to be honest I'm also not looking forward to converting 20+ wait_event*() 
macros to a fragile state machine, so I wouldn't mind it if your patch was the 
final solution to this problem! ;-)

Thanks,

	Ingo

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [RFC PATCH, -v2] sched/wait: Introduce new, more compact wait_event*() primitives
  2017-03-08 12:10       ` [RFC PATCH, -v2] " Ingo Molnar
@ 2017-03-09 16:25         ` Peter Zijlstra
  0 siblings, 0 replies; 14+ messages in thread
From: Peter Zijlstra @ 2017-03-09 16:25 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: Linus Torvalds, Linux Kernel Mailing List, Thomas Gleixner,
	Andrew Morton


Here; I rewrote that so that my brain doesn't go wtf, every time I look
at it ;-)

Hope it does the same for you.


---
 include/linux/wait.h |  31 +++++++++---
 kernel/sched/wait.c  | 140 +++++++++++++++++++++++++++++++++++++--------------
 2 files changed, 127 insertions(+), 44 deletions(-)

diff --git a/include/linux/wait.h b/include/linux/wait.h
index a3151fa..aeed498 100644
--- a/include/linux/wait.h
+++ b/include/linux/wait.h
@@ -234,19 +234,38 @@ struct wait_event_state {
 	struct wait_queue_entry		wq_entry;
 };
 
-extern long wait_event_loop(struct wait_queue_head *wq_head, struct wait_event_state *wes, int condition);
+enum WE_STATE
+{
+	WE_START = 0,
+	WE_FIRST_COND,
+	WE_INIT,
+	WE_PREPARE,
+	WE_COND,
+	WE_SIGNAL,
+	WE_CMD,
+	WE_FINISH,
+	WE_DONE,
+};
+
+struct we_state {
+	int			state;
+	long			interrupted;
+	struct wait_queue_entry entry;
+};
+
+
+extern long wait_event_loop(struct wait_queue_head *wq_head, struct we_state *wes, bool condition);
 
 #define wait_event_v2(wq_head, condition)					\
 ({										\
-	struct wait_event_state __wes;						\
+	struct we_state __wes;							\
 	long __ret;								\
 										\
-	might_sleep();								\
-	__wes.queued = 0;							\
+	__wes.state = WE_START;							\
 										\
 	do {									\
-		__ret = wait_event_loop(&(wq_head), &__wes, (condition) != 0);	\
-	} while (!__wes.done);							\
+		__ret = wait_event_loop(&(wq_head), &__wes, !!(condition));	\
+	} while (__wes.state != WE_DONE);					\
 										\
 	__ret;									\
 })
diff --git a/kernel/sched/wait.c b/kernel/sched/wait.c
index 58a8335..04d32d0 100644
--- a/kernel/sched/wait.c
+++ b/kernel/sched/wait.c
@@ -292,59 +292,123 @@ static inline bool is_kthread_should_stop(void)
 	return (current->flags & PF_KTHREAD) && kthread_should_stop();
 }
 
+
 /*
- * The main wait_event*() event loop iteration state machine.
  *
- * Note that this function itself does not loop, it returns to
- * the caller to evaluate the call site dependent condition in
- * every iteration.
+ *  #define ___wait_event(wq_head, condition, state, exclusive, ret, cmd)
+ *  ({
+ *          __label__ __out;
+ *          struct wait_queue_entry __wq_entry;
+ *          long __ret = ret;	// explicit shadow
+ *
+ *          init_wait_entry(&__wq_entry, exclusive ? WQ_FLAG_EXCLUSIVE : 0);
+ *          for (;;) {
+ *		    long __int = prepare_to_wait_event(&wq_head, &__wq_entry, state);
+ *
+ *		    if (condition)
+ *			    break;
+ *
+ *		    if (___wait_is_interruptible(state) && __int) {
+ *			    __ret = __int;
+ *			    goto __out;
+ *		    }
+ *
+ *		    cmd;
+ *          }
+ *          finish_wait(&wq_head, &__wq_entry);
+ *  __out:	__ret;
+ *  })
+ *
+ *
+ *
+ * do {
+ *   ret = __wait_event_loop(wq, &state, !!(cond));
+ *   if (state == WE_CMD)
+ *     cmd;
+ * } while (state != WE_DONE);
+ *
+ * return ret;
+ *
  */
-long wait_event_loop(struct wait_queue_head *wq_head, struct wait_event_state *wes, int condition)
+static __always_inline long
+__wait_event_loop(struct wait_queue_head *wq_head, struct we_state *wes,
+		  bool condition, const unsigned int task_state,
+		  const bool exclusive)
 {
-	if (!wes->queued) {
-		/*
-		 * If we are not initialized yet and the condition is already
-		 * met, we can return immediately:
-		 */
-		if (condition) {
-			wes->done = 1;
-			return 0;
-		}
+	long ret = 0;
 
-		/* Set up the wait-queue entry: */
-		init_wait_entry(&wes->wq_entry, 0);
+	switch(wes->state) {
+	case WE_START:
+		might_sleep();
+		wes->state = WE_FIRST_COND;
+		/* Fall through */
 
-		wes->done = 0;
-		wes->queued = 1;
-		wes->prepared = 0;
-		wes->ret = 0;
-	} else {
-		/* Here is where we notice an updated wait condition: */
+	case WE_FIRST_COND:
 		if (condition) {
-			finish_wait(wq_head, &wes->wq_entry);
-			wes->done = 1;
-			return 0;
+			wes->state = WE_DONE;
+			break;
 		}
-	}
+		wes->state = WE_INIT;
+		/* Fall through */
+
+	case WE_INIT:
+		init_wait_entry(&wes->entry, exclusive ? WQ_FLAG_EXCLUSIVE : 0);
+		wes->state = WE_PREPARE;
+		/* Fall through */
+
+	case WE_PREPARE:
+prepare:
+		wes->interrupted = prepare_to_wait_event(wq_head, &wes->entry, task_state);
+		wes->state = WE_COND;
+		/* we need a fresh @cond eval */
+		break;
+
+	case WE_COND:
+		if (condition) {
+			wes->state = WE_FINISH;
+			goto finish;
+		}
+		wes->state = WE_SIGNAL;
+		/* Fall through */
+
+	case WE_SIGNAL:
+		if (___wait_is_interruptible(task_state) && wes->interrupted) {
+			wes->state = WE_DONE;
+			ret = wes->interrupted;
+			break;
+		}
+		wes->state = WE_CMD;
+		/* we need it to go sleep */
+		break;
+
+	case WE_CMD:
+		goto prepare;
 
-	if (!wes->prepared) {
-prepare_again:
-		wes->ret = prepare_to_wait_event(wq_head, &wes->wq_entry, 0);
-		wes->prepared = 1;
+	case WE_FINISH:
+finish:
+		finish_wait(wq_head, &wes->entry);
+		wes->state = WE_DONE;
+		break;
 
-		return 0;
+	case WE_DONE:
+		BUG();
 	}
 
-	if (___wait_is_interruptible(0) && wes->ret) {
-		/* We already got dequeued, so mark it done: */
-		wes->done = 1;
+	return ret;
+}
 
-		/* But return any eventual interruption code: */
-		return wes->ret;
+long wait_event_loop(struct wait_queue_head *wq_head, struct we_state *wes, bool condition)
+{
+	long ret;
+
+again:
+	ret = __wait_event_loop(wq_head, wes, condition, TASK_UNINTERRUPTIBLE, false);
+	if (wes->state == WE_CMD) {
+		schedule();
+		goto again;
 	}
 
-	schedule();
-	goto prepare_again;
+	return ret;
 }
 EXPORT_SYMBOL_GPL(wait_event_loop);
 

^ permalink raw reply related	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2017-03-09 16:25 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-03  1:36 [GIT PULL] sched.h split-up Ingo Molnar
2017-03-03 20:13 ` Linus Torvalds
2017-03-04  7:30   ` Ingo Molnar
2017-03-07 23:33   ` Linus Torvalds
2017-03-08  0:04     ` Linus Torvalds
2017-03-08 17:24       ` Ingo Molnar
2017-03-08  8:37     ` [RFC PATCH] sched/wait: Introduce new, more compact wait_event*() primitives Ingo Molnar
2017-03-08  9:17       ` [RFC PATCH] sched/wait: Add <linux/sched/signal.h> dependency for now Ingo Molnar
2017-03-08 10:11         ` [PATCH -v2] " Ingo Molnar
2017-03-08 11:55       ` [RFC PATCH] sched/wait: Introduce new, more compact wait_event*() primitives Ingo Molnar
2017-03-08 12:10       ` [RFC PATCH, -v2] " Ingo Molnar
2017-03-09 16:25         ` Peter Zijlstra
2017-03-08 16:37       ` [RFC PATCH] " Linus Torvalds
2017-03-08 17:16         ` Ingo Molnar

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.