Re: [PATCH v3] zram: support REQ_DISCARD
From: Andrew Morton
Date: Wed Mar 12 2014 - 22:58:33 EST
On Thu, 13 Mar 2014 11:46:17 +0900 Joonsoo Kim <iamjoonsoo.kim@xxxxxxx> wrote:
> + while (n >= PAGE_SIZE) {
> + /*
> + * discard request can be too large so that the zram can
> + * be stucked for a long time if we handle the request
> + * at once. So handle the request by PAGE_SIZE unit at a time.
> + */
> + write_lock(&zram->meta->tb_lock);
> + zram_free_page(zram, index);
> + write_unlock(&zram->meta->tb_lock);
> + index++;
> + n -= PAGE_SIZE;
> + }
Well, you could use something like
if (need_resched()) {
unlock()
schedule()
lock()
}
here, or free 100 pages at a time or something silly like that. I
guess we retain these as options if/when that lock turns out to be
contended.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/