14 Nov, 2013

1 commit

  • Add a new API wait_event_cmd(). It's a variant of wait_even() with two
    commands executed. One is executed before sleep, another after sleep.

    Modified to match use wait.h approach based on suggestion by
    Peter Zijlstra - neilb

    Signed-off-by: Shaohua Li
    Signed-off-by: NeilBrown

    Shaohua Li
     

01 Nov, 2013

1 commit

  • __wait_event_interruptible_lock_irq_timeout() needs the timeout
    parameter passed instead of "ret".

    This magically compiled since the only user has a local ret
    variable. Luckily we got a build warning:

    CC drivers/s390/scsi/zfcp_qdio.o
    drivers/s390/scsi/zfcp_qdio.c: In function 'zfcp_qdio_sbal_get':
    include/linux/wait.h:780:15: warning: 'ret' may be used uninitialized

    Signed-off-by: Heiko Carstens
    Acked-by: Peter Zijlstra
    Link: http://lkml.kernel.org/r/20131031114814.GB5551@osiris
    Signed-off-by: Ingo Molnar

    Heiko Carstens
     

23 Oct, 2013

1 commit

  • The wait_event_interruptible_lock_irq() macro is missing a
    semi-colon which causes a build failure in the i915 DRM driver.

    Signed-off-by: Thierry Reding
    Cc: Peter Zijlstra
    Link: http://lkml.kernel.org/r/1382528455-29911-1-git-send-email-treding@nvidia.com
    Signed-off-by: Ingo Molnar

    Thierry Reding
     

16 Oct, 2013

