All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ashwin Chaugule <ashwin.chaugule@celunite.com>
To: Andrew Morton <akpm@osdl.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>,
	linux-kernel@vger.kernel.org, Rik van Riel <riel@redhat.com>
Subject: [RFC][PATCH 1/2] grab swap token reordered
Date: Mon, 09 Oct 2006 01:53:41 +0530	[thread overview]
Message-ID: <1160339021.17751.23.camel@localhost.localdomain> (raw)
In-Reply-To: <20061002005905.a97a7b90.akpm@osdl.org>


This patch makes sure the contention for the token happens _before_ any
read-in and kicks the swap-token algo only when the VM is under
pressure.



Signed-off-by: Ashwin Chaugule <ashwin.chaugule@celunite.com>

--
diff --git a/mm/filemap.c b/mm/filemap.c
index afcdc72..c17b2ab 100644
--- a/mm/filemap.c
+++ b/mm/filemap.c
@@ -1479,7 +1479,6 @@ no_cached_page:
 	 * effect.
 	 */
 	error = page_cache_read(file, pgoff);
-	grab_swap_token();
 
 	/*
 	 * The page we want has now been added to the page cache.
diff --git a/mm/memory.c b/mm/memory.c
index 92a3ebd..4a877e9 100644
--- a/mm/memory.c
+++ b/mm/memory.c
@@ -1974,6 +1974,7 @@ static int do_swap_page(struct mm_struct
 	delayacct_set_flag(DELAYACCT_PF_SWAPIN);
 	page = lookup_swap_cache(entry);
 	if (!page) {
+		grab_swap_token(); /* Contend for token _before_ read-in */
  		swapin_readahead(entry, address, vma);
  		page = read_swap_cache_async(entry, vma, address);
 		if (!page) {
@@ -1991,7 +1992,6 @@ static int do_swap_page(struct mm_struct
 		/* Had to read the page from swap area: Major fault */
 		ret = VM_FAULT_MAJOR;
 		count_vm_event(PGMAJFAULT);
-		grab_swap_token();
 	}
 
 	delayacct_clear_flag(DELAYACCT_PF_SWAPIN);
--


  parent reply	other threads:[~2006-10-08 20:23 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-09-29 18:41 [RFC][PATCH 0/2] Swap token re-tuned Ashwin Chaugule
2006-10-01 22:56 ` Andrew Morton
2006-10-02  7:35   ` Peter Zijlstra
2006-10-02  7:59     ` Andrew Morton
2006-10-02  8:14       ` Peter Zijlstra
2006-10-03  7:32       ` Peter Zijlstra
2006-10-08 20:23       ` Ashwin Chaugule [this message]
2006-10-08 20:28       ` [RFC][PATCH 2/2] new scheme to preempt swap token Ashwin Chaugule
2006-10-02 11:00     ` [RFC][PATCH 0/2] Swap token re-tuned Ashwin Chaugule
2006-10-02 11:08       ` Peter Zijlstra
2006-10-02  8:20   ` Ashwin Chaugule
2006-10-02 10:00   ` Ashwin Chaugule

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=1160339021.17751.23.camel@localhost.localdomain \
    --to=ashwin.chaugule@celunite.com \
    --cc=a.p.zijlstra@chello.nl \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=riel@redhat.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.