linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: "Juan J. Quintela" <quintela@fi.udc.es>
To: Linus Torvalds <torvalds@transmeta.com>
Cc: linux-mm@kvack.org, Andrea Arcangeli <andrea@suse.de>,
	Kanoj Sarcar <kanoj@google.engr.sgi.com>
Subject: Re: Oops in __free_pages_ok (pre7-1) (Long)
Date: 03 May 2000 00:06:01 +0200	[thread overview]
Message-ID: <yttwvlczjxy.fsf@vexeta.dc.fi.udc.es> (raw)
In-Reply-To: Linus Torvalds's message of "Tue, 2 May 2000 14:40:34 -0700 (PDT)"

>>>>> "linus" == Linus Torvalds <torvalds@transmeta.com> writes:

Hi

>> If you want the patch for get rid of PG_swap_entry, I can do it and send it to
>> you.

linus> I'd rather get rid of it entirely, yes, as I hate having "crud" around
linus> that nobody realizes isn't really even active any more (and your one-liner
linus> de-activates the whole thing as far as I can tell).

Attached is the patch that removes all the PG_swap_entry logic, the
*SwapEntry macros, and the acquire_swap_entry function.  This function
becomes a call to get_swap_page.  I have substituted that.

Later, Juan.

diff -u -urN --exclude=CVS --exclude=*~ --exclude=.#* pre7-1/include/linux/mm.h swap_entry/include/linux/mm.h
--- pre7-1/include/linux/mm.h	Sat Apr 29 20:53:36 2000
+++ swap_entry/include/linux/mm.h	Tue May  2 23:51:16 2000
@@ -173,7 +173,7 @@
 #define PG_slab			 8
 #define PG_swap_cache		 9
 #define PG_skip			10
-#define PG_swap_entry		11
+#define PG_unused_03		11
 #define PG_highmem		12
 				/* bits 21-30 unused */
 #define PG_reserved		31
@@ -210,9 +210,6 @@
 #define PageClearSwapCache(page)	clear_bit(PG_swap_cache, &(page)->flags)
 
 #define PageTestandClearSwapCache(page)	test_and_clear_bit(PG_swap_cache, &(page)->flags)
-#define PageSwapEntry(page)		test_bit(PG_swap_entry, &(page)->flags)
-#define SetPageSwapEntry(page)		set_bit(PG_swap_entry, &(page)->flags)
-#define ClearPageSwapEntry(page)	clear_bit(PG_swap_entry, &(page)->flags)
 
 #ifdef CONFIG_HIGHMEM
 #define PageHighMem(page)		test_bit(PG_highmem, &(page)->flags)
diff -u -urN --exclude=CVS --exclude=*~ --exclude=.#* pre7-1/include/linux/swap.h swap_entry/include/linux/swap.h
--- pre7-1/include/linux/swap.h	Thu Apr 27 00:29:07 2000
+++ swap_entry/include/linux/swap.h	Tue May  2 23:54:50 2000
@@ -121,7 +121,6 @@
 					struct inode **);
 extern int swap_duplicate(swp_entry_t);
 extern int swap_count(struct page *);
-extern swp_entry_t acquire_swap_entry(struct page *page);
 extern int valid_swaphandles(swp_entry_t, unsigned long *);
 #define get_swap_page() __get_swap_page(1)
 extern void __swap_free(swp_entry_t, unsigned short);
diff -u -urN --exclude=CVS --exclude=*~ --exclude=.#* pre7-1/mm/memory.c swap_entry/mm/memory.c
--- pre7-1/mm/memory.c	Tue Apr 25 00:46:18 2000
+++ swap_entry/mm/memory.c	Tue May  2 23:51:53 2000
@@ -1053,8 +1053,6 @@
 
 	pte = mk_pte(page, vma->vm_page_prot);
 