2 commits

  • Add the new helper, prepare_to_wait_event() which should only be used
    by ___wait_event().

    prepare_to_wait_event() returns -ERESTARTSYS if signal_pending_state()
    is true, otherwise it does prepare_to_wait/exclusive. This allows to
    uninline the signal-pending checks in wait_event*() macros.

    Also, it can initialize wait->private/func. We do not care if they were
    already initialized, the values are the same. This also shaves a couple
    of insns from the inlined code.

    This obviously makes prepare_*() path a little bit slower, but we are
    likely going to sleep anyway, so I think it makes sense to shrink .text:

    text data bss dec hex filename
    ===================================================
    before: 5126092 2959248 10117120 18202460 115bf5c vmlinux
    after: 5124618 2955152 10117120 18196890 115a99a vmlinux

    on my build.

    Signed-off-by: Oleg Nesterov
    Signed-off-by: Peter Zijlstra
    Link: http://lkml.kernel.org/r/20131007161824.GA29757@redhat.com
    Signed-off-by: Ingo Molnar

    Oleg Nesterov
     
  • Commit 4c663cfc ("wait: fix false timeouts when using
    wait_event_timeout()") introduced the additional condition checks
    after a timeout but only in the "slow" __wait*() paths.

    wait_event_timeout(wq, CONDITION, 0) still returns 0 if CONDITION
    is already true and we do not call __wait*().

    Now that we have ___wait_cond_timeout() we can use it instead to
    ensure that __ret will be properly updated.

    Signed-off-by: Oleg Nesterov
    Signed-off-by: Peter Zijlstra
    Link: http://lkml.kernel.org/r/20131007183106.GA10973@redhat.com
    Signed-off-by: Ingo Molnar

    Oleg Nesterov
     

04 Oct, 2013

16 commits

  • Since we are changing wait.h profoundly, use the opportunity to:

    - add a sentence to explain what this file is about
    - remove whitespace noise
    - prettify weird looking line break fixup attempts
    - standardize type definition and initialization sequences
    - use consistent style details

    No code is changed.

    Acked-by: Peter Zijlstra
    Cc: Oleg Nesterov
    Cc: Linus Torvalds
    Cc: Andrew Morton
    Link: http://lkml.kernel.org/n/tip-O8dIie5swnctqpupakatvqyq@git.kernel.org
    Signed-off-by: Ingo Molnar

    Ingo Molnar
     
  • Change all __wait_event*() implementations to match the corresponding
    wait_event*() signature for convenience.

    In particular this does away with the weird 'ret' logic. Since there
    are __wait_event*() users this requires we update them too.

    Reviewed-by: Oleg Nesterov
    Signed-off-by: Peter Zijlstra
    Link: http://lkml.kernel.org/r/20131002092529.042563462@infradead.org
    Signed-off-by: Ingo Molnar

    Peter Zijlstra
     
  • While not a whole-sale replacement like the others we can still reduce
    the size of __wait_event_hrtimeout() considerably by noting that the
    actual core of __wait_event_hrtimeout() is identical to what
    ___wait_event() generates.

    Reviewed-by: Oleg Nesterov
    Signed-off-by: Peter Zijlstra
    Link: http://lkml.kernel.org/r/20131002092528.972793648@infradead.org
    Signed-off-by: Ingo Molnar

    Peter Zijlstra
     
  • Reduce macro complexity by using the new ___wait_event() helper.
    No change in behaviour, identical generated code.

    Reviewed-by: Oleg Nesterov
    Signed-off-by: Peter Zijlstra
    Link: http://lkml.kernel.org/r/20131002092528.898691966@infradead.org
    Signed-off-by: Ingo Molnar

    Peter Zijlstra
     
  • Reduce macro complexity by using the new ___wait_event() helper.
    No change in behaviour, identical generated code.

    Reviewed-by: Oleg Nesterov
    Signed-off-by: Peter Zijlstra
    Link: http://lkml.kernel.org/r/20131002092528.759956109@infradead.org
    Signed-off-by: Ingo Molnar

    Peter Zijlstra
     
  • Reduce macro complexity by using the new ___wait_event() helper.
    No change in behaviour, identical generated code.

    Reviewed-by: Oleg Nesterov
    Signed-off-by: Peter Zijlstra
    Link: http://lkml.kernel.org/r/20131002092528.686006009@infradead.org
    Signed-off-by: Ingo Molnar

    Peter Zijlstra
     
  • Reduce macro complexity by using the new ___wait_event() helper.
    No change in behaviour, identical generated code.

    Reviewed-by: Oleg Nesterov
    Signed-off-by: Peter Zijlstra
    Link: http://lkml.kernel.org/r/20131002092528.612813379@infradead.org
    Signed-off-by: Ingo Molnar

    Peter Zijlstra
     
  • Reduce macro complexity by using the new ___wait_event() helper.
    No change in behaviour, identical generated code.

    Reviewed-by: Oleg Nesterov
    Signed-off-by: Peter Zijlstra
    Link: http://lkml.kernel.org/r/20131002092528.541716442@infradead.org
    Signed-off-by: Ingo Molnar

    Peter Zijlstra
     
  • Reduce macro complexity by using the new ___wait_event() helper.
    No change in behaviour, identical generated code.

    Reviewed-by: Oleg Nesterov
    Signed-off-by: Peter Zijlstra
    Link: http://lkml.kernel.org/r/20131002092528.469616907@infradead.org
    Signed-off-by: Ingo Molnar

    Peter Zijlstra
     
  • Reduce macro complexity by using the new ___wait_event() helper.
    No change in behaviour, identical generated code.

    Reviewed-by: Oleg Nesterov
    Signed-off-by: Peter Zijlstra
    Link: http://lkml.kernel.org/r/20131002092528.396949919@infradead.org
    Signed-off-by: Ingo Molnar

    Peter Zijlstra
     
  • Reduce macro complexity by using the new ___wait_event() helper.
    No change in behaviour, identical generated code.

    Reviewed-by: Oleg Nesterov
    Signed-off-by: Peter Zijlstra
    Link: http://lkml.kernel.org/r/20131002092528.325264677@infradead.org
    Signed-off-by: Ingo Molnar

    Peter Zijlstra
     
  • Reduce macro complexity by using the new ___wait_event() helper.
    No change in behaviour, identical generated code.

    Reviewed-by: Oleg Nesterov
    Signed-off-by: Peter Zijlstra
    Link: http://lkml.kernel.org/r/20131002092528.254863348@infradead.org
    Signed-off-by: Ingo Molnar

    Peter Zijlstra
     
  • There's far too much duplication in the __wait_event macros; in order
    to fix this introduce ___wait_event() a macro with the capability to
    replace most other macros.

    With the previous patches changing the various __wait_event*()
    implementations to be more uniform; we can now collapse the lot
    without also changing generated code.

    Reviewed-by: Oleg Nesterov
    Signed-off-by: Peter Zijlstra
    Link: http://lkml.kernel.org/r/20131002092528.181897111@infradead.org
    Signed-off-by: Ingo Molnar

    Peter Zijlstra
     
  • Purely a preparatory patch; it changes the control flow to match what
    will soon be generated by generic code so that that patch can be a
    unity transform.

    Reviewed-by: Oleg Nesterov
    Signed-off-by: Peter Zijlstra
    Link: http://lkml.kernel.org/r/20131002092528.107994763@infradead.org
    Signed-off-by: Ingo Molnar

    Peter Zijlstra
     
  • Commit 4c663cf ("wait: fix false timeouts when using
    wait_event_timeout()") introduced an additional condition check after
    a timeout but there's a few issues;

    - it forgot one site
    - it put the check after the main loop; not at the actual timeout
    check.

    Cure both; by wrapping the condition (as suggested by Oleg), this
    avoids double evaluation of 'condition' which could be quite big.

    Reviewed-by: Oleg Nesterov
    Signed-off-by: Peter Zijlstra
    Link: http://lkml.kernel.org/r/20131002092528.028892896@infradead.org
    Signed-off-by: Ingo Molnar

    Peter Zijlstra
     
  • There's two patterns to check signals in the __wait_event*() macros:

    if (!signal_pending(current)) {
    schedule();
    continue;
    }
    ret = -ERESTARTSYS;
    break;

    And the more natural:

    if (signal_pending(current)) {
    ret = -ERESTARTSYS;
    break;
    }
    schedule();

    Change them all into the latter form.

    Reviewed-by: Oleg Nesterov
    Signed-off-by: Peter Zijlstra
    Link: http://lkml.kernel.org/r/20131002092527.956416254@infradead.org
    Signed-off-by: Ingo Molnar

    Peter Zijlstra
     

22 Aug, 2013

1 commit

  • This patch adds wait_event_interruptible_lock_irq_timeout(), which is a
    straight-forward descendant of wait_event_interruptible_timeout() and
    wait_event_interruptible_lock_irq().

    The zfcp driver used to call wait_event_interruptible_timeout()
    in combination with some intricate and error-prone locking. Using
    wait_event_interruptible_lock_irq_timeout() as a replacement
    nicely cleans up that locking.

    This rework removes a situation that resulted in a locking imbalance
    in zfcp_qdio_sbal_get():

    BUG: workqueue leaked lock or atomic: events/1/0xffffff00/10
    last function: zfcp_fc_wka_port_offline+0x0/0xa0 [zfcp]

    It was introduced by commit c2af7545aaff3495d9bf9a7608c52f0af86fb194
    "[SCSI] zfcp: Do not wait for SBALs on stopped queue", which had a new
    code path related to ZFCP_STATUS_ADAPTER_QDIOUP that took an early exit
    without a required lock being held. The problem occured when a
    special, non-SCSI I/O request was being submitted in process context,
    when the adapter's queues had been torn down. In this case the bug
    surfaced when the Fibre Channel port connection for a well-known address
    was closed during a concurrent adapter shut-down procedure, which is a
    rare constellation.

    This patch also fixes these warnings from the sparse tool (make C=1):

    drivers/s390/scsi/zfcp_qdio.c:224:12: warning: context imbalance in
    'zfcp_qdio_sbal_check' - wrong count at exit
    drivers/s390/scsi/zfcp_qdio.c:244:5: warning: context imbalance in
    'zfcp_qdio_sbal_get' - unexpected unlock

    Last but not least, we get rid of that crappy lock-unlock-lock
    sequence at the beginning of the critical section.

    It is okay to call zfcp_erp_adapter_reopen() with req_q_lock held.

    Reported-by: Mikulas Patocka
    Reported-by: Heiko Carstens
    Signed-off-by: Martin Peschke
    Cc: stable@vger.kernel.org #2.6.35+
    Signed-off-by: Steffen Maier
    Signed-off-by: James Bottomley

    Martin Peschke
     

03 Jul, 2013

1 commit

  • Pull FS-Cache updates from David Howells:
    "This contains a number of fixes for various FS-Cache issues plus some
    cleanups. The commits are, in order:

    1) Provide a system wait_on_atomic_t() and wake_up_atomic_t() sharing
    the bit-wait table (enhancement for #8).

    2) Don't put spin_lock() in a while-condition as spin_lock() may have
    a do {} while(0) wrapper (cleanup).

    3) Symbolically name i_mutex lock classes rather than using numbers
    in CacheFiles (cleanup).

    4) Don't sleep in page release if __GFP_FS is not set (deadlock vs
    ext4).

    5) Uninline fscache_object_init() (cleanup for #7).

    6) Wrap checks on object state (cleanup for #7).

    7) Simplify the object state machine by separating work states from
    wait states.

    8) Simplify cookie retention by objects (NULL pointer deref fix).

    9) Remove unused list_to_page() macro (cleanup).

    10) Make the remaining-pages counter in the retrieval op atomic
    (assertion failure fix).

    11) Don't use spin_is_locked() in assertions (assertion failure fix)"

    * tag 'fscache-20130702' of git://git.kernel.org/pub/scm/linux/kernel/git/dhowells/linux-fs:
    FS-Cache: Don't use spin_is_locked() in assertions
    FS-Cache: The retrieval remaining-pages counter needs to be atomic_t
    cachefiles: remove unused macro list_to_page()
    FS-Cache: Simplify cookie retention for fscache_objects, fixing oops
    FS-Cache: Fix object state machine to have separate work and wait states
    FS-Cache: Wrap checks on object state
    FS-Cache: Uninline fscache_object_init()
    FS-Cache: Don't sleep in page release if __GFP_FS is not set
    CacheFiles: name i_mutex lock class explicitly
    fs/fscache: remove spin_lock() from the condition in while()
    Add wait_on_atomic_t() and wake_up_atomic_t()

    Linus Torvalds
     

