1. 17 Nov, 2011 1 commit
    • Steven Rostedt's avatar
      tracing: Add irq, preempt-count and need resched info to default trace output · 77271ce4
      Steven Rostedt authored
      People keep asking how to get the preempt count, irq, and need resched info
      and we keep telling them to enable the latency format. Some developers think
      that traces without this info is completely useless, and for a lot of tasks
      it is useless.
      The first option was to enable the latency trace as the default format, but
      the header for the latency format is pretty useless for most tracers and
      it also does the timestamp in straight microseconds from the time the trace
      started. This is sometimes more difficult to read as the default trace is
      seconds from the start of boot up.
      Latency format:
       # tracer: nop
       # nop latency trace v1.1.5 on 3.2.0-rc1-test+
       # --------------------------------------------------------------------
       # latency: 0 us, #159771/64234230, CPU#1 | (M:preempt VP:0, KP:0, SP:0 HP:0 #P:4)
       #    -----------------
       #    | task: -0 (uid:0 nice:0 policy:0 rt_prio:0)
       #    -----------------
       #                  _------=> CPU#
       #                 / _-----=> irqs-off
       #                | / _----=> need-resched
       #                || / _---=> hardirq/softirq
       #                ||| / _--=> preempt-depth
       #                |||| /     delay
       #  cmd     pid   ||||| time  |   caller
       #     \   /      |||||  \    |   /
       migratio-6       0...2 41778231us+: rcu_note_context_switch <-__schedule
       migratio-6       0...2 41778233us : trace_rcu_utilization <-rcu_note_context_switch
       migratio-6       0...2 41778235us+: rcu_sched_qs <-rcu_note_context_switch
       migratio-6       0d..2 41778236us+: rcu_preempt_qs <-rcu_note_context_switch
       migratio-6       0...2 41778238us : trace_rcu_utilization <-rcu_note_context_switch
       migratio-6       0...2 41778239us+: debug_lockdep_rcu_enabled <-__schedule
      default format:
       # tracer: nop
       #           TASK-PID    CPU#    TIMESTAMP  FUNCTION
       #              | |       |          |         |
            migration/0-6     [000]    50.025810: rcu_note_context_switch <-__schedule
            migration/0-6     [000]    50.025812: trace_rcu_utilization <-rcu_note_context_switch
            migration/0-6     [000]    50.025813: rcu_sched_qs <-rcu_note_context_switch
            migration/0-6     [000]    50.025815: rcu_preempt_qs <-rcu_note_context_switch
            migration/0-6     [000]    50.025817: trace_rcu_utilization <-rcu_note_context_switch
            migration/0-6     [000]    50.025818: debug_lockdep_rcu_enabled <-__schedule
            migration/0-6     [000]    50.025820: debug_lockdep_rcu_enabled <-__schedule
      The latency format header has latency information that is pretty meaningless
      for most tracers. Although some of the header is useful, and we can add that
      later to the default format as well.
      What is really useful with the latency format is the irqs-off, need-resched
      hard/softirq context and the preempt count.
      This commit adds the option irq-info which is on by default that adds this
       # tracer: nop
       #                              _-----=> irqs-off
       #                             / _----=> need-resched
       #                            | / _---=> hardirq/softirq
       #                            || / _--=> preempt-depth
       #                            ||| /     delay
       #           TASK-PID   CPU#  ||||    TIMESTAMP  FUNCTION
       #              | |       |   ||||       |         |
                 <idle>-0     [000] d..2    49.309305: cpuidle_get_driver <-cpuidle_idle_call
                 <idle>-0     [000] d..2    49.309307: mwait_idle <-cpu_idle
                 <idle>-0     [000] d..2    49.309309: need_resched <-mwait_idle
                 <idle>-0     [000] d..2    49.309310: test_ti_thread_flag <-need_resched
                 <idle>-0     [000] d..2    49.309312: trace_power_start.constprop.13 <-mwait_idle
                 <idle>-0     [000] d..2    49.309313: trace_cpu_idle <-mwait_idle
                 <idle>-0     [000] d..2    49.309315: need_resched <-mwait_idle
      If a user wants the old format, they can disable the 'irq-info' option:
       # tracer: nop
       #           TASK-PID   CPU#      TIMESTAMP  FUNCTION
       #              | |       |          |         |
                 <idle>-0     [000]     49.309305: cpuidle_get_driver <-cpuidle_idle_call
                 <idle>-0     [000]     49.309307: mwait_idle <-cpu_idle
                 <idle>-0     [000]     49.309309: need_resched <-mwait_idle
                 <idle>-0     [000]     49.309310: test_ti_thread_flag <-need_resched
                 <idle>-0     [000]     49.309312: trace_power_start.constprop.13 <-mwait_idle
                 <idle>-0     [000]     49.309313: trace_cpu_idle <-mwait_idle
                 <idle>-0     [000]     49.309315: need_resched <-mwait_idle
      Requested-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Signed-off-by: default avatarSteven Rostedt <rostedt@goodmis.org>
  2. 14 Nov, 2011 2 commits
  3. 07 Nov, 2011 6 commits
    • Dominik Brodowski's avatar
      PM / QoS: Set cpu_dma_pm_qos->name · a6f05b97
      Dominik Brodowski authored
      Since commit 4a31a334
      , the name of this misc device is not initialized,
      which leads to a funny device named /dev/(null) being created and
      /proc/misc containing an entry with just a number but no name. The latter
      leads to complaints by cryptsetup, which caused me to investigate this
      Signed-off-by: default avatarDominik Brodowski <linux@dominikbrodowski.net>
      Signed-off-by: default avatarRafael J. Wysocki <rjw@sisk.pl>
    • Jiri Olsa's avatar
      tracing/latency: Fix header output for latency tracers · 7e9a49ef
      Jiri Olsa authored
      In case the the graph tracer (CONFIG_FUNCTION_GRAPH_TRACER) or even the
      function tracer (CONFIG_FUNCTION_TRACER) are not set, the latency tracers
      do not display proper latency header.
      The involved/fixed latency tracers are:
      The patch adds proper handling of tracer configuration options for latency
      tracers, and displaying correct header info accordingly.
      * The current output (for wakeup tracer) with both graph and function
        tracers disabled is:
        # tracer: wakeup
          <idle>-0       0d.h5    1us+:      0:120:R   + [000]     7:  0:R watchdog/0
          <idle>-0       0d.h5    3us+: ttwu_do_activate.clone.1 <-try_to_wake_up
      * The fixed output is:
        # tracer: wakeup
        # wakeup latency trace v1.1.5 on 3.1.0-tip+
        # --------------------------------------------------------------------
        # latency: 55 us, #4/4, CPU#0 | (M:preempt VP:0, KP:0, SP:0 HP:0 #P:2)
        #    -----------------
        #    | task: migration/0-6 (uid:0 nice:0 policy:1 rt_prio:99)
        #    -----------------
        #                  _------=> CPU#
        #                 / _-----=> irqs-off
        #                | / _----=> need-resched
        #                || / _---=> hardirq/softirq
        #                ||| / _--=> preempt-depth
        #                |||| /     delay
        #  cmd     pid   ||||| time  |   caller
        #     \   /      |||||  \    |   /
             cat-1129    0d..4    1us :   1129:120:R   + [000]     6:  0:R migration/0
             cat-1129    0d..4    2us+: ttwu_do_activate.clone.1 <-try_to_wake_up
      * The current output (for wakeup tracer) with only function
        tracer enabled is:
        # tracer: wakeup
             cat-1140    0d..4    1us+:   1140:120:R   + [000]     6:  0:R migration/0
             cat-1140    0d..4    2us : ttwu_do_activate.clone.1 <-try_to_wake_up
      * The fixed output is:
        # tracer: wakeup
        # wakeup latency trace v1.1.5 on 3.1.0-tip+
        # --------------------------------------------------------------------
        # latency: 207 us, #109/109, CPU#1 | (M:preempt VP:0, KP:0, SP:0 HP:0 #P:2)
        #    -----------------
        #    | task: watchdog/1-12 (uid:0 nice:0 policy:1 rt_prio:99)
        #    -----------------
        #                  _------=> CPU#
        #                 / _-----=> irqs-off
        #                | / _----=> need-resched
        #                || / _---=> hardirq/softirq
        #                ||| / _--=> preempt-depth
        #                |||| /     delay
        #  cmd     pid   ||||| time  |   caller
        #     \   /      |||||  \    |   /
          <idle>-0       1d.h5    1us+:      0:120:R   + [001]    12:  0:R watchdog/1
          <idle>-0       1d.h5    3us : ttwu_do_activate.clone.1 <-try_to_wake_up
      Link: http://lkml.kernel.org/r/20111107150849.GE1807@m.brq.redhat.com
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Signed-off-by: default avatarJiri Olsa <jolsa@redhat.com>
      Signed-off-by: default avatarSteven Rostedt <rostedt@goodmis.org>
    • Steven Rostedt's avatar
      ftrace: Fix hash record accounting bug · d4d34b98
      Steven Rostedt authored
      If the set_ftrace_filter is cleared by writing just whitespace to
      it, then the filter hash refcounts will be decremented but not
      updated. This causes two bugs:
      1) No functions will be enabled for tracing when they all should be
      2) If the users clears the set_ftrace_filter twice, it will crash ftrace:
      ------------[ cut here ]------------
      WARNING: at /home/rostedt/work/git/linux-trace.git/kernel/trace/ftrace.c:1384 __ftrace_hash_rec_update.part.27+0x157/0x1a7()
      Modules linked in:
      Pid: 2330, comm: bash Not tainted 3.1.0-test+ #32
      Call Trace:
       [<ffffffff81051828>] warn_slowpath_common+0x83/0x9b
       [<ffffffff8105185a>] warn_slowpath_null+0x1a/0x1c
       [<ffffffff810ba362>] __ftrace_hash_rec_update.part.27+0x157/0x1a7
       [<ffffffff810ba6e8>] ? ftrace_regex_release+0xa7/0x10f
       [<ffffffff8111bdfe>] ? kfree+0xe5/0x115
       [<ffffffff810ba51e>] ftrace_hash_move+0x2e/0x151
       [<ffffffff810ba6fb>] ftrace_regex_release+0xba/0x10f
       [<ffffffff8112e49a>] fput+0xfd/0x1c2
       [<ffffffff8112b54c>] filp_close+0x6d/0x78
       [<ffffffff8113a92d>] sys_dup3+0x197/0x1c1
       [<ffffffff8113a9a6>] sys_dup2+0x4f/0x54
       [<ffffffff8150cac2>] system_call_fastpath+0x16/0x1b
      ---[ end trace 77a3a7ee73794a02 ]---
      Link: http://lkml.kernel.org/r/20111101141420.GA4918@debian
      Reported-by: default avatarRabin Vincent <rabin@rab.in>
      Signed-off-by: default avatarSteven Rostedt <rostedt@goodmis.org>
    • Gleb Natapov's avatar
      jump_label: jump_label_inc may return before the code is patched · c8452afb
      Gleb Natapov authored
      If cpu A calls jump_label_inc() just after atomic_add_return() is
      called by cpu B, atomic_inc_not_zero() will return value greater then
      zero and jump_label_inc() will return to a caller before jump_label_update()
      finishes its job on cpu B.
      Link: http://lkml.kernel.org/r/20111018175551.GH17571@redhat.com
      Cc: stable@vger.kernel.org
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Acked-by: default avatarJason Baron <jbaron@redhat.com>
      Signed-off-by: default avatarGleb Natapov <gleb@redhat.com>
      Signed-off-by: default avatarSteven Rostedt <rostedt@goodmis.org>
    • Steven Rostedt's avatar
      ftrace: Remove force undef config value left for testing · 8ee3c92b
      Steven Rostedt authored
      A forced undef of a config value was used for testing and was
      accidently left in during the final commit. This causes x86 to
      run slower than needed while running function tracing as well
      as causes the function graph selftest to fail when DYNMAIC_FTRACE
      is not set. This is because the code in MCOUNT expects the ftrace
      code to be processed with the config value set that happened to
      be forced not set.
      The forced config option was left in by:
          commit 6331c28c
          ftrace: Fix dynamic selftest failure on some archs
      Link: http://lkml.kernel.org/r/20111102150255.GA6973@debian
      Cc: stable@vger.kernel.org
      Reported-by: default avatarRabin Vincent <rabin@rab.in>
      Signed-off-by: default avatarSteven Rostedt <rostedt@goodmis.org>
    • Steven Rostedt's avatar
      lockdep: Show subclass in pretty print of lockdep output · e5e78d08
      Steven Rostedt authored
      The pretty print of the lockdep debug splat uses just the lock name
      to show how the locking scenario happens. But when it comes to
      nesting locks, the output becomes confusing which takes away the point
      of the pretty printing of the lock scenario.
      Without displaying the subclass info, we get the following output:
        Possible unsafe locking scenario:
              CPU0                    CPU1
              ----                    ----
        *** DEADLOCK ***
      The above looks more of a A->A locking bug than a A->B B->A.
      By adding the subclass to the output, we can see what really happened:
       other info that might help us debug this:
        Possible unsafe locking scenario:
              CPU0                    CPU1
              ----                    ----
        *** DEADLOCK ***
      This bug was discovered while tracking down a real bug caught by lockdep.
      Link: http://lkml.kernel.org/r/20111025202049.GB25043@hostway.ca
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Reported-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Tested-by: default avatarSimon Kirby <sim@hostway.ca>
      Signed-off-by: default avatarSteven Rostedt <rostedt@goodmis.org>
  4. 06 Nov, 2011 2 commits
  5. 05 Nov, 2011 1 commit
    • Steven Rostedt's avatar
      tracing: Add boiler plate for subsystem filter · 49aa2951
      Steven Rostedt authored
      The system filter can be used to set multiple event filters that
      exist within the system. But currently it displays the last filter
      written that does not necessarily correspond to the filters within
      the system. The system filter itself is not used to filter any events.
      The system filter is just a means to set filters of the events within
      Because this causes an ambiguous state when the system filter reads
      a filter string but the events within the system have different strings
      it is best to just show a boiler plate:
       ### global filter ###
       # Use this to set filters for multiple events.
       # Only events with the given fields will be affected.
       # If no events are modified, an error message will be displayed here.
      If an error occurs while writing to the system filter, the system
      filter will replace the boiler plate with the error message as it
      currently does.
      Signed-off-by: default avatarSteven Rostedt <rostedt@goodmis.org>
  6. 04 Nov, 2011 3 commits
    • Tejun Heo's avatar
      PM / Freezer: Revert 27920651 "PM / Freezer: Make fake_signal_wake_up() wake... · d6cc7685
      Tejun Heo authored
      PM / Freezer: Revert 27920651 "PM / Freezer: Make fake_signal_wake_up() wake TASK_KILLABLE tasks too"
      Commit 27920651
       "PM / Freezer: Make fake_signal_wake_up() wake
      TASK_KILLABLE tasks too" updated fake_signal_wake_up() used by freezer
      to wake up KILLABLE tasks.  Sending unsolicited wakeups to tasks in
      killable sleep is dangerous as there are code paths which depend on
      tasks not waking up spuriously from KILLABLE sleep.
      For example. sys_read() or page can sleep in TASK_KILLABLE assuming
      that wait/down/whatever _killable can only fail if we can not return
      to the usermode.  TASK_TRACED is another obvious example.
      The previous patch updated wait_event_freezekillable() such that it
      doesn't depend on the spurious wakeup.  This patch reverts the
      offending commit.
      Note that the spurious KILLABLE wakeup had other implicit effects in
      KILLABLE sleeps in nfs and cifs and those will need further updates to
      regain freezekillable behavior.
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      Signed-off-by: default avatarRafael J. Wysocki <rjw@sisk.pl>
    • Guennadi Liakhovetski's avatar
      PM / QoS: Remove redundant check · 6513fd69
      Guennadi Liakhovetski authored
      Remove an "if" check, that repeats an equivalent one 6 lines above.
      Signed-off-by: default avatarGuennadi Liakhovetski <g.liakhovetski@gmx.de>
      Signed-off-by: default avatarRafael J. Wysocki <rjw@sisk.pl>
    • Srivatsa S. Bhat's avatar
      PM / Sleep: Fix race between CPU hotplug and freezer · 79cfbdfa
      Srivatsa S. Bhat authored
      The CPU hotplug notifications sent out by the _cpu_up() and _cpu_down()
      functions depend on the value of the 'tasks_frozen' argument passed to them
      (which indicates whether tasks have been frozen or not).
      (Examples for such CPU hotplug notifications: CPU_ONLINE, CPU_ONLINE_FROZEN,
      Thus, it is essential that while the callbacks for those notifications are
      running, the state of the system with respect to the tasks being frozen or
      not remains unchanged, *throughout that duration*. Hence there is a need for
      synchronizing the CPU hotplug code with the freezer subsystem.
      Since the freezer is involved only in the Suspend/Hibernate call paths, this
      patch hooks the CPU hotplug code to the suspend/hibernate notifiers
      the race between CPU hotplug and freezer, thus ensuring that CPU hotplug
      notifications will always be run with the state of the system really being
      what the notifications indicate, _throughout_ their execution time.
      Signed-off-by: default avatarSrivatsa S. Bhat <srivatsa.bhat@linux.vnet.ibm.com>
      Signed-off-by: default avatarRafael J. Wysocki <rjw@sisk.pl>
  7. 03 Nov, 2011 1 commit
  8. 02 Nov, 2011 6 commits
  9. 01 Nov, 2011 11 commits
    • Andy Shevchenko's avatar
      kgdb: follow rename pack_hex_byte() to hex_byte_pack() · 50e1499f
      Andy Shevchenko authored
      There is no functional change.
      Signed-off-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
      Acked-by: default avatarJesper Nilsson <jesper.nilsson@axis.com>
      Cc: David Howells <dhowells@redhat.com>
      Cc: Koichi Yasutake <yasutake.koichi@jp.panasonic.com>
      Cc: Jason Wessel <jason.wessel@windriver.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
    • William Douglas's avatar
      printk: remove bounds checking for log_prefix · ae29bc92
      William Douglas authored
      Currently log_prefix is testing that the first character of the log level
      and facility is less than '0' and greater than '9' (which is always
      Since the code being updated works because strtoul bombs out (endp isn't
      updated) and 0 is returned anyway just remove the check and don't change
      the behavior of the function.
      Signed-off-by: default avatarWilliam Douglas <william.douglas@intel.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
    • William Douglas's avatar
      printk: fix bounds checking for log_prefix · 48e41899
      William Douglas authored
      Currently log_prefix is testing that the first character of the log level
      and facility is less than '0' and greater than '9' (which is always
      false).  It should be testing to see if the character less than '0' or
      greater than '9' instead.  This patch makes that change.
      The code being changed worked because strtoul bombs out (endp isn't
      updated) and 0 is returned anyway.
      Signed-off-by: default avatarWilliam Douglas <william.douglas@intel.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
    • Yanmin Zhang's avatar
      printk: add console_suspend module parameter · 134620f7
      Yanmin Zhang authored
      We are enabling some power features on medfield.  To test suspend-2-RAM
      conveniently, we need turn on/off console_suspend_enabled frequently.
      Add a module parameter, so users could change it by:
      Signed-off-by: default avatarYanmin Zhang <yanmin_zhang@linux.intel.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
    • Yanmin Zhang's avatar
      printk: add module parameter ignore_loglevel to control ignore_loglevel · 0eca6b7c
      Yanmin Zhang authored
      We are enabling some power features on medfield.  To test suspend-2-RAM
      conveniently, we need turn on/off ignore_loglevel frequently without
      Add a module parameter, so users can change it by:
      Signed-off-by: default avatarYanmin Zhang <yanmin.zhang@intel.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
    • Dan Ballard's avatar
      kernel/sysctl.c: add cap_last_cap to /proc/sys/kernel · 73efc039
      Dan Ballard authored
      Userspace needs to know the highest valid capability of the running
      kernel, which right now cannot reliably be retrieved from the header files
      only.  The fact that this value cannot be determined properly right now
      creates various problems for libraries compiled on newer header files
      which are run on older kernels.  They assume capabilities are available
      which actually aren't.  libcap-ng is one example.  And we ran into the
      same problem with systemd too.
      Now the capability is exported in /proc/sys/kernel/cap_last_cap.
      [akpm@linux-foundation.org: make cap_last_cap const, per Ulrich]
      Signed-off-by: default avatarDan Ballard <dan@mindstab.net>
      Cc: Randy Dunlap <rdunlap@xenotime.net>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Lennart Poettering <lennart@poettering.net>
      Cc: Kay Sievers <kay.sievers@vrfy.org>
      Cc: Ulrich Drepper <drepper@akkadia.org>
      Cc: James Morris <jmorris@namei.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
    • Vasily Averin's avatar
      watchdog: move watchdog_*_all_cpus under CONFIG_SYSCTL · 4ff81951
      Vasily Averin authored
      Fix compilation warnings for CONFIG_SYSCTL=n:
      fixed compilation warnings in case of disabled CONFIG_SYSCTL
      kernel/watchdog.c:483:13: warning: `watchdog_enable_all_cpus' defined but not used
      kernel/watchdog.c:500:13: warning: `watchdog_disable_all_cpus' defined but not used
      these functions are static and are used only in sysctl handler, so move
      them inside #ifdef CONFIG_SYSCTL too
      Signed-off-by: default avatarVasily Averin <vvs@sw.ru>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
    • Jeremy Fitzhardinge's avatar
      stop_machine: make stop_machine safe and efficient to call early · f445027e
      Jeremy Fitzhardinge authored
      Make stop_machine() safe to call early in boot, before SMP has been set
      up, by simply calling the callback function directly if there's only one
      CPU online.
      [ Fixes from AKPM:
         - add comment
         - local_irq_flags, not save_flags
         - also call hard_irq_disable() for systems which need it
        Tejun suggested using an explicit flag rather than just looking at
        the online cpu count. ]
      Cc: Tejun Heo <tj@kernel.org>
      Acked-by: default avatarRusty Russell <rusty@rustcorp.com.au>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: H. Peter Anvin <hpa@linux.intel.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Acked-by: default avatarTejun Heo <htejun@gmail.com>
      Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      Signed-off-by: default avatarJeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
    • Christoph Lameter's avatar
      mm: distinguish between mlocked and pinned pages · bc3e53f6
      Christoph Lameter authored
      Some kernel components pin user space memory (infiniband and perf) (by
      increasing the page count) and account that memory as "mlocked".
      The difference between mlocking and pinning is:
      A. mlocked pages are marked with PG_mlocked and are exempt from
         swapping. Page migration may move them around though.
         They are kept on a special LRU list.
      B. Pinned pages cannot be moved because something needs to
         directly access physical memory. They may not be on any
         LRU list.
      I recently saw an mlockalled process where mm->locked_vm became
      bigger than the virtual size of the process (!) because some
      memory was accounted for twice:
      Once when the page was mlocked and once when the Infiniband
      layer increased the refcount because it needt to pin the RDMA
      This patch introduces a separate counter for pinned pages and
      accounts them seperately.
      Signed-off-by: default avatarChristoph Lameter <cl@linux.com>
      Cc: Mike Marciniszyn <infinipath@qlogic.com>
      Cc: Roland Dreier <roland@kernel.org>
      Cc: Sean Hefty <sean.hefty@intel.com>
      Cc: Hugh Dickins <hughd@google.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
    • David Rientjes's avatar
      oom: remove oom_disable_count · c9f01245
      David Rientjes authored
      This removes mm->oom_disable_count entirely since it's unnecessary and
      currently buggy.  The counter was intended to be per-process but it's
      currently decremented in the exit path for each thread that exits, causing
      it to underflow.
      The count was originally intended to prevent oom killing threads that
      share memory with threads that cannot be killed since it doesn't lead to
      future memory freeing.  The counter could be fixed to represent all
      threads sharing the same mm, but it's better to remove the count since:
       - it is possible that the OOM_DISABLE thread sharing memory with the
         victim is waiting on that thread to exit and will actually cause
         future memory freeing, and
       - there is no guarantee that a thread is disabled from oom killing just
         because another thread sharing its mm is oom disabled.
      Signed-off-by: default avatarDavid Rientjes <rientjes@google.com>
      Reported-by: default avatarOleg Nesterov <oleg@redhat.com>
      Reviewed-by: default avatarOleg Nesterov <oleg@redhat.com>
      Cc: Ying Han <yinghan@google.com>
      Cc: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
    • Christopher Yeoh's avatar
      Cross Memory Attach · fcf63409
      Christopher Yeoh authored
      The basic idea behind cross memory attach is to allow MPI programs doing
      intra-node communication to do a single copy of the message rather than a
      double copy of the message via shared memory.
      The following patch attempts to achieve this by allowing a destination
      process, given an address and size from a source process, to copy memory
      directly from the source process into its own address space via a system
      call.  There is also a symmetrical ability to copy from the current
      process's address space into a destination process's address space.
      - Use of /proc/pid/mem has been considered, but there are issues with
        using it:
        - Does not allow for specifying iovecs for both src and dest, assuming
          preadv or pwritev was implemented either the area read from or
        written to would need to be contiguous.
        - Currently mem_read allows only processes who are currently
        ptrace'ing the target and are still able to ptrace the target to read
        from the target. This check could possibly be moved to the open call,
        but its not clear exactly what race this restriction is stopping
        (reason  appears to have been lost)
        - Having to send the fd of /proc/self/mem via SCM_RIGHTS on unix
        domain socket is a bit ugly from a userspace point of view,
        especially when you may have hundreds if not (eventually) thousands
        of processes  that all need to do this with each other
        - Doesn't allow for some future use of the interface we would like to
        consider adding in the future (see below)
        - Interestingly reading from /proc/pid/mem currently actually
        involves two copies! (But this could be fixed pretty easily)
      As mentioned previously use of vmsplice instead was considered, but has
      problems.  Since you need the reader and writer working co-operatively if
      the pipe is not drained then you block.  Which requires some wrapping to
      do non blocking on the send side or polling on the receive.  In all to all
      communication it requires ordering otherwise you can deadlock.  And in the
      example of many MPI tasks writing to one MPI task vmsplice serialises the
      There are some cases of MPI collectives where even a single copy interface
      does not get us the performance gain we could.  For example in an
      MPI_Reduce rather than copy the data from the source we would like to
      instead use it directly in a mathops (say the reduce is doing a sum) as
      this would save us doing a copy.  We don't need to keep a copy of the data
      from the source.  I haven't implemented this, but I think this interface
      could in the future do all this through the use of the flags - eg could
      specify the math operation and type and the kernel rather than just
      copying the data would apply the specified operation between the source
      and destination and store it in the destination.
      Although we don't have a "second user" of the interface (though I've had
      some nibbles from people who may be interested in using it for intra
      process messaging which is not MPI).  This interface is something which
      hardware vendors are already doing for their custom drivers to implement
      fast local communication.  And so in addition to this being useful for
      OpenMPI it would mean the driver maintainers don't have to fix things up
      when the mm changes.
      There was some discussion about how much faster a true zero copy would
      go. Here's a link back to the email with some testing I did on that:
      There is a basic man page for the proposed interface here:
      This has been implemented for x86 and powerpc, other architecture should
      mainly (I think) just need to add syscall numbers for the process_vm_readv
      and process_vm_writev. There are 32 bit compatibility versions for
      64-bit kernels.
      For arch maintainers there are some simple tests to be able to quickly
      verify that the syscalls are working correctly here:
      Signed-off-by: default avatarChris Yeoh <yeohc@au1.ibm.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: "H. Peter Anvin" <hpa@zytor.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
      Cc: David Howells <dhowells@redhat.com>
      Cc: James Morris <jmorris@namei.org>
      Cc: <linux-man@vger.kernel.org>
      Cc: <linux-arch@vger.kernel.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
  10. 31 Oct, 2011 7 commits
    • Paul Gortmaker's avatar
      irq: don't put module.h into irq.h for tracking irqgen modules. · ec53cf23
      Paul Gortmaker authored
      Recent commit "irq: Track the  owner of irq descriptor" in
      commit ID b6873807 placed module.h into linux/irq.h
      but we are trying to limit module.h inclusion to just C files
      that really need it, due to its size and number of children
      includes.  This targets just reversing that include.
      Add in the basic "struct module" since that is all we really need
      to ensure things compile.  In theory, b6873807 should have added the
      module.h include to the irqdesc.h header as well, but the implicit
      module.h everywhere presence masked this from showing up.  So give
      it the "struct module" as well.
      As for the C files, irqdesc.c is only using THIS_MODULE, so it
      does not need module.h - give it export.h instead.  The C file
      irq/manage.c is now (as of b6873807
      ) using try_module_get and
      module_put and so it needs module.h (which it already has).
      Also convert the irq_alloc_descs variants to macros, since all
      they really do is is call the __irq_alloc_descs primitive.
      This avoids including export.h and no debug info is lost.
      Signed-off-by: default avatarPaul Gortmaker <paul.gortmaker@windriver.com>
    • Paul Gortmaker's avatar
      kernel: Fix files explicitly needing EXPORT_SYMBOL infrastructure · 6e5fdeed
      Paul Gortmaker authored
      These files were getting <linux/module.h> via an implicit non-obvious
      path, but we want to crush those out of existence since they cost
      time during compiles of processing thousands of lines of headers
      for no reason.  Give them the lightweight header that just contains
      the EXPORT_SYMBOL infrastructure.
      Signed-off-by: default avatarPaul Gortmaker <paul.gortmaker@windriver.com>
    • Ilya Dryomov's avatar
      tracing: fix event_subsystem ref counting · d6310975
      Ilya Dryomov authored
      Fix a bug introduced by e9dbfae5
      , which prevents event_subsystem from
      ever being released.
      Ref_count was added to keep track of subsystem users, not for counting
      events.  Subsystem is created with ref_count = 1, so there is no need to
      increment it for every event, we have nr_events for that.  Fix this by
      touching ref_count only when we actually have a new user -
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarIlya Dryomov <idryomov@gmail.com>
      Link: http://lkml.kernel.org/r/1320052062-7846-1-git-send-email-idryomov@gmail.com
      Signed-off-by: default avatarSteven Rostedt <rostedt@goodmis.org>
    • Paul Gortmaker's avatar
      kernel: fix up module header handling in rcutiny files · bdfa97bf
      Paul Gortmaker authored
      The file rcutiny.c does not need moduleparam.h header, as
      there are no modparams in this file.
      However rcutiny_plugin.h does define a module_init() and
      a module_exit() and it uses the various MODULE_ macros, so
      it really does need module.h included.
      Signed-off-by: default avatarPaul Gortmaker <paul.gortmaker@windriver.com>
    • Paul Gortmaker's avatar
      kernel: params.c needs module.h not moduleparam.h · 72a59aaa
      Paul Gortmaker authored
      Through various other implicit include paths, some files were
      getting the full module.h file, and hence living the illusion
      that they really only needed moduleparam.h -- but the reality
      is that once you remove the module.h presence, these show up:
      kernel/params.c:583: warning: ‘struct module_kobject’ declared inside parameter list
      Such files really require module.h so simply make it so.  As the
      file module.h grabs moduleparam.h on the fly, all will be well.
      Signed-off-by: default avatarPaul Gortmaker <paul.gortmaker@windriver.com>
    • Paul Gortmaker's avatar
      kernel: ksysfs.c is implicitly using stat.h · 1596425f
      Paul Gortmaker authored
      With the module.h usage cleanup, we'll get this:
      kernel/ksysfs.c:161: error: ‘S_IRUGO’ undeclared here (not in a function)
      make[2]: *** [kernel/ksysfs.o] Error 1
      Signed-off-by: default avatarPaul Gortmaker <paul.gortmaker@windriver.com>
    • Paul Gortmaker's avatar
      kernel: fix two implicit header assumptions in irq_work.c · 967d1f90
      Paul Gortmaker authored
      Up until now, this file was getting percpu.h because nearly every
      file was implicitly getting module.h (and all its sub-includes).
      But we want to clean that up, so call out percpu.h explicitly.
      Otherwise we'll get things like this on an ARM build:
      kernel/irq_work.c:48: error: expected declaration specifiers or '...' before 'irq_work_list'
      kernel/irq_work.c:48: warning: type defaults to 'int' in declaration of 'DEFINE_PER_CPU'
      The same thing was happening for builds on ARM for asm/processor.h
      kernel/irq_work.c: In function 'irq_work_sync':
      kernel/irq_work.c:166: error: implicit declaration of function 'cpu_relax'
      Signed-off-by: default avatarPaul Gortmaker <paul.gortmaker@windriver.com>