lkml.org 
[lkml]   [2010]   [Aug]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    SubjectRe: [PATCH 04/10] Use percpu buffers
    From
    On Mon, Aug 9, 2010 at 8:26 PM, Nitin Gupta <ngupta@vflare.org> wrote:
    > @@ -303,38 +307,41 @@ static int zram_write(struct zram *zram, struct bio *bio)
    >                                zram_test_flag(zram, index, ZRAM_ZERO))
    >                        zram_free_page(zram, index);
    >
    > -               mutex_lock(&zram->lock);
    > +               preempt_disable();
    > +               zbuffer = __get_cpu_var(compress_buffer);
    > +               zworkmem = __get_cpu_var(compress_workmem);
    > +               if (unlikely(!zbuffer || !zworkmem)) {
    > +                       preempt_enable();
    > +                       goto out;
    > +               }

    The per-CPU buffer thing with this preempt_disable() trickery looks
    overkill to me. Most block device drivers seem to use mempool_alloc()
    for this sort of thing. Is there some reason you can't use that here?
    --
    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: 2010-08-09 20:59    [W:0.021 / U:61.740 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site