linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* Re: Suspend 2 merge: 43/51: Utility functions.
       [not found]   ` <20041125234635.GF2909@elf.ucw.cz>
@ 2004-11-26  0:04     ` Nigel Cunningham
  2004-11-27 16:11       ` Dave Hansen
  0 siblings, 1 reply; 3+ messages in thread
From: Nigel Cunningham @ 2004-11-26  0:04 UTC (permalink / raw)
  To: Pavel Machek, Linux Memory Management; +Cc: Linux Kernel Mailing List

Hi.

On Fri, 2004-11-26 at 10:46, Pavel Machek wrote:
> Hi!
> 
> > These are the routines that I think could possibly be useful elsewhere
> > too.
> > 
> > - A snprintf routine that returns the number of bytes actually put into
> > the buffer, not the number that would have been put in if the buffer was
> > big enough.
> > - Routine for finding a proc dir entry (we use it to find /proc/splash
> > when)
> > - Support routines for dynamically allocated pageflags. Save those
> > precious bits!
> 
> How many bits do you need? Two? I'd rather use thow two bits than have
> yet another abstraction. Also note that it is doing big order
> allocation.

Three if checksumming is enabled IIRC. I'll happily use normal page
flags, but we only need them when suspending, and I understood they were
rarer than hen's teeth :>

MM guys copied so they can tell me I'm wrong :>

Nigel
-- 
Nigel Cunningham
Pastoral Worker
Christian Reformed Church of Tuggeranong
PO Box 1004, Tuggeranong, ACT 2901

You see, at just the right time, when we were still powerless, Christ
died for the ungodly.		-- Romans 5:6

--
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-mm.org/ .
Don't email: <a href=mailto:"aart@kvack.org"> aart@kvack.org </a>

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

* Re: Suspend 2 merge: 43/51: Utility functions.
  2004-11-26  0:04     ` Suspend 2 merge: 43/51: Utility functions Nigel Cunningham
@ 2004-11-27 16:11       ` Dave Hansen
  2004-11-28 21:36         ` Nigel Cunningham
  0 siblings, 1 reply; 3+ messages in thread
From: Dave Hansen @ 2004-11-27 16:11 UTC (permalink / raw)
  To: ncunningham
  Cc: Pavel Machek, Linux Memory Management, Linux Kernel Mailing List

On Thu, 2004-11-25 at 16:04, Nigel Cunningham wrote:
> On Fri, 2004-11-26 at 10:46, Pavel Machek wrote:
> > How many bits do you need? Two? I'd rather use thow two bits than have
> > yet another abstraction. Also note that it is doing big order
> > allocation.
> 
> Three if checksumming is enabled IIRC. I'll happily use normal page
> flags, but we only need them when suspending, and I understood they were
> rarer than hen's teeth :>
> 
> MM guys copied so they can tell me I'm wrong :>

Please remember that, in almost all cases, any use of page->flags can be
replaced by a simple list.  Is a page marked foo?  Well, just traverse
this data structure and see if the page is in there.  It might be a
stinking slow check, but it will *work*.

I think we're up to using 1 bit in the memory hotplug code, but we don't
even need that if some operations can be implemented more slowly.  

An extreme example:

struct list_head foo;

int PageSuspendFoo(page)
{
	ret = 0;
	lock();
	list_for_each(foo, bar) {
		if (page == bar)
			ret = 1;
	}
	unlock();
	return ret;
}

-- Dave

--
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-mm.org/ .
Don't email: <a href=mailto:"aart@kvack.org"> aart@kvack.org </a>

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

* Re: Suspend 2 merge: 43/51: Utility functions.
  2004-11-27 16:11       ` Dave Hansen
@ 2004-11-28 21:36         ` Nigel Cunningham
  0 siblings, 0 replies; 3+ messages in thread
From: Nigel Cunningham @ 2004-11-28 21:36 UTC (permalink / raw)
  To: Dave Hansen
  Cc: Pavel Machek, Linux Memory Management, Linux Kernel Mailing List

Hi.

On Sun, 2004-11-28 at 03:11, Dave Hansen wrote:
> On Thu, 2004-11-25 at 16:04, Nigel Cunningham wrote:
> > On Fri, 2004-11-26 at 10:46, Pavel Machek wrote:
> > > How many bits do you need? Two? I'd rather use thow two bits than have
> > > yet another abstraction. Also note that it is doing big order
> > > allocation.
> > 
> > Three if checksumming is enabled IIRC. I'll happily use normal page
> > flags, but we only need them when suspending, and I understood they were
> > rarer than hen's teeth :>
> > 
> > MM guys copied so they can tell me I'm wrong :>
> 
> Please remember that, in almost all cases, any use of page->flags can be
> replaced by a simple list.  Is a page marked foo?  Well, just traverse
> this data structure and see if the page is in there.  It might be a
> stinking slow check, but it will *work*.
> 
> I think we're up to using 1 bit in the memory hotplug code, but we don't
> even need that if some operations can be implemented more slowly.  

Yes. That's the way suspending did things initially like checking which
pages were free. The bitmap was added to turn O(n^2) into O(n). Since
the calculations can potentially be done a few times (as memory is freed
so we can suspend), it was a big gain to use a bitmap.

Regards,

Nigel
-- 
Nigel Cunningham
Pastoral Worker
Christian Reformed Church of Tuggeranong
PO Box 1004, Tuggeranong, ACT 2901

You see, at just the right time, when we were still powerless, Christ
died for the ungodly.		-- Romans 5:6

--
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-mm.org/ .
Don't email: <a href=mailto:"aart@kvack.org"> aart@kvack.org </a>

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

end of thread, other threads:[~2004-11-28 21:36 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <1101292194.5805.180.camel@desktop.cunninghams>
     [not found] ` <1101299832.5805.371.camel@desktop.cunninghams>
     [not found]   ` <20041125234635.GF2909@elf.ucw.cz>
2004-11-26  0:04     ` Suspend 2 merge: 43/51: Utility functions Nigel Cunningham
2004-11-27 16:11       ` Dave Hansen
2004-11-28 21:36         ` Nigel Cunningham

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