All of lore.kernel.org
 help / color / mirror / Atom feed
From: Christoph Rohland <cr@sap.com>
To: Linus Torvalds <torvalds@transmeta.com>
Cc: Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: test13-pre3
Date: 18 Dec 2000 15:34:10 +0100	[thread overview]
Message-ID: <qwwelz5er31.fsf@sap.com> (raw)
In-Reply-To: <Pine.LNX.4.10.10012171353270.2052-100000@penguin.transmeta.com>
In-Reply-To: Linus Torvalds's message of "Sun, 17 Dec 2000 13:55:09 -0800 (PST)"

Hi Linus,

On Sun, 17 Dec 2000, Linus Torvalds wrote:
> The shmfs cleanup should be unnoticeable except to users who use SAP
> with huge shared memory segments, where Christoph Rohlands work not
> only makes the code much more readable, it should also make it
> dependable..

 :-)

The appended patch fixes the following:

1) We cannot unlock the page in shmem_writepage on ooswap since
   page_launder will do this later.

2) We should set the inode number of SYSV segments to the (user) shmid
   and not the internal id.

Greetings
		Christoph

diff -uNr 4-13-3/mm/shmem.c c/mm/shmem.c
--- 4-13-3/mm/shmem.c	Mon Dec 18 15:08:32 2000
+++ c/mm/shmem.c	Mon Dec 18 15:13:10 2000
@@ -210,37 +210,39 @@
 {
 	int error;
 	struct shmem_inode_info *info;
-	swp_entry_t *entry;
+	swp_entry_t *entry, swap;
 
 	info = &((struct inode *)page->mapping->host)->u.shmem_i;
 	if (info->locked)
 		return 1;
-	spin_lock(&info->lock);
-	entry = shmem_swp_entry (info, page->index);
-	if (!entry)	/* this had been allocted on page allocation */
-		BUG();
-	error = -EAGAIN;
-	if (entry->val)
-		goto out;
-
 	/*
 	 * 1 means "cannot write out".
 	 * We can't drop dirty pages
 	 * just because we ran out of
 	 * swap.
 	 */
-	error = 1;
-	*entry = __get_swap_page(2);
-	if (!entry->val)
+	swap = __get_swap_page(2);
+	if (!swap.val)
+		return 1;
+
+	spin_lock(&info->lock);
+	entry = shmem_swp_entry (info, page->index);
+	if (!entry)	/* this had been allocted on page allocation */
+		BUG();
+	error = -EAGAIN;
+	if (entry->val) {
+                __swap_free(swap, 2);
 		goto out;
+        }
 
+        *entry = swap;
 	error = 0;
 	/* Remove the from the page cache */
 	lru_cache_del(page);
 	remove_inode_page(page);
 
 	/* Add it to the swap cache */
-	add_to_swap_cache(page,*entry);
+	add_to_swap_cache(page, swap);
 	page_cache_release(page);
 	SetPageDirty(page);
 	info->swapped++;
diff -uNr 4-13-3/ipc/shm.c c/ipc/shm.c
--- 4-13-3/ipc/shm.c	Mon Dec 18 15:08:32 2000
+++ c/ipc/shm.c	Mon Dec 18 15:13:58 2000
@@ -220,7 +220,7 @@
 	shp->shm_segsz = size;
 	shp->id = shm_buildid(id,shp->shm_perm.seq);
 	shp->shm_file = file;
-	file->f_dentry->d_inode->i_ino = id;
+	file->f_dentry->d_inode->i_ino = shp->id;
 	file->f_op = &shm_file_operations;
 	shm_tot += numpages;
 	shm_unlock (id);
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

  parent reply	other threads:[~2000-12-18 15:05 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-12-17 21:55 test13-pre3 Linus Torvalds
2000-12-17 23:43 ` test13-pre3 Albert Cranford
2000-12-18  5:50   ` test13-pre3 woes J Sloan
2000-12-18  6:03     ` Niels Kristian Bech Jensen
2000-12-18  8:51       ` J Sloan
2000-12-18  9:19         ` Peter Samuelson
2000-12-18 14:27           ` Olaf Titz
2000-12-19  0:01             ` J Sloan
2000-12-20  6:02         ` J Sloan
2000-12-18  6:00   ` test13-pre3 Peter Samuelson
2000-12-18 12:58 ` test13-pre3 Maciej W. Rozycki
2000-12-18 14:34 ` Christoph Rohland [this message]
2000-12-18 19:24   ` test13-pre3 Christoph Rohland
  -- strict thread matches above, loose matches on Subject: below --
2000-12-18 17:35 test13-pre3 Petr Vandrovec
2000-12-18 17:18 ` test13-pre3 Maciej W. Rozycki
2000-12-19  0:58 test13-pre3 Dieter Nützel

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=qwwelz5er31.fsf@sap.com \
    --to=cr@sap.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@transmeta.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.