1. 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
  2. 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
  3. 08 12月, 2006 4 次提交
  4. 22 11月, 2006 4 次提交
    • 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
    • D
      WorkStruct: Merge the pending bit into the wq_data pointer · 365970a1
      David Howells 提交于
      Reclaim a word from the size of the work_struct by folding the pending bit and
      the wq_data pointer together.  This shouldn't cause misalignment problems as
      all pointers should be at least 4-byte aligned.
      Signed-Off-By: NDavid Howells <dhowells@redhat.com>
      365970a1
    • D
      WorkStruct: Typedef the work function prototype · 6bb49e59
      David Howells 提交于
      Define a type for the work function prototype.  It's not only kept in the
      work_struct struct, it's also passed as an argument to several functions.
      
      This makes it easier to change it.
      Signed-Off-By: NDavid Howells <dhowells@redhat.com>
      6bb49e59
    • D
      WorkStruct: Separate delayable and non-delayable events. · 52bad64d
      David Howells 提交于
      Separate delayable work items from non-delayable work items be splitting them
      into a separate structure (delayed_work), which incorporates a work_struct and
      the timer_list removed from work_struct.
      
      The work_struct struct is huge, and this limits it's usefulness.  On a 64-bit
      architecture it's nearly 100 bytes in size.  This reduces that by half for the
      non-delayable type of event.
      Signed-Off-By: NDavid Howells <dhowells@redhat.com>
      52bad64d
  5. 29 10月, 2006 1 次提交
  6. 12 10月, 2006 1 次提交
  7. 04 10月, 2006 1 次提交
  8. 15 8月, 2006 1 次提交
  9. 01 8月, 2006 1 次提交
  10. 04 7月, 2006 1 次提交
  11. 30 6月, 2006 2 次提交
  12. 28 6月, 2006 1 次提交
    • C
      [PATCH] cpu hotplug: revert init patch submitted for 2.6.17 · 9c7b216d
      Chandra Seetharaman 提交于
      In 2.6.17, there was a problem with cpu_notifiers and XFS.  I provided a
      band-aid solution to solve that problem.  In the process, i undid all the
      changes you both were making to ensure that these notifiers were available
      only at init time (unless CONFIG_HOTPLUG_CPU is defined).
      
      We deferred the real fix to 2.6.18.  Here is a set of patches that fixes the
      XFS problem cleanly and makes the cpu notifiers available only at init time
      (unless CONFIG_HOTPLUG_CPU is defined).
      
      If CONFIG_HOTPLUG_CPU is defined then cpu notifiers are available at run
      time.
      
      This patch reverts the notifier_call changes made in 2.6.17
      Signed-off-by: NChandra Seetharaman <sekharan@us.ibm.com>
      Cc: Ashok Raj <ashok.raj@intel.com>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      9c7b216d
  13. 26 6月, 2006 2 次提交
  14. 23 6月, 2006 1 次提交
  15. 26 4月, 2006 1 次提交
  16. 28 2月, 2006 1 次提交
    • J
      [SCSI] add execute_in_process_context() API · 1fa44eca
      James Bottomley 提交于
      We have several points in the SCSI stack (primarily for our device
      functions) where we need to guarantee process context, but (given the
      place where the last reference was released) we cannot guarantee this.
      
      This API gets around the issue by executing the function directly if
      the caller has process context, but scheduling a workqueue to execute
      in process context if the caller doesn't have it.
      Signed-off-by: NJames Bottomley <James.Bottomley@SteelEye.com>
      1fa44eca
  17. 15 1月, 2006 1 次提交
  18. 09 1月, 2006 3 次提交
    • N
      [PATCH] fix workqueue oops during cpu offline · f756d5e2
      Nathan Lynch 提交于
      Use first_cpu(cpu_possible_map) for the single-thread workqueue case.  We
      used to hardcode 0, but that broke on systems where !cpu_possible(0) when
      workqueue_struct->cpu_workqueue_struct was changed from a static array to
      alloc_percpu.
      
      Commit id bce61dd4 ("Fix hardcoded cpu=0 in
      workqueue for per_cpu_ptr() calls") fixed that for Ben's funky sparc64
      system, but it regressed my Power5.  Offlining cpu 0 oopses upon the next
      call to queue_work for a single-thread workqueue, because now we try to
      manipulate per_cpu_ptr(wq->cpu_wq, 1), which is uninitialized.
      
      So we need to establish an unchanging "slot" for single-thread workqueues
      which will have a valid percpu allocation.  Since alloc_percpu keys off of
      cpu_possible_map, which must not change after initialization, make this
      slot == first_cpu(cpu_possible_map).
      Signed-off-by: NNathan Lynch <ntl@pobox.com>
      Cc: <stable@kernel.org>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      f756d5e2
    • B
      [PATCH] Unchecked alloc_percpu() return in __create_workqueue() · 676121fc
      Ben Collins 提交于
      __create_workqueue() not checking return of alloc_percpu()
      
      NULL dereference was possible.
      Signed-off-by: NBen Collins <bcollins@ubuntu.com>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      676121fc
    • C
      [PATCH] add schedule_on_each_cpu() · 15316ba8
      Christoph Lameter 提交于
      swap migration's isolate_lru_page() currently uses an IPI to notify other
      processors that the lru caches need to be drained if the page cannot be
      found on the LRU.  The IPI interrupt may interrupt a processor that is just
      processing lru requests and cause a race condition.
      
      This patch introduces a new function run_on_each_cpu() that uses the
      keventd() to run the LRU draining on each processor.  Processors disable
      preemption when dealing the LRU caches (these are per processor) and thus
      executing LRU draining from another process is safe.
      
      Thanks to Lee Schermerhorn <lee.schermerhorn@hp.com> for finding this race
      condition.
      Signed-off-by: NChristoph Lameter <clameter@sgi.com>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      15316ba8
  19. 29 11月, 2005 1 次提交
    • B
      [PATCH] Fix hardcoded cpu=0 in workqueue for per_cpu_ptr() calls · bce61dd4
      Ben Collins 提交于
      Tracked this down on an Ultra Enterprise 3000.  It's a 6-way machine.  Odd
      thing about this machine (and it's good for finding bugs like this) is that
      the CPU id's are not 0 based.  For instance, on my machine the CPU's are
      6/7/10/11/14/15.
      
      This caused some NULL pointer dereference in kernel/workqueue.c because for
      single_threaded workqueue's, it hardcoded the cpu to 0.
      
      I changed the 0's to any_online_cpu(cpu_online_mask), which cpumask.h
      claims is "First cpu in mask".  So this fits the same usage.
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      bce61dd4
  20. 07 11月, 2005 1 次提交
    • H
      [PATCH] cpu hoptlug: avoid usage of smp_processor_id() in preemptible code · a4c4af7c
      Heiko Carstens 提交于
      Replace smp_processor_id() with any_online_cpu(cpu_online_map) in order to
      avoid lots of "BUG: using smp_processor_id() in preemptible [00000001]
      code:..." messages in case taking a cpu online fails.
      
      All the traces start at the last notifier_call_chain(...) in kernel/cpu.c.
      Since we hold the cpu_control semaphore it shouldn't be any problem to access
      cpu_online_map.
      
      The reason why cpu_up failed is simply that the cpu that was supposed to be
      taken online wasn't even there.  That is because on s390 we never know when a
      new cpu comes and therefore cpu_possible_map consists of only ones and doesn't
      reflect reality.
      Signed-off-by: NHeiko Carstens <heiko.carstens@de.ibm.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      a4c4af7c
  21. 31 10月, 2005 1 次提交
  22. 08 9月, 2005 2 次提交
  23. 11 8月, 2005 1 次提交
    • J
      [PATCH] remove name length check in a workqueue · 60686744
      James Bottomley 提交于
      We have a chek in there to make sure that the name won't overflow
      task_struct.comm[], but it's triggering for scsi with lots of HBAs, only
      scsi is using single-threaded workqueues which don't append the "/%d"
      anyway.
      
      All too hard.  Just kill the BUG_ON.
      
      Cc: Ingo Molnar <mingo@elte.hu>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      
      [ kthread_create() uses vsnprintf() and limits the thing, so no
        actual overflow can actually happen regardless ]
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      60686744
  24. 17 4月, 2005 2 次提交
    • J
      [PATCH] re-export cancel_rearming_delayed_workqueue · 81ddef77
      James Bottomley 提交于
      This was unexported by Arjan because we have no current users.
      
      However, during a conversion from tasklets to workqueues of the parisc led
      functions, we ran across a case where this was needed.  In particular, the
      open coded equivalent of cancel_rearming_delayed_workqueue was implemented
      incorrectly, which is, I think, all the evidence necessary that this is a
      useful API.
      Signed-off-by: NJames Bottomley <James.Bottomley@SteelEye.com>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      81ddef77
    • L
      Linux-2.6.12-rc2 · 1da177e4
      Linus Torvalds 提交于
      Initial git repository build. I'm not bothering with the full history,
      even though we have it. We can create a separate "historical" git
      archive of that later if we want to, and in the meantime it's about
      3.2GB when imported into git - space that would just make the early
      git days unnecessarily complicated, when we don't have a lot of good
      infrastructure for it.
      
      Let it rip!
      1da177e4