lkml.org 
[lkml]   [2009]   [May]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [PATCH 04/15] ps3vram: Replace mutex by spinlock + list
    On Fri, 8 May 2009, Andrew Morton wrote:
    > On Fri, 8 May 2009 16:01:13 +0200
    > Geert Uytterhoeven <Geert.Uytterhoeven@sonycom.com> wrote:
    >
    > > +static int ps3vram_make_request(struct request_queue *q, struct bio *bio)
    > > +{
    > > + struct ps3_system_bus_device *dev = q->queuedata;
    > > + struct ps3vram_priv *priv = dev->core.driver_data;
    > > +
    > > + dev_dbg(&dev->core, "%s\n", __func__);
    > > +
    > > + spin_lock_irq(&priv->lock);
    > > + if (priv->tail) {
    > > + priv->tail->bi_next = bio;
    > > + priv->tail = bio;
    > > + spin_unlock_irq(&priv->lock);
    > > + return 0;
    ^^^^^^^^
    > > + }
    > > +
    > > + priv->tail = bio;
    > > + spin_unlock_irq(&priv->lock);
    > > +
    > > + do {
    > > + bio = ps3vram_do_bio(dev, bio);
    > > + } while (bio);
    >
    > Is there something which prevents two threads of control from walking
    > the same list at the same time?

    Sure: only the thread who adds the first request to the empty list will walk
    the list later.

    With kind regards,

    Geert Uytterhoeven
    Software Architect
    Techsoft Centre

    Technology and Software Centre Europe
    The Corporate Village · Da Vincilaan 7-D1 · B-1935 Zaventem · Belgium

    Phone: +32 (0)2 700 8453
    Fax: +32 (0)2 700 8622
    E-mail: Geert.Uytterhoeven@sonycom.com
    Internet: http://www.sony-europe.com/

    A division of Sony Europe (Belgium) N.V.
    VAT BE 0413.825.160 · RPR Brussels
    Fortis · BIC GEBABEBB · IBAN BE41293037680010
    --
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/

    \
     
     \ /
      Last update: 2009-05-11 08:41    [W:0.023 / U:29.228 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site