1. 17 7月, 2007 1 次提交
  2. 24 5月, 2007 1 次提交
    • O
      simplify cleanup_workqueue_thread() · 14441960
      Oleg Nesterov 提交于
      cleanup_workqueue_thread() and cwq_should_stop() are overcomplicated.
      
      Convert the code to use kthread_should_stop/kthread_stop as was
      suggested by Gautham and Srivatsa.
      
      In particular this patch removes the (unlikely) busy-wait loop from the
      exit path, it was a temporary and ugly kludge (if not a bug).
      
      Note: the current code was designed to solve another old problem:
      work->func can't share locks with hotplug callbacks.  I think this could
      be done, see
      
      	http://marc.info/?l=linux-kernel&m=116905366428633
      
      but this needs some more complications to preserve CPU affinity of
      cwq->thread during cpu_up().  A freezer-based hotplug looks more
      appealing.
      
      [akpm@linux-foundation.org: make it more tolerant of gcc borkenness]
      Signed-off-by: NOleg Nesterov <oleg@tv-sign.ru>
      Cc: Zilvinas Valinskas <zilvinas@wilibox.com>
      Cc: Gautham R Shenoy <ego@in.ibm.com>
      Cc: Srivatsa Vaddagiri <vatsa@in.ibm.com>
      Cc: "Rafael J. Wysocki" <rjw@sisk.pl>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      14441960
  3. 10 5月, 2007 27 次提交
  4. 17 2月, 2007 1 次提交
    • I
      [PATCH] Add debugging feature /proc/timer_stat · 82f67cd9
      Ingo Molnar 提交于
      Add /proc/timer_stats support: debugging feature to profile timer expiration.
      Both the starting site, process/PID and the expiration function is captured.
      This allows the quick identification of timer event sources in a system.
      
      Sample output:
      
      # echo 1 > /proc/timer_stats
      # cat /proc/timer_stats
      Timer Stats Version: v0.1
      Sample period: 4.010 s
        24,     0 swapper          hrtimer_stop_sched_tick (hrtimer_sched_tick)
        11,     0 swapper          sk_reset_timer (tcp_delack_timer)
         6,     0 swapper          hrtimer_stop_sched_tick (hrtimer_sched_tick)
         2,     1 swapper          queue_delayed_work_on (delayed_work_timer_fn)
        17,     0 swapper          hrtimer_restart_sched_tick (hrtimer_sched_tick)
         2,     1 swapper          queue_delayed_work_on (delayed_work_timer_fn)
         4,  2050 pcscd            do_nanosleep (hrtimer_wakeup)
         5,  4179 sshd             sk_reset_timer (tcp_write_timer)
         4,  2248 yum-updatesd     schedule_timeout (process_timeout)
        18,     0 swapper          hrtimer_restart_sched_tick (hrtimer_sched_tick)
         3,     0 swapper          sk_reset_timer (tcp_delack_timer)
         1,     1 swapper          neigh_table_init_no_netlink (neigh_periodic_timer)
         2,     1 swapper          e1000_up (e1000_watchdog)
         1,     1 init             schedule_timeout (process_timeout)
      100 total events, 25.24 events/sec
      
      [ cleanups and hrtimers support from Thomas Gleixner <tglx@linutronix.de> ]
      [bunk@stusta.de: nr_entries can become static]
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
      Cc: john stultz <johnstul@us.ibm.com>
      Cc: Roman Zippel <zippel@linux-m68k.org>
      Cc: Andi Kleen <ak@suse.de>
      Signed-off-by: NAdrian Bunk <bunk@stusta.de>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      82f67cd9
  5. 12 2月, 2007 1 次提交
  6. 23 12月, 2006 1 次提交
  7. 21 12月, 2006 1 次提交
  8. 17 12月, 2006 1 次提交
    • L
      Make workqueue bit operations work on "atomic_long_t" · a08727ba
      Linus Torvalds 提交于
      On architectures where the atomicity of the bit operations is handled by
      external means (ie a separate spinlock to protect concurrent accesses),
      just doing a direct assignment on the workqueue data field (as done by
      commit 4594bf15) can cause the
      assignment to be lost due to lack of serialization with the bitops on
      the same word.
      
      So we need to serialize the assignment with the locks on those
      architectures (notably older ARM chips, PA-RISC and sparc32).
      
      So rather than using an "unsigned long", let's use "atomic_long_t",
      which already has a safe assignment operation (atomic_long_set()) on
      such architectures.
      
      This requires that the atomic operations use the same atomicity locks as
      the bit operations do, but that is largely the case anyway.  Sparc32
      will probably need fixing.
      
      Architectures (including modern ARM with LL/SC) that implement sane
      atomic operations for SMP won't see any of this matter.
      
      Cc: Russell King <rmk+lkml@arm.linux.org.uk>
      Cc: David Howells <dhowells@redhat.com>
      Cc: David Miller <davem@davemloft.com>
      Cc: Matthew Wilcox <matthew@wil.cx>
      Cc: Linux Arch Maintainers <linux-arch@vger.kernel.org>
      Cc: Andrew Morton <akpm@osdl.org>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      a08727ba
  9. 10 12月, 2006 1 次提交
    • D
      [PATCH] WorkStruct: Use direct assignment rather than cmpxchg() · 4594bf15
      David Howells 提交于
      Use direct assignment rather than cmpxchg() as the latter is unavailable
      and unimplementable on some platforms and is actually unnecessary.
      
      The use of cmpxchg() was to guard against two possibilities, neither of
      which can actually occur:
      
       (1) The pending flag may have been unset or may be cleared.  However, given
           where it's called, the pending flag is _always_ set.  I don't think it
           can be unset whilst we're in set_wq_data().
      
           Once the work is enqueued to be actually run, the only way off the queue
           is for it to be actually run.
      
           If it's a delayed work item, then the bit can't be cleared by the timer
           because we haven't started the timer yet.  Also, the pending bit can't be
           cleared by cancelling the delayed work _until_ the work item has had its
           timer started.
      
       (2) The workqueue pointer might change.  This can only happen in two cases:
      
           (a) The work item has just been queued to actually run, and so we're
               protected by the appropriate workqueue spinlock.
      
           (b) A delayed work item is being queued, and so the timer hasn't been
           	 started yet, and so no one else knows about the work item or can
           	 access it (the pending bit protects us).
      
           Besides, set_wq_data() _sets_ the workqueue pointer unconditionally, so
           it can be assigned instead.
      
      So, replacing the set_wq_data() with a straight assignment would be okay
      in most cases.
      
      The problem is where we end up tangling with test_and_set_bit() emulated
      using spinlocks, and even then it's not a problem _provided_
      test_and_set_bit() doesn't attempt to modify the word if the bit was
      set.
      
      If that's a problem, then a bitops-proofed assignment will be required -
      equivalent to atomic_set() vs other atomic_xxx() ops.
      Signed-off-by: NDavid Howells <dhowells@redhat.com>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      4594bf15
  10. 08 12月, 2006 4 次提交
  11. 22 11月, 2006 1 次提交
    • D
      WorkStruct: Pass the work_struct pointer instead of context data · 65f27f38
      David Howells 提交于
      Pass the work_struct pointer to the work function rather than context data.
      The work function can use container_of() to work out the data.
      
      For the cases where the container of the work_struct may go away the moment the
      pending bit is cleared, it is made possible to defer the release of the
      structure by deferring the clearing of the pending bit.
      
      To make this work, an extra flag is introduced into the management side of the
      work_struct.  This governs auto-release of the structure upon execution.
      
      Ordinarily, the work queue executor would release the work_struct for further
      scheduling or deallocation by clearing the pending bit prior to jumping to the
      work function.  This means that, unless the driver makes some guarantee itself
      that the work_struct won't go away, the work function may not access anything
      else in the work_struct or its container lest they be deallocated..  This is a
      problem if the auxiliary data is taken away (as done by the last patch).
      
      However, if the pending bit is *not* cleared before jumping to the work
      function, then the work function *may* access the work_struct and its container
      with no problems.  But then the work function must itself release the
      work_struct by calling work_release().
      
      In most cases, automatic release is fine, so this is the default.  Special
      initiators exist for the non-auto-release case (ending in _NAR).
      Signed-Off-By: NDavid Howells <dhowells@redhat.com>
      65f27f38