lkml.org 
[lkml]   [2014]   [Mar]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [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.




\
 
 \ /
  Last update: 2014-03-13 04:21    [W:0.083 / U:1.944 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site