Re: [swsusp] Rework image freeing

From: Andrew Morton
Date: Wed Sep 21 2005 - 16:32:27 EST


Pavel Machek <pavel@xxxxxx> wrote:
>
> Hi!
>
> > >
> > > + for_each_zone(zone) {
> > > + for (zone_pfn = 0; zone_pfn < zone->spanned_pages; ++zone_pfn) {
> > > + struct page * page;
> > > + page = pfn_to_page(zone_pfn + zone->zone_start_pfn);
> > > + if (PageNosave(page) && PageNosaveFree(page)) {
> > > + ClearPageNosave(page);
> > > + ClearPageNosaveFree(page);
> > > + free_page((long) page_address(page));
> > > + }
> >
> > There doesn't seem to be much point in converting the pageframe address to
> > a virtual address, then back to a pageframe address. Why not just do
> > put_page() here?
>
> I do not know what put_page does, and free_page() has some friendly
> BUG_ONs. But if I should just do put_page(page); instead of
> free_page((long) page_address(page)), that is okay with me.

I don't know what alloc_pages() and free_page[s]() are supposed to do either
really. They date from when Linus was in diapers. They talk in terms of
kernel virtual addresses and will explode loudly if used for highmem pages.

All modern code will use page*'s or pfn's.

> [Sound of harddrive seeking and CPU fan going up as test kernel
> compiles].
>

Ah, I wondered what it was.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/