Re: [PATCH 04/10] Use percpu buffers

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Aug 9, 2010 at 8:26 PM, Nitin Gupta <ngupta@xxxxxxxxxx> 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?
_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/devel



[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux