What happened to try_to_swap_out()?
Hi,
Sorry for the newbie-like question, but I didn't know where else I should ask this question.
I'm porting our driver from 2.4 to 2.6, and during the development for 2.4, one of the other software engineers discovered a possible bug in try_to_swap_out() in mm/vmscan.c. I don't have all the details, but it's something about that function swapping out reserved pages, which I presume it shouldn't do. Because of this bug, we had to implement a work-around in our driver.
Anyway, I'm trying to determine if that bug still exists in 2.6. We'll run tests, of course, but I wanted to look at the code to see if the problem is still there. Unfortunately, that function doesn't exist in 2.6, and I can't figure out what it's replacement is. Obviously, there is no single replacement function, but I was hoping someone could give me a quick rundown as to where that code went.
Also, I noticed that RedHat 9.0 doesn't have try_to_swap_out() either. I guess they ported some 2.6 code to 2.4. Can anyone corroborate that?
Signature · 8 lines
Timur Tabi Staff Software Engineer [email protected] -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Quoted 3 lines · Timur Tabi
it's something about that function swapping out reserved pages, which I presume it shouldn't do. Because of this bug, we had to implement a work-around in our driver.
Looks like the bug is in your driver, not the VM.
The VMA that maps such pages should be set VM_RESERVED (or whatever the name of that flag was)
Quoted 2 lines
Also, I noticed that RedHat 9.0 doesn't have
try_to_swap_out()either. I guess they ported some 2.6 code to 2.4. Can anyone corroborate that?
Yes.
Signature · 9 lines
"Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it." - Brian W. Kernighan -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Quoted 4 lines · Rik van Riel
Looks like the bug is in your driver, not the VM.
The VMA that maps such pages should be set
VM_RESERVED(or whatever the name of that flag was)
I called map_user_kiobuf to get the pages. Shouldn't that be enough?
Quoted 3 lines
Quoted 1 line
Also, I noticed that RedHat 9.0 doesn't have
try_to_swap_out()either. I guess they ported some 2.6 code to 2.4. Can anyone corroborate that?Yes.
Is there a name for the patch they applied to 2.4 to make it look like 2.6?
Signature · 8 lines
Timur Tabi Staff Software Engineer [email protected] -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Do I need SetPageReserved() after map_user_kiobuf()? (was: What happened to try_to_swap_out()?)
In reply to Rik van RielQuoted 4 lines · Rik van Riel
Looks like the bug is in your driver, not the VM.
The VMA that maps such pages should be set
VM_RESERVED(or whatever the name of that flag was)
Ok, I've examined our code further and discovered a few things.
The previous developer apparently realized that the pages need to be marked reserved after a call to map_user_kiobuf(). However, his comments indicate that this is a work-around for the "kiobuf bug". Am I to assume that you don't consider this a bug in map_user_kiobuf()?
This is the code that we run after map_user_kiobuf().
int i;
for (i = 0; i < kiobuf->nr_pages; i++)
SetPageReserved(kiobuf->maplist[i]);Also, since we're porting to 2.6, we're going to replace map_user_kiobuf() with get_user_pages(). Will we still need to call SetPageReserved()? Unfortunately, I don't have a good enough understanding of the Linux VM to know exactly what get_user_pages() is doing. For example, this code confuses me:
if (!PageReserved(pages[i]))
page_cache_get(pages[i]);Under what circumstances would the pages already be reserved?
Signature · 8 lines
Timur Tabi Staff Software Engineer [email protected] -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>