Re: suspend-to-{RAM,disk} for 2.5.17

Pavel Machek (pavel@suse.cz)
Wed, 29 May 2002 00:00:32 +0200


Hi!

> >> Actually, I just thought of something that might be useful in addition,
> >> which is that it would probably only be necessary to search inside of
> >> page_zone(page), do you agree?
>
> On Tue, May 28, 2002 at 11:34:08PM +0200, Pavel Machek wrote:
> > Hey, speeding this up is not a top priority. But.. if we can make it
> > simpler as well ... ;-).
>
> Yeah, system startup/shutdown isn't really something to optimize for
> aside from dodging some worst cases (which is not relevant here).
>
>
> On Tue, May 28, 2002 at 11:34:08PM +0200, Pavel Machek wrote:
> > #ifdef CONFIG_SOFTWARE_SUSPEND
> > int is_head_of_free_region(struct page *page)
> > {
> > zone_t *zone = page_zone(page);
> > unsigned long flags;
> > int order;
> > list_t *curr;
> >
> > /*
> > * Should not matter as we need quiescent system for
> > * suspend anyway, but...
> > */
> > spin_lock_irqsave(&zone->lock, flags);
> > for (order = MAX_ORDER - 1; order >= 0; --order)
> > list_for_each(curr, &zone->free_area[order].free_list){
> > if (!curr)
> > break;
> > if (page == list_entry(curr, struct page,list)) {
> > spin_unlock_irqrestore(&zone->lock,flags);
> > return 1 << order;
> > }
> > }
> > spin_unlock_irqrestore(&zone->lock, flags);
> > return 0;
> > }
> > #endif /* CONFIG_SOFTWARE_SUSPEND */
> > Does that look okay to you?
> > Pavel
>
> This looks good, though OTOH if we have a page from a zone we should know
> the zone exists, and then maybe the if (!curr) check isn't
> >> needed. If that's

Good point. Killed.

> the case the scary check that almost looks like defensive programming won't
> be needed at all. Also, is it always expected that this will be a
> free page?

No. It may be used page, too. That's why it is asking.
Pavel

-- 
Casualities in World Trade Center: ~3k dead inside the building,
cryptography in U.S.A. and free speech in Czech Republic.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/