All of lore.kernel.org
 help / color / mirror / Atom feed
From: Miquel van Smoorenburg <miquels@cistron.nl>
To: Andrew Morton <akpm@osdl.org>
Cc: linux-kernel@vger.kernel.org
Subject: 2.6.11-rc1: mark-page-accessed in filemap.c not quite right
Date: Wed, 12 Jan 2005 23:48:09 +0100	[thread overview]
Message-ID: <20050112224807.GA24154@cistron.nl> (raw)

I just discovered there's a thinko in the mark-page-accessed
change in do_generic_mapping_read() in 2.6.11-rc1. ra.prev_page
is compared to index to see if we read from this page before -
except that prev_page is actually set to the recent page or
even a page in front of the current page.

So we should store ra.prev_page in a seperate variable at the
start of do_generic_mapping_read().

This patch does just that:

--- linux-2.6.11-rc1/mm/filemap.c.ORIG	2005-01-12 05:02:10.000000000 +0100
+++ linux-2.6.11-rc1/mm/filemap.c	2005-01-12 23:06:23.643039416 +0100
@@ -693,6 +693,7 @@
 	unsigned long offset;
 	unsigned long req_size;
 	unsigned long next_index;
+	unsigned long prev_index;
 	loff_t isize;
 	struct page *cached_page;
 	int error;
@@ -701,6 +702,7 @@
 	cached_page = NULL;
 	index = *ppos >> PAGE_CACHE_SHIFT;
 	next_index = index;
+	prev_index = ra.prev_page;
 	req_size = (desc->count + PAGE_CACHE_SIZE - 1) >> PAGE_CACHE_SHIFT;
 	offset = *ppos & ~PAGE_CACHE_MASK;
 
@@ -754,8 +756,9 @@
 		 * When (part of) the same page is read multiple times
 		 * in succession, only mark it as accessed the first time.
 		 */
-		if (ra.prev_page != index)
+		if (prev_index != index)
 			mark_page_accessed(page);
+		prev_index = index;
 
 		/*
 		 * Ok, we have the page, and it's up-to-date, so


                 reply	other threads:[~2005-01-12 22:51 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20050112224807.GA24154@cistron.nl \
    --to=miquels@cistron.nl \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    /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.