Messages in this thread | | | Date | Wed, 12 Mar 2014 20:03:03 -0700 | From | Andrew Morton <> | Subject | Re: [PATCH v3] zram: support REQ_DISCARD |
| |
On Thu, 13 Mar 2014 11:46:17 +0900 Joonsoo Kim <iamjoonsoo.kim@lge.com> 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.
| |