Skip to contentSkip to conversation

__get_free_pages problem, system then hangs

DISCUSSION Jiri Slaby 1 participant 1 message Mar 30, 2006

lore
Share & tools
lore

Jiri Slaby

author
#0 lore raw

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hello,

I am trying to get pages as memory place with code like this one:

        mem = __get_free_pages(GFP_KERNEL | __GFP_ZERO, get_order(size));
        if (mem == 0ul)
                goto end;

        page = virt_to_page(mem);

        for (i = 0; i < (1 << get_order(size)); i++, page++) {
                get_page(page);
                SetPageReserved(page);
                SetPageLocked(page);
        }

What's wrong with `for' loop? When I am trying to mark them as reserved or whatever you see there, the system hangs in few moments (some oopses with memory allocation, obviously).

The problem disappears if:
a) get pages is called with __GFP_COMP flag and then it's sufficient to mark only the first page (the rest is "bounded" to that one), but even if I mark all, the problem doesn't appear,
b) I mark only the first page -- it's not what I want, I suppose

Size is 11k i. e. order is 2 (actually, 3 pages are needed) on my i386 system.

Could somebody tell me what am I still missing?

thanks,
- --
Jiri Slaby www.fi.muni.cz/~xslaby
~\-/~ [email protected] ~\-/~
B67499670407CE62ACC8 22A032CC55C339D47A7E

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2.2 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org

iD8DBQFELBoVMsxVwznUen4RAoV+AJ0cPRrb7dLyIUPN0RkSpGVhD8LQmQCfelAJ XDbNydUdRGHHJcN48A0Eib4=
=8vx7
-----END PGP SIGNATURE-----