25 May, 2013

1 commit

  • Many callers of the wait_event_timeout() and
    wait_event_interruptible_timeout() expect that the return value will be
    positive if the specified condition becomes true before the timeout
    elapses. However, at the moment this isn't guaranteed. If the wake-up
    handler is delayed enough, the time remaining until timeout will be
    calculated as 0 - and passed back as a return value - even if the
    condition became true before the timeout has passed.

    Fix this by returning at least 1 if the condition becomes true. This
    semantic is in line with what wait_for_condition_timeout() does; see
    commit bb10ed09 ("sched: fix wait_for_completion_timeout() spurious
    failure under heavy load").

    Daniel said "We have 3 instances of this bug in drm/i915. One case even
    where we switch between the interruptible and not interruptible
    wait_event_timeout variants, foolishly presuming they have the same
    semantics. I very much like this."

    One such bug is reported at
    https://bugs.freedesktop.org/show_bug.cgi?id=64133

    Signed-off-by: Imre Deak
    Acked-by: Daniel Vetter
    Acked-by: David Howells
    Acked-by: Jens Axboe
    Cc: "Paul E. McKenney"
    Cc: Dave Jones
    Cc: Lukas Czerner
    Cc:
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Imre Deak
     

15 May, 2013

1 commit

  • Add wait_on_atomic_t() and wake_up_atomic_t() to indicate became-zero events on
    atomic_t types. This uses the bit-wake waitqueue table. The key is set to a
    value outside of the number of bits in a long so that wait_on_bit() won't be
    woken up accidentally.

    What I'm using this for is: in a following patch I add a counter to struct
    fscache_cookie to count the number of outstanding operations that need access
    to netfs data. The way this works is:

    (1) When a cookie is allocated, the counter is initialised to 1.

    (2) When an operation wants to access netfs data, it calls atomic_inc_unless()
    to increment the counter before it does so. If it was 0, then the counter
    isn't incremented, the operation isn't permitted to access the netfs data
    (which might by this point no longer exist) and the operation aborts in
    some appropriate manner.

    (3) When an operation finishes with the netfs data, it decrements the counter
    and if it reaches 0, calls wake_up_atomic_t() on it - the assumption being
    that it was the last blocker.

    (4) When a cookie is released, the counter is decremented and the releaser
    uses wait_on_atomic_t() to wait for the counter to become 0 - which should
    indicate no one is using the netfs data any longer. The netfs data can
    then be destroyed.

    There are some alternatives that I have thought of and that have been suggested
    by Tejun Heo:

    (A) Using wait_on_bit() to wait on a bit in the counter. This doesn't work
    because if that bit happens to be 0 then the wait won't happen - even if
    the counter is non-zero.

    (B) Using wait_on_bit() to wait on a flag elsewhere which is cleared when the
    counter reaches 0. Such a flag would be redundant and would add
    complexity.

    (C) Adding a waitqueue to fscache_cookie - this would expand that struct by
    several words for an event that happens just once in each cookie's
    lifetime. Further, cookies are generally per-file so there are likely to
    be a lot of them.

    (D) Similar to (C), but add a pointer to a waitqueue in the cookie instead of
    a waitqueue. This would add single word per cookie and so would be less
    of an expansion - but still an expansion.

    (E) Adding a static waitqueue to the fscache module. Generally this would be
    fine, but under certain circumstances many cookies will all get added at
    the same time (eg. NFS umount, cache withdrawal) thereby presenting
    scaling issues. Note that the wait may be significant as disk I/O may be
    in progress.

    So, I think reusing the wait_on_bit() waitqueue set is reasonable. I don't
    make much use of the waitqueue I need on a per-cookie basis, but sometimes I
    have a huge flood of the cookies to deal with.

    I also don't want to add a whole new set of global waitqueue tables
    specifically for the dec-to-0 event if I can reuse the bit tables.

    Signed-off-by: David Howells
    Tested-By: Milosz Tanski
    Acked-by: Jeff Layton

    David Howells
     

08 May, 2013

1 commit

  • Analagous to wait_event_timeout() and friends, this adds
    wait_event_hrtimeout() and wait_event_interruptible_hrtimeout().

    Note that unlike the versions that use regular timers, these don't
    return the amount of time remaining when they return - instead, they
    return 0 or -ETIME if they timed out. because I was uncomfortable with
    the semantics of doing it the other way (that I could get it right,
    anyways).

    If the timer expires, there's no real guarantee that expire_time -
    current_time would be
    Cc: Thomas Gleixner
    Cc: Ingo Molnar
    Cc: Zach Brown
    Cc: Felipe Balbi
    Cc: Greg Kroah-Hartman
    Cc: Mark Fasheh
    Cc: Joel Becker
    Cc: Rusty Russell
    Cc: Jens Axboe
    Cc: Asai Thambi S P
    Cc: Selvan Mani
    Cc: Sam Bradshaw
    Cc: Jeff Moyer
    Cc: Al Viro
    Cc: Benjamin LaHaise
    Reviewed-by: "Theodore Ts'o"
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Kent Overstreet
     

30 Nov, 2012

1 commit

  • New wait_event{_interruptible}_lock_irq{_cmd} macros added. This commit
    moves the private wait_event_lock_irq() macro from MD to regular wait
    includes, introduces new macro wait_event_lock_irq_cmd() instead of using
    the old method with omitting cmd parameter which is ugly and makes a use
    of new macros in the MD. It also introduces the _interruptible_ variant.

    The use of new interface is when one have a special lock to protect data
    structures used in the condition, or one also needs to invoke "cmd"
    before putting it to sleep.

    All new macros are expected to be called with the lock taken. The lock
    is released before sleep and is reacquired afterwards. We will leave the
    macro with the lock held.

    Note to DM: IMO this should also fix theoretical race on waitqueue while
    using simultaneously wait_event_lock_irq() and wait_event() because of
    lack of locking around current state setting and wait queue removal.

    Signed-off-by: Lukas Czerner
    Cc: Neil Brown
    Cc: David Howells
    Cc: Ingo Molnar
    Cc: Peter Zijlstra
    Signed-off-by: Jens Axboe

    Lukas Czerner
     

13 Oct, 2012

1 commit


29 Mar, 2012

1 commit


01 Mar, 2012

1 commit

  • For code which protects the waitqueue itself with another lock it
    makes no sense to acquire the waitqueue lock for wakeup all. Provide
    __wake_up_all_locked().

    This is an optimization on the vanilla kernel (to be used by the
    PCI code) and an important semantic distinction on -rt.

    Signed-off-by: Thomas Gleixner
    Acked-by: Peter Zijlstra
    Link: http://lkml.kernel.org/n/tip-ux6m4b8jonb9inx8xafh77ds@git.kernel.org
    Signed-off-by: Ingo Molnar

    Thomas Gleixner
     

21 Dec, 2011

1 commit

  • -> #2 (&tty->write_wait){-.-...}:

    is a lot more informative than:

    -> #2 (key#19){-.....}:

    Signed-off-by: Peter Zijlstra
    Cc: Andrew Morton
    Cc: Linus Torvalds
    Link: http://lkml.kernel.org/n/tip-8zpopbny51023rdb0qq67eye@git.kernel.org
    Signed-off-by: Ingo Molnar

    Peter Zijlstra
     

06 Oct, 2010

1 commit

  • The "flags" member of "struct wait_queue_t" is used in several places in
    the kernel code without beeing initialized by init_wait(). "flags" is
    used in bitwise operations.

    If "flags" not initialized then unexpected behaviour may take place.
    Incorrect flags might used later in code.

    Added initialization of "wait_queue_t.flags" with zero value into
    "init_wait".

    Signed-off-by: Evgeny Kuznetsov
    [ The bit we care about does end up being initialized by both
    prepare_to_wait() and add_to_wait_queue(), so this doesn't seem to
    cause actual bugs, but is definitely the right thing to do -Linus ]
    Signed-off-by: Linus Torvalds

    Evgeny Kuznetsov
     

21 May, 2010

2 commits

  • * git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb-2.6: (229 commits)
    USB: remove unused usb_buffer_alloc and usb_buffer_free macros
    usb: musb: update gfp/slab.h includes
    USB: ftdi_sio: fix legacy SIO-device header
    USB: kl5usb105: reimplement using generic framework
    USB: kl5usb105: minor clean ups
    USB: kl5usb105: fix memory leak
    USB: io_ti: use kfifo to implement write buffering
    USB: io_ti: remove unsused private counter
    USB: ti_usb: use kfifo to implement write buffering
    USB: ir-usb: fix incorrect write-buffer length
    USB: aircable: fix incorrect write-buffer length
    USB: safe_serial: straighten out read processing
    USB: safe_serial: reimplement read using generic framework
    USB: safe_serial: reimplement write using generic framework
    usb-storage: always print quirks
    USB: usb-storage: trivial debug improvements
    USB: oti6858: use port write fifo
    USB: oti6858: use kfifo to implement write buffering
    USB: cypress_m8: use kfifo to implement write buffering
    USB: cypress_m8: remove unused drain define
    ...

    Fix up conflicts (due to usb_buffer_alloc/free renaming) in
    drivers/input/tablet/acecad.c
    drivers/input/tablet/kbtab.c
    drivers/input/tablet/wacom_sys.c
    drivers/media/video/gspca/gspca.c
    sound/usb/usbaudio.c

    Linus Torvalds
     
  • New wait_event_interruptible{,_exclusive}_locked{,_irq} macros added.
    They work just like versions without _locked* suffix but require the
    wait queue's lock to be held. Also __wake_up_locked() is now exported
    as to pair it with the above macros.

    The use case of this new facility is when one uses wait queue's lock
    to protect a data structure. This may be advantageous if the
    structure needs to be protected by a spinlock anyway. In particular,
    with additional spinlock the following code has to be used to wait
    for a condition:

    spin_lock(&data.lock);
    ...
    for (ret = 0; !ret && !(condition); ) {
    spin_unlock(&data.lock);
    ret = wait_event_interruptible(data.wqh, (condition));
    spin_lock(&data.lock);
    }
    ...
    spin_unlock(&data.lock);

    This looks bizarre plus wait_event_interruptible() locks the wait
    queue's lock anyway so there is a unlock+lock sequence where it could
    be avoided.

    To avoid those problems and benefit from wait queue's lock, a code
    similar to the following should be used:

    /* Waiting */
    spin_lock(&data.wqh.lock);
    ...
    ret = wait_event_interruptible_locked(data.wqh, (condition));
    ...
    spin_unlock(&data.wqh.lock);

    /* Waiting exclusively */
    spin_lock(&data.whq.lock);
    ...
    ret = wait_event_interruptible_exclusive_locked(data.whq, (condition));
    ...
    spin_unlock(&data.whq.lock);

    /* Waking up */
    spin_lock(&data.wqh.lock);
    ...
    wake_up_locked(&data.wqh);
    ...
    spin_unlock(&data.wqh.lock);

    When spin_lock_irq() is used matching versions of macros need to be
    used (*_locked_irq()).

    Signed-off-by: Michal Nazarewicz
    Cc: Kyungmin Park
    Cc: Marek Szyprowski
    Cc: Ingo Molnar
    Cc: Peter Zijlstra
    Cc: Takashi Iwai
    Cc: David Howells
    Cc: Andreas Herrmann
    Cc: Thomas Gleixner
    Cc: Mike Galbraith
    Signed-off-by: Greg Kroah-Hartman

    Michal Nazarewicz
     

11 May, 2010

1 commit

  • epoll should not touch flags in wait_queue_t. This patch introduces a new
    function __add_wait_queue_exclusive(), for the users, who use wait queue as a
    LIFO queue.

    __add_wait_queue_tail_exclusive() is introduced too instead of
    add_wait_queue_exclusive_locked(). remove_wait_queue_locked() is removed, as
    it is a duplicate of __remove_wait_queue(), disliked by users, and with less
    users.

    Signed-off-by: Changli Gao
    Signed-off-by: Peter Zijlstra
    Cc: Alexander Viro
    Cc: Paul Menage
    Cc: Li Zefan
    Cc: Davide Libenzi
    Cc:
    LKML-Reference:
    Signed-off-by: Ingo Molnar

    Changli Gao
     

15 Sep, 2009

1 commit

  • In order to extend the functions to have more than 1 flag (sync),
    rename the argument to flags, and explicitly define a WF_ space for
    individual flags.

    Signed-off-by: Peter Zijlstra
    LKML-Reference:
    Signed-off-by: Ingo Molnar

    Peter Zijlstra
     

10 Aug, 2009

1 commit

  • Give waitqueue spinlocks their own lockdep classes when they
    are initialised from init_waitqueue_head(). This means that
    struct wait_queue::func functions can operate other waitqueues.

    This is used by CacheFiles to catch the page from a backing fs
    being unlocked and to wake up another thread to take a copy of
    it.

    Signed-off-by: Peter Zijlstra
    Signed-off-by: David Howells
    Tested-by: Takashi Iwai
    Cc: linux-cachefs@redhat.com
    Cc: torvalds@osdl.org
    Cc: akpm@linux-foundation.org
    LKML-Reference:
    Signed-off-by: Ingo Molnar

    Peter Zijlstra
     

11 May, 2009

1 commit


28 Apr, 2009

1 commit

  • In 2.6.25 we added UDP mem accounting.

    This unfortunatly added a penalty when a frame is transmitted, since
    we have at TX completion time to call sock_wfree() to perform necessary
    memory accounting. This calls sock_def_write_space() and utimately
    scheduler if any thread is waiting on the socket.
    Thread(s) waiting for an incoming frame was scheduled, then had to sleep
    again as event was meaningless.

    (All threads waiting on a socket are using same sk_sleep anchor)

    This adds lot of extra wakeups and increases latencies, as noted
    by Christoph Lameter, and slows down softirq handler.

    Reference : http://marc.info/?l=linux-netdev&m=124060437012283&w=2

    Fortunatly, Davide Libenzi recently added concept of keyed wakeups
    into kernel, and particularly for sockets (see commit
    37e5540b3c9d838eb20f2ca8ea2eb8072271e403
    epoll keyed wakeups: make sockets use keyed wakeups)

    Davide goal was to optimize epoll, but this new wakeup infrastructure
    can help non epoll users as well, if they care to setup an appropriate
    handler.

    This patch introduces new DEFINE_WAIT_FUNC() helper and uses it
    in wait_for_packet(), so that only relevant event can wakeup a thread
    blocked in this function.

    Trace of function calls from bnx2 TX completion bnx2_poll_work() is :
    __kfree_skb()
    skb_release_head_state()
    sock_wfree()
    sock_def_write_space()
    __wake_up_sync_key()
    __wake_up_common()
    receiver_wake_function() : Stops here since thread is waiting for an INPUT

    Reported-by: Christoph Lameter
    Signed-off-by: Eric Dumazet
    Signed-off-by: David S. Miller

    Eric Dumazet
     

14 Apr, 2009

1 commit

  • '777c6c5 wait: prevent exclusive waiter starvation' made
    __wake_up_common() global to be used from abort_exclusive_wait().

    It was needed to do a wake-up with the waitqueue lock held while
    passing down a key to the wake-up function.

    Since '4ede816 epoll keyed wakeups: add __wake_up_locked_key() and
    __wake_up_sync_key()' there is an appropriate wrapper for this case:
    __wake_up_locked_key().

    Use it here and make __wake_up_common() private to the scheduler
    again.

    Signed-off-by: Johannes Weiner
    Cc: Andrew Morton
    Cc: Peter Zijlstra
    LKML-Reference:
    Signed-off-by: Ingo Molnar

    Johannes Weiner