linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* free_memory_available() bug in pre-91-1
@ 1998-03-24 23:03 H.H.vanRiel
  1998-03-25 23:40 ` Linus Torvalds
  0 siblings, 1 reply; 3+ messages in thread
From: H.H.vanRiel @ 1998-03-24 23:03 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: linux-mm

Hi Linus,

I've just found a bug in free_memory_available() as
implemented in pre-91-1...
It reacts the same on finding _no_ free item on a list
as it reacts on _multiple_ free items on the list.
So it'll return the same value regardless of whether
there is lots of free memory or there's no free memory...
(notice the 'break;' at two places...)

	do {
		list--;
		/* Empty list? Bad - we need more memory */
		if (list->next == memory_head(list))
			break;
		/* One item on the list? Look further */
		if (list->next->next == memory_head(list))
			continue;
		/* More than one item? We're ok */
		break;
	} while (--nr >= 0);
	spin_unlock_irqrestore(&page_alloc_lock, flags);
	return nr + 1;
}

Rik.
+-------------------------------------------+--------------------------+
| Linux: - LinuxHQ MM-patches page          | Scouting       webmaster |
|        - kswapd ask-him & complain-to guy | Vries    cubscout leader |
|     http://www.fys.ruu.nl/~riel/          | <H.H.vanRiel@fys.ruu.nl> |
+-------------------------------------------+--------------------------+

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: free_memory_available() bug in pre-91-1
  1998-03-24 23:03 free_memory_available() bug in pre-91-1 H.H.vanRiel
@ 1998-03-25 23:40 ` Linus Torvalds
  1998-03-26  9:08   ` Rik van Riel
  0 siblings, 1 reply; 3+ messages in thread
From: Linus Torvalds @ 1998-03-25 23:40 UTC (permalink / raw)
  To: H.H.vanRiel; +Cc: linux-mm



On Wed, 25 Mar 1998, H.H.vanRiel wrote:
> 
> I've just found a bug in free_memory_available() as
> implemented in pre-91-1...

Ugh, yes. How about pre-91-2, which I just put out? It has more of the
code the way I _think_ it should be, and it should try a lot harder to not
hog the CPU with kswapd. 

On a 512MB machine, the "tries" variable easily defaulted to try to page
out 8192 pages at a time, which was what we in the business call "Bad For
Interactive Use" (TM). The new one tries to throw out much fewer pages,
and is happier about being called more often - so kswapd really should be
more of a "background" thing rather than quite easily becoming
foregrounded.

All of this is completely untested in real life, but has gone through the
very strict "Looks Ok To Me" bs-filter. Thus it is obviously perfect and
can have no bugs. As such everybody should immediately upgrade and be
happy forever after. 

		Linus

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: free_memory_available() bug in pre-91-1
  1998-03-25 23:40 ` Linus Torvalds
@ 1998-03-26  9:08   ` Rik van Riel
  0 siblings, 0 replies; 3+ messages in thread
From: Rik van Riel @ 1998-03-26  9:08 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: linux-mm

On Wed, 25 Mar 1998, Linus Torvalds wrote:

> On Wed, 25 Mar 1998, H.H.vanRiel wrote:
> > 
> > I've just found a bug in free_memory_available() as
> > implemented in pre-91-1...
> 
> Ugh, yes. How about pre-91-2, which I just put out? It has more of the
> code the way I _think_ it should be, and it should try a lot harder to not
> hog the CPU with kswapd. 

Actually, I was referring to the fact that free_memory_available()
returns 3 when there's not a single 128k area available...
In that case, it should return 2.

But I'll try pre-91-2.

Rik.
+-------------------------------------------+--------------------------+
| Linux: - LinuxHQ MM-patches page          | Scouting       webmaster |
|        - kswapd ask-him & complain-to guy | Vries    cubscout leader |
|     http://www.fys.ruu.nl/~riel/          | <H.H.vanRiel@fys.ruu.nl> |
+-------------------------------------------+--------------------------+

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~1998-03-26  9:14 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1998-03-24 23:03 free_memory_available() bug in pre-91-1 H.H.vanRiel
1998-03-25 23:40 ` Linus Torvalds
1998-03-26  9:08   ` Rik van Riel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox