lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <E1J4spp-0001pR-JQ@localhost>
Date:	Wed, 19 Dec 2007 14:55:17 +0800
From:	Fengguang Wu <wfg@...l.ustc.edu.cn>
To:	Nick Piggin <npiggin@...e.de>
Cc:	Andrew Morton <akpm@...l.org>,
	Linus Torvalds <torvalds@...ux-foundation.org>,
	Andrew Morton <akpm@...ux-foundation.org>,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH 2/9] readahead: clean up and simplify the code for
	filemap page fault readahead

On Wed, Dec 19, 2007 at 12:54:23AM +0100, Nick Piggin wrote:
> On Tue, Dec 18, 2007 at 07:50:33PM +0800, Fengguang Wu wrote:
> > On Tue, Dec 18, 2007 at 09:19:07AM +0100, Nick Piggin wrote:
> > > On Sun, Dec 16, 2007 at 07:59:30PM +0800, Fengguang Wu wrote:
> > 
> > > > +	read_lock_irq(&mapping->tree_lock);
> > > > +	page = radix_tree_lookup(&mapping->page_tree, offset);
> > > > +	if (likely(page)) {
> > > > +		int got_lock, uptodate;
> > > > +		page_cache_get(page);
> > > > +
> > > > +		got_lock = !TestSetPageLocked(page);
> > > > +		uptodate = PageUptodate(page);
> > > > +		read_unlock_irq(&mapping->tree_lock);
> > > 
> > > If we could avoid open coding tree_lock here (and expanding its coverage
> > > to PageUptodate), that would be nice. I don't think it gains us too much.
> > 
> > To use find_get_page()? That would be nice to me, too.
> 
> Exactly.

Done. Also I think it's better not to split the `found' case into
the two cases of 'found & lock-ok' and 'found & wait-lock' for now.
That would reduce some more code:

-/*
- * A successful mmap hit is when we didn't need any IO at all,
- * and got an immediate lock on an up-to-date page. There's not
- * much to do, except decide on whether we want to trigger read-
- * ahead.
- *
- * We currently do the same thing as we did for a locked page
- * that we're waiting for.
- */
-static void do_mmap_hit(struct vm_area_struct *vma,
-			struct file_ra_state *ra,
-			struct file *file,
-			struct page *page,
-			pgoff_t offset)
-{
-	do_async_mmap_readahead(vma, ra, file, page, offset);
-}
-
 /**
  * filemap_fault - read in file data for page fault handling
  * @vma:	vma in which the fault was taken
@@ -1411,28 +1396,13 @@
 		return VM_FAULT_SIGBUS;
 
 	/*
-	 * Do we have something in the page cache already that
-	 * is unlocked and already up-to-date?
+	 * Do we have something in the page cache already?
 	 */
 	page = find_get_page(mapping, offset);
 	if (likely(page)) {
-		if (likely(!TestSetPageLocked(page))) {
-			/*
-			 * Previous IO error? No read-ahead, but try to
-			 * re-do a single read.
-			 */
-			if (unlikely(!PageUptodate(page)))
-				goto page_not_uptodate;
-
-			do_mmap_hit(vma, ra, file, page, offset);
-			goto found_it;
-		}
-
 		/*
-		 * We found the page, but it was locked..
-		 *
-		 * So do async readahead and wait for it to
-		 * unlock.
+		 * We found the page, so try async readahead before
+		 * waiting for the lock.
 		 */
 		do_async_mmap_readahead(vma, ra, file, page, offset);
 		lock_page(page);

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