All of lore.kernel.org
 help / color / mirror / Atom feed
From: Christoph Rohland <cr@sap.com>
To: Marcelo Tosatti <marcelo@conectiva.com.br>
Cc: Linus Torvalds <torvalds@transmeta.com>
Cc: Zdenek Kabelac <kabi@informatics.muni.cz>,
	Douglas Gilbert <dougg@torque.net>,
	linux-kernel@vger.kernel.org, Zdenek Kabelac <kabi@fi.muni.cz>
Subject: Re: Oops with 2.4.0-test13pre3 - swapoff
Date: 22 Dec 2000 11:31:28 +0100	[thread overview]
Message-ID: <m3r930ycgm.fsf@linux.local> (raw)
In-Reply-To: <Pine.LNX.4.21.0012211500500.2199-100000@freak.distro.conectiva>
In-Reply-To: <Pine.LNX.4.21.0012211500500.2199-100000@freak.distro.conectiva>

Marcelo Tosatti <marcelo@conectiva.com.br> writes:

> Christoph is already looking at it and should have a fix soon.

Here it comes against 13-pre4 ...

We cannot call delete_from_swap_cache, it was called already in
try_to_unuse.

There is still a race when we page in the page which is
just freed in try_to_unuse. I am not sure how to fix this.

Also the add_to_page_cache forgot the offset  :-(

Greetings
                Christoph

--- 4-13-4/mm/shmem.c	Fri Dec 22 10:05:38 2000
+++ m4-13-4/mm/shmem.c	Fri Dec 22 10:47:11 2000
@@ -761,14 +761,16 @@
 	swp_entry_t **base, **ptr;
 	unsigned long idx;
 	int offset;
+	struct shmem_inode_info *info = &inode->u.shmem_i;
 	
 	idx = 0;
-	if ((offset = shmem_clear_swp (entry, inode->u.shmem_i.i_direct, SHMEM_NR_DIRECT)) >= 0)
+	spin_lock (&info->lock);
+	if ((offset = shmem_clear_swp (entry,info->i_direct, SHMEM_NR_DIRECT)) >= 0)
 		goto found;
 
 	idx = SHMEM_NR_DIRECT;
-	if (!(base = inode->u.shmem_i.i_indirect))
-		return 0;
+	if (!(base = info->i_indirect))
+		goto out;
 
 	for (ptr = base; ptr < base + ENTRIES_PER_PAGE; ptr++) {
 		if (*ptr &&
@@ -776,16 +778,16 @@
 			goto found;
 		idx += ENTRIES_PER_PAGE;
 	}
+out:
+	spin_unlock (&info->lock);
 	return 0;
 found:
-	delete_from_swap_cache (page);
-	add_to_page_cache (page, inode->i_mapping, idx);
+	add_to_page_cache (page, inode->i_mapping, offset + idx);
 	SetPageDirty (page);
 	SetPageUptodate (page);
 	UnlockPage (page);
-	spin_lock (&inode->u.shmem_i.lock);
-	inode->u.shmem_i.swapped--;
-	spin_unlock (&inode->u.shmem_i.lock);
+	info->swapped--;
+	spin_unlock (&info->lock);
 	return 1;
 }
 

-
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/

  reply	other threads:[~2000-12-22 11:04 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-12-20 14:16 Oops with 2.4.0-test13pre3 - swapoff Douglas Gilbert
2000-12-20 15:45 ` Zdenek Kabelac
2000-12-21 17:01   ` Marcelo Tosatti
2000-12-22 10:31     ` Christoph Rohland [this message]
  -- strict thread matches above, loose matches on Subject: below --
2000-12-19 12:28 Zdenek Kabelac

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=m3r930ycgm.fsf@linux.local \
    --to=cr@sap.com \
    --cc=marcelo@conectiva.com.br \
    --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.