linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Andrea Arcangeli <andrea@e-mind.com>
To: "Stephen C. Tweedie" <sct@redhat.com>
Cc: Rik van Riel <riel@nl.linux.org>,
	Matthias Arnold <Matthias.Arnold@edda.imsid.uni-jena.de>,
	Linux MM <linux-mm@kvack.org>
Subject: Re: LINUX-MM
Date: Wed, 24 Mar 1999 18:14:02 +0100 (CET)	[thread overview]
Message-ID: <Pine.LNX.4.05.9903241811530.1388-100000@laser.random> (raw)
In-Reply-To: <14072.61217.315938.743360@dukat.scot.redhat.com>

On Wed, 24 Mar 1999, Stephen C. Tweedie wrote:

>Hi,
>
>On Wed, 24 Mar 1999 01:33:53 +0100 (CET), Rik van Riel
><riel@nl.linux.org> said:
>
>> It is a bug when it causes other programs to fail
>> miserably...
>
>Does this happen, and if so, in what way?

I don't think that can happens. Anyway I just have a patch to return to
the old behavior, but I can't see any difference here (except that we
won't do the work on demand).

Just for the record my patch is this, probably it won't apply cleanly but
upporting it, it's trivial.

Index: linux/include/linux/swap.h
diff -c linux/include/linux/swap.h:1.1.1.1.14.3 linux/include/linux/swap.h:1.1.1.1.14.4
*** linux/include/linux/swap.h:1.1.1.1.14.3	Thu Oct 29 19:42:56 1998
--- linux/include/linux/swap.h	Sun Nov  1 18:20:48 1998
***************
*** 90,95 ****
--- 90,96 ----
  extern struct page * read_swap_cache_async(unsigned long, int);
  #define read_swap_cache(entry) read_swap_cache_async(entry, 1);
  extern int FASTCALL(swap_count(unsigned long));
+ extern void FASTCALL(try_to_free_last_swap_entry(unsigned long));
  /*
   * Make these inline later once they are working properly.
   */
Index: linux/mm/swap_state.c
diff -c linux/mm/swap_state.c:1.1.1.1.14.4 linux/mm/swap_state.c:1.1.1.1.14.5
*** linux/mm/swap_state.c:1.1.1.1.14.4	Fri Oct 30 19:11:15 1998
--- linux/mm/swap_state.c	Sun Nov  1 18:20:50 1998
***************
*** 287,292 ****
--- 287,316 ----
  	return 0;
  }
  
+ void try_to_free_last_swap_entry(unsigned long entry)
+ {
+ 	struct page * page = lookup_swap_cache(entry);
+ 	if (page)
+ 	{
+ 		/*
+ 		 * The last reference in the swap_map[entry] is caused
+ 		 * by this swap cache page.
+ 		 *
+ 		 * Decrease the page->count increased by __find_page().
+ 		 *						-arca
+ 		 */
+ 		__free_page(page);
+ 		if (atomic_read(&page->count) == 1)
+ 			/*
+ 			 * The page is resident in memory only because
+ 			 * it' s in the swap cache so we can remove it
+ 			 * because it can' t be useful anymore.
+ 			 *					-arca
+ 			 */
+ 			delete_from_swap_cache(page);
+ 	}
+ }
+ 
  /* 
   * Locate a page of swap in physical memory, reserving swap cache space
   * and reading the disk if it is not already cached.  If wait==0, we are
Index: linux/mm/swapfile.c
diff -c linux/mm/swapfile.c:1.1.1.1 linux/mm/swapfile.c:1.1.1.1.16.1
*** linux/mm/swapfile.c:1.1.1.1	Fri Oct  2 19:22:39 1998
--- linux/mm/swapfile.c	Sun Nov  1 18:20:50 1998
***************
*** 144,153 ****
  		p->highest_bit = offset;
  	if (!p->swap_map[offset])
  		goto bad_free;
! 	if (p->swap_map[offset] < SWAP_MAP_MAX) {
! 		if (!--p->swap_map[offset])
  			nr_swap_pages++;
! 	}
  #ifdef DEBUG_SWAP
  	printk("DebugVM: swap_free(entry %08lx, count now %d)\n",
  	       entry, p->swap_map[offset]);
--- 144,158 ----
  		p->highest_bit = offset;
  	if (!p->swap_map[offset])
  		goto bad_free;
! 	if (p->swap_map[offset] < SWAP_MAP_MAX)
! 		switch(--p->swap_map[offset])
! 		{
! 		case 0:
  			nr_swap_pages++;
! 			break;
! 		case 1:
! 			try_to_free_last_swap_entry(entry);
! 		}
  #ifdef DEBUG_SWAP
  	printk("DebugVM: swap_free(entry %08lx, count now %d)\n",
  	       entry, p->swap_map[offset]);

Andrea Arcangeli

--
To unsubscribe, send a message with 'unsubscribe linux-mm my@address'
in the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://humbolt.geo.uu.nl/Linux-MM/

      reply	other threads:[~1999-03-24 17:14 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <36F7A0CD.C1361112@imsid.uni-jena.de>
1999-03-23 14:16 ` LINUX-MM Rik van Riel
1999-03-23 15:49   ` LINUX-MM Kev
1999-03-23 16:31     ` LINUX-MM Kev
1999-03-23 17:32     ` LINUX-MM Stephen C. Tweedie
     [not found]       ` <36F895C4.1801DBE6@imsid.uni-jena.de>
     [not found]         ` <14072.61375.667166.523842@dukat.scot.redhat.com>
     [not found]           ` <36F8F7DD.6DF9E048@imsid.uni-jena.de>
1999-03-24 14:38             ` LINUX-MM Stephen C. Tweedie
1999-03-24  0:23   ` LINUX-MM Andrea Arcangeli
1999-03-24  0:33     ` LINUX-MM Rik van Riel
1999-03-24 13:56       ` LINUX-MM Stephen C. Tweedie
1999-03-24 17:14         ` Andrea Arcangeli [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=Pine.LNX.4.05.9903241811530.1388-100000@laser.random \
    --to=andrea@e-mind.com \
    --cc=Matthias.Arnold@edda.imsid.uni-jena.de \
    --cc=linux-mm@kvack.org \
    --cc=riel@nl.linux.org \
    --cc=sct@redhat.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