public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Christoph Rohland <cr@sap.com>
To: Linus Torvalds <torvalds@transmeta.com>
Cc: Marcelo Tosatti <marcelo@conectiva.com.br>, linux-kernel@vger.kernel.org
Subject: Re: [Patch] shmem_unuse race fix
Date: 28 Dec 2000 13:02:07 +0100	[thread overview]
Message-ID: <m31yuswyig.fsf@linux.local> (raw)
In-Reply-To: <Pine.LNX.4.21.0012272025190.528-100000@dual.transmeta.com>

Linus Torvalds <torvalds@transmeta.com> writes:

> On 27 Dec 2000, Christoph Rohland wrote:
> Woul dyou mind testing this alternate fix instead:

Does not work, but is the right direction I think.

First we need the following patch since otherwise we use a swap entry
without having the count increased:

--- 4-13-4/mm/vmscan.c  Fri Dec 22 10:05:38 2000
+++ m4-13-4/mm/vmscan.c Thu Dec 28 11:57:57 2000
@@ -93,8 +93,8 @@
                entry.val = page->index;
                if (pte_dirty(pte))
                        SetPageDirty(page);
-set_swap_pte:
                swap_duplicate(entry);
+set_swap_pte:
                set_pte(page_table, swp_entry_to_pte(entry));
 drop_pte:
                UnlockPage(page);
@@ -185,7 +185,7 @@
         * we have the swap cache set up to associate the
         * page with that swap entry.
         */
-       entry = get_swap_page();
+       entry = __get_swap_page(2);
        if (!entry.val)
                goto out_unlock_restore; /* No swap space left */


Second there look at this in handle_pte_fault:

		/*
		 * If it truly wasn't present, we know that kswapd
		 * and the PTE updates will not touch it later. So
		 * drop the lock.
		 */
		spin_unlock(&mm->page_table_lock);
		if (pte_none(entry))
			return do_no_page(mm, vma, address, write_access, pte);
		return do_swap_page(mm, vma, address, pte, pte_to_swp_entry(entry), write_access);

The comment is wrong. try_to_unuse will touch it. This stumbles over a
bad swap entry after try_to_unuse complaining about an undead swap
entry.

If I retry in try_to_unuse it goes into an infinite loop since it
deadlocks with this.

Ideas?
        Christoph

-
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-28 12:30 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-12-27 10:32 [Patch] shmem_unuse race fix Christoph Rohland
2000-12-27 15:14 ` Marcelo Tosatti
2000-12-27 18:36   ` Christoph Rohland
2000-12-28  4:35     ` Linus Torvalds
2000-12-28 12:02       ` Christoph Rohland [this message]
2000-12-28 18:07         ` Linus Torvalds
2000-12-28 22:13           ` Christoph Rohland

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=m31yuswyig.fsf@linux.local \
    --to=cr@sap.com \
    --cc=linux-kernel@vger.kernel.org \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox