linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: "Stephen C. Tweedie" <sct@dcs.ed.ac.uk>
To: Stephane Casset <sept@renass3.u-strasbg.fr>
Cc: "Stephen C. Tweedie" <sct@dcs.ed.ac.uk>,
	linux-kernel@vger.rutgers.edu, linux-mm@kvack.org
Subject: Re: PATCH: Swap shared pages (was: How to read-protect a vm_area?)
Date: Tue, 24 Feb 1998 23:38:05 GMT	[thread overview]
Message-ID: <199802242338.XAA03259@dax.dcs.ed.ac.uk> (raw)
In-Reply-To: <Pine.LNX.3.96.980224152231.7112A-100000@renass3.u-strasbg.fr>

On Tue, 24 Feb 1998 15:31:37 +0000 (GMT), Stephane Casset
<sept@renass3.u-strasbg.fr> said:

>> The patch below, against 2.1.88, adds a bunch of new functionality to
>> the swapper.  The main changes are:

> I tried it but got the following message :
> ipc/ipc.o: In function `shm_swap_in':
> ipc/ipc.o(.text+0x37e4): undefined reference to `read_swap_page'
> ipc/ipc.o: In function `shm_swap':
> ipc/ipc.o(.text+0x3b57): undefined reference to `write_swap_page'
> make: *** [vmlinux] Error 1

The diff below includes a patch against ipc/shm.c was missing from my
first post, and another fix for spurious warnings about shared dirty
pages.

Cheers,
 Stephen.
----------------------------------------------------------------
Index: ipc/shm.c
===================================================================
RCS file: /home/rcs/CVS/kswap3/linux/ipc/shm.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- shm.c	1998/02/24 08:50:30	1.1
+++ shm.c	1998/02/24 08:51:37	1.2
@@ -689,7 +689,7 @@
 			goto done;
 		}
 		if (!pte_none(pte)) {
-			read_swap_page(pte_val(pte), (char *) page);
+			rw_swap_page_nocache(READ, pte_val(pte), (char *)page);
 			pte = __pte(shp->shm_pages[idx]);
 			if (pte_present(pte))  {
 				free_page (page); /* doesn't sleep */
@@ -820,7 +820,7 @@
 	if (atomic_read(&mem_map[MAP_NR(pte_page(page))].count) != 1)
 		goto check_table;
 	shp->shm_pages[idx] = swap_nr;
-	write_swap_page (swap_nr, (char *) pte_page(page));
+	rw_swap_page_nocache (WRITE, swap_nr, (char *) pte_page(page));
 	free_page(pte_page(page));
 	swap_successes++;
 	shm_swp++;
Index: mm/page_io.c
===================================================================
RCS file: /home/rcs/CVS/kswap3/linux/mm/page_io.c,v
retrieving revision 1.4
diff -u -r1.4 page_io.c
--- page_io.c	1998/02/23 22:14:27	1.4
+++ page_io.c	1998/02/24 09:28:08
@@ -201,7 +201,9 @@
 	}
 	page->inode = &swapper_inode;
 	page->offset = entry;
+	atomic_inc(&page->count);	/* Protect from shrink_mmap() */
 	rw_swap_page(rw, entry, buffer, 1);
+	atomic_dec(&page->count);
 	page->inode = 0;
 	clear_bit(PG_swap_cache, &page->flags);
 }
Index: mm/vmscan.c
===================================================================
RCS file: /home/rcs/CVS/kswap3/linux/mm/vmscan.c,v
retrieving revision 1.5
diff -u -r1.5 vmscan.c
--- vmscan.c	1998/02/23 22:14:28	1.5
+++ vmscan.c	1998/02/24 09:22:47
@@ -108,18 +108,16 @@
 	 *
 	 * -- Stephen Tweedie 1998 */
 
-	if (pte_write(pte)) {
-		/* 
-		 * We _will_ allow dirty cached mappings later on, once
-		 * MAP_SHARED|MAP_ANONYMOUS is working, but for now
-		 * catch this as a bug.
-		 */
-		if (is_page_shared(page_map)) {
-			printk ("VM: Found a shared writable dirty page!\n");
+	if (PageSwapCache(page_map)) {
+		if (pte_write(pte)) {
+			printk ("VM: Found a writable swap-cached page!\n");
 			return 0;
 		}
-		if (PageSwapCache(page_map)) {
-			printk ("VM: Found a writable swap-cached page!\n");
+		/* We _will_ allow dirty cached mappings later
+		 * on, once MAP_SHARED|MAP_ANONYMOUS is working,
+		 * but for now catch this as a bug.  */
+		if (is_page_shared(page_map)) {
+			printk ("VM: Found a shared writable dirty page!\n");
 			return 0;
 		}
 	}
----------------------------------------------------------------

      parent reply	other threads:[~1998-02-24 23:40 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <199802192321.XAA06580@dax.dcs.ed.ac.uk>
1998-02-20  5:41 ` How to read-protect a vm_area? Benjamin C.R. LaHaise
1998-02-23 23:17   ` PATCH: Swap shared pages (was: How to read-protect a vm_area?) Stephen C. Tweedie
1998-02-23 23:27     ` Linus Torvalds
1998-02-24  0:08     ` Benjamin C.R. LaHaise
1998-02-24  9:45       ` Stephen C. Tweedie
1998-02-24  9:42     ` Rik van Riel
1998-02-24 23:38       ` Stephen C. Tweedie
1998-02-25 10:41         ` Rik van Riel
1998-02-25 19:00           ` Stephen C. Tweedie
1998-02-25 22:05             ` Rik van Riel
1998-02-24 11:16     ` Thomas Sailer
     [not found]     ` <Pine.LNX.3.96.980224152231.7112A-100000@renass3.u-strasbg.fr>
1998-02-24 23:38       ` Stephen C. Tweedie [this message]

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=199802242338.XAA03259@dax.dcs.ed.ac.uk \
    --to=sct@dcs.ed.ac.uk \
    --cc=linux-kernel@vger.rutgers.edu \
    --cc=linux-mm@kvack.org \
    --cc=sept@renass3.u-strasbg.fr \
    /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