-	SetPageSwapEntry(page);
-
 	/*
 	 * Freeze the "shared"ness of the page, ie page_count + swap_count.
 	 * Must lock page before transferring our swap count to already
diff -u -urN --exclude=CVS --exclude=*~ --exclude=.#* pre7-1/mm/swap_state.c swap_entry/mm/swap_state.c
--- pre7-1/mm/swap_state.c	Wed Apr 26 02:28:56 2000
+++ swap_entry/mm/swap_state.c	Tue May  2 23:52:39 2000
@@ -130,9 +130,6 @@
 		}
 		UnlockPage(page);
 	}
-
-	ClearPageSwapEntry(page);
-
 	__free_page(page);
 }
 
diff -u -urN --exclude=CVS --exclude=*~ --exclude=.#* pre7-1/mm/swapfile.c swap_entry/mm/swapfile.c
--- pre7-1/mm/swapfile.c	Fri Apr 21 22:36:40 2000
+++ swap_entry/mm/swapfile.c	Tue May  2 23:54:44 2000
@@ -200,49 +200,6 @@
 	goto out;
 }
 
-/* needs the big kernel lock */
-swp_entry_t acquire_swap_entry(struct page *page)
-{
-	struct swap_info_struct * p;
-	unsigned long offset, type;
-	swp_entry_t entry;
-
-	if (!PageSwapEntry(page))
-		goto new_swap_entry;
-
-	/* We have the old entry in the page offset still */
-	if (!page->index)
-		goto new_swap_entry;
-	entry.val = page->index;
-	type = SWP_TYPE(entry);
-	if (type >= nr_swapfiles)
-		goto new_swap_entry;
-	p = type + swap_info;
-	if ((p->flags & SWP_WRITEOK) != SWP_WRITEOK)
-		goto new_swap_entry;
-	offset = SWP_OFFSET(entry);
-	if (offset >= p->max)
-		goto new_swap_entry;
-	/* Has it been re-used for something else? */
-	swap_list_lock();
-	swap_device_lock(p);
-	if (p->swap_map[offset])
-		goto unlock_new_swap_entry;
-
-	/* We're cool, we can just use the old one */
-	p->swap_map[offset] = 1;
-	swap_device_unlock(p);
-	nr_swap_pages--;
-	swap_list_unlock();
-	return entry;
-
-unlock_new_swap_entry:
-	swap_device_unlock(p);
-	swap_list_unlock();
-new_swap_entry:
-	return get_swap_page();
-}
-
 /*
  * The swap entry has been read in advance, and we return 1 to indicate
  * that the page has been used or is no longer needed.
diff -u -urN --exclude=CVS --exclude=*~ --exclude=.#* pre7-1/mm/vmscan.c swap_entry/mm/vmscan.c
--- pre7-1/mm/vmscan.c	Sat Apr 29 20:53:36 2000
+++ swap_entry/mm/vmscan.c	Tue May  2 23:54:36 2000
@@ -151,7 +151,7 @@
 	 * we have the swap cache set up to associate the
 	 * page with that swap entry.
 	 */
-	entry = acquire_swap_entry(page);
+	entry = get_swap_page();
 	if (!entry.val)
 		goto out_failed; /* No swap space left */
 		




-- 
In theory, practice and theory are the same, but in practice they 
are different -- Larry McVoy
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux.eu.org/Linux-MM/

  reply	other threads:[~2000-05-02 22:06 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-05-02  1:08 Juan J. Quintela
2000-05-02 20:43 ` Linus Torvalds
2000-05-02 21:31   ` Juan J. Quintela
2000-05-02 21:40     ` Linus Torvalds
2000-05-02 22:06       ` Juan J. Quintela [this message]
2000-05-02 22:26       ` Andrea Arcangeli
2000-05-03  0:38         ` Andrea Arcangeli
2000-05-03  0:45           ` Linus Torvalds
2000-05-03  1:28             ` Andrea Arcangeli
2000-05-03 10:37           ` Rik van Riel
2000-05-02 22:02     ` Andrea Arcangeli
2000-05-02 22:13       ` Juan J. Quintela
2000-05-03  0:43       ` Andrea Arcangeli
2000-05-02 22:54     ` Andrea Arcangeli
2000-05-02 22:08 ` Andrea Arcangeli
2000-05-02 23:58   ` Juan J. Quintela

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=yttwvlczjxy.fsf@vexeta.dc.fi.udc.es \
    --to=quintela@fi.udc.es \
    --cc=andrea@suse.de \
    --cc=kanoj@google.engr.sgi.com \
    --cc=linux-mm@kvack.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox