All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Joonsoo Kim <iamjoonsoo.kim@lge.com>
Cc: Minchan Kim <minchan@kernel.org>, Nitin Gupta <ngupta@vflare.org>,
	linux-kernel@vger.kernel.org,
	Sergey Senozhatsky <sergey.senozhatsky@gmail.com>,
	Jerome Marchand <jmarchan@redhat.com>
Subject: Re: [PATCH v3] zram: support REQ_DISCARD
Date: Wed, 12 Mar 2014 20:03:03 -0700	[thread overview]
Message-ID: <20140312200303.7abc49b0.akpm@linux-foundation.org> (raw)
In-Reply-To: <20140313024617.GA4900@lge.com>

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.

		

  reply	other threads:[~2014-03-13  2:58 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-12  8:01 [PATCH v3] zram: support REQ_DISCARD Joonsoo Kim
2014-03-12 20:33 ` Andrew Morton
2014-03-13  2:46   ` Joonsoo Kim
2014-03-13  3:03     ` Andrew Morton [this message]
2014-03-13  4:23       ` Joonsoo Kim
2014-03-13 20:40     ` Andrew Morton
2014-03-13 23:45       ` Joonsoo Kim
2014-03-14  0:29       ` Minchan Kim

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20140312200303.7abc49b0.akpm@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=iamjoonsoo.kim@lge.com \
    --cc=jmarchan@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=minchan@kernel.org \
    --cc=ngupta@vflare.org \
    --cc=sergey.senozhatsky@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.