lkml.org 
[lkml]   [2011]   [Sep]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    SubjectRe: [PATCH v5 3.1.0-rc4-tip 18/26] uprobes: slot allocation.
    From
    Date
    On Tue, 2011-09-20 at 17:33 +0530, Srikar Dronamraju wrote:
    > +static unsigned long xol_take_insn_slot(struct uprobes_xol_area *area)
    > +{
    > + unsigned long slot_addr, flags;
    > + int slot_nr;
    > +
    > + do {
    > + spin_lock_irqsave(&area->slot_lock, flags);
    > + slot_nr = find_first_zero_bit(area->bitmap, UINSNS_PER_PAGE);
    > + if (slot_nr < UINSNS_PER_PAGE) {
    > + __set_bit(slot_nr, area->bitmap);
    > + slot_addr = area->vaddr +
    > + (slot_nr * UPROBES_XOL_SLOT_BYTES);
    > + atomic_inc(&area->slot_count);
    > + }
    > + spin_unlock_irqrestore(&area->slot_lock, flags);
    > + if (slot_nr >= UINSNS_PER_PAGE)
    > + xol_wait_event(area);
    > +
    > + } while (slot_nr >= UINSNS_PER_PAGE);
    > +
    > + return slot_addr;
    > +}

    Why isn't a find_first_bit() + set_and_test_bit() not sufficient? That
    is, what do you need that lock for?


    \
     
     \ /
      Last update: 2011-09-27 14:41    [W:0.023 / U:0.060 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site