linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Eric Van Hensbergen <ericvh@gmail.com>
Cc: v9fs-developer@lists.sourceforge.net,
	linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org
Subject: Re: [RFC][PATCH] 9p: add readahead support for loose mode
Date: Sat, 15 Sep 2007 03:41:26 -0700	[thread overview]
Message-ID: <20070915034126.cd2c2073.akpm@linux-foundation.org> (raw)
In-Reply-To: <11897857601214-git-send-email-ericvh@gmail.com>

On Fri, 14 Sep 2007 11:02:40 -0500 Eric Van Hensbergen <ericvh@gmail.com> wrote:

> +	list_for_each_entry_reverse(tmp_page, page_list, lru) {
> +		BUG_ON(count > num_pages);
> +		if (add_to_page_cache(tmp_page, mapping,
> +					tmp_page->index, GFP_KERNEL)) {
> +			page_cache_release(tmp_page);
> +			continue;
> +		}
> +
> +		kv[count].iov_base = kmap(tmp_page);
> +		kv[count].iov_len = PAGE_CACHE_SIZE;
> +		count++;
> +	}
> +
> +	read_size = count * PAGE_CACHE_SIZE;
> +	if (!read_size)
> +		goto cleanup;
> +
> +	retval = p9_client_readv(fid, kv, offset, count);
> +
> +cleanup:
> +	list_for_each_safe(p, n, page_list) {
> +		tmp_page = list_entry(p, struct page, lru);
> +		list_del(&tmp_page->lru);
> +		if (!pagevec_add(&lru_pvec, tmp_page))
> +			__pagevec_lru_add(&lru_pvec);
> +		kunmap(tmp_page);
> +		flush_dcache_page(tmp_page);
> +		SetPageUptodate(tmp_page);
> +		unlock_page(tmp_page);
> +	}

eww, kmap.  Large amounts of them, apparently.

Be aware that kmap is a) slow and b) deadlockable.  The latter happens when
multiple tasks want to take more than one kmap simultaneously: they all
wait for someone else to release one.  Your code here seems especially
vulnerable to this.

Nick had a kmap-speedup patchset a while back which addressed a) but I
don't know if it addressed the deadlock.  But that patch seemed to die.

Strongly recommend that the code be reworked to use kmap_atomic()



  reply	other threads:[~2007-09-15 10:41 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-09-14 16:02 [RFC][PATCH] 9p: add readahead support for loose mode Eric Van Hensbergen
2007-09-15 10:41 ` Andrew Morton [this message]
2007-09-16 20:16   ` Peter Zijlstra

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=20070915034126.cd2c2073.akpm@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=ericvh@gmail.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=v9fs-developer@lists.sourceforge.net \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).