linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* What happened to try_to_swap_out()?
@ 2004-06-08 14:59 Timur Tabi
  2004-06-08 16:25 ` Rik van Riel
  0 siblings, 1 reply; 4+ messages in thread
From: Timur Tabi @ 2004-06-08 14:59 UTC (permalink / raw)
  To: linux-mm

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?

-- 
Timur Tabi
Staff Software Engineer
timur.tabi@ammasso.com
--
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] 4+ messages in thread

* Re: What happened to try_to_swap_out()?
  2004-06-08 14:59 What happened to try_to_swap_out()? Timur Tabi
@ 2004-06-08 16:25 ` Rik van Riel
  2004-06-08 16:31   ` Timur Tabi
  2004-06-08 20:12   ` Do I need SetPageReserved() after map_user_kiobuf()? (was: What happened to try_to_swap_out()?) Timur Tabi
  0 siblings, 2 replies; 4+ messages in thread
From: Rik van Riel @ 2004-06-08 16:25 UTC (permalink / raw)
  To: Timur Tabi; +Cc: linux-mm

On Tue, 8 Jun 2004, Timur Tabi wrote:

> 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)

> 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.

-- 
"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 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] 4+ messages in thread

* Re: What happened to try_to_swap_out()?
  2004-06-08 16:25 ` Rik van Riel
@ 2004-06-08 16:31   ` Timur Tabi
  2004-06-08 20:12   ` Do I need SetPageReserved() after map_user_kiobuf()? (was: What happened to try_to_swap_out()?) Timur Tabi
  1 sibling, 0 replies; 4+ messages in thread
From: Timur Tabi @ 2004-06-08 16:31 UTC (permalink / raw)
  To: linux-mm

Rik van Riel wrote:

> 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?

>>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?

-- 
Timur Tabi
Staff Software Engineer
timur.tabi@ammasso.com
--
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] 4+ messages in thread

* Do I need SetPageReserved() after map_user_kiobuf()? (was: What happened to try_to_swap_out()?)
  2004-06-08 16:25 ` Rik van Riel
  2004-06-08 16:31   ` Timur Tabi
@ 2004-06-08 20:12   ` Timur Tabi
  1 sibling, 0 replies; 4+ messages in thread
From: Timur Tabi @ 2004-06-08 20:12 UTC (permalink / raw)
  To: linux-mm

Rik van Riel wrote:

> 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?

-- 
Timur Tabi
Staff Software Engineer
timur.tabi@ammasso.com
--
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] 4+ messages in thread

end of thread, other threads:[~2004-06-08 20:12 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-06-08 14:59 What happened to try_to_swap_out()? Timur Tabi
2004-06-08 16:25 ` Rik van Riel
2004-06-08 16:31   ` Timur Tabi
2004-06-08 20:12   ` Do I need SetPageReserved() after map_user_kiobuf()? (was: What happened to try_to_swap_out()?) Timur Tabi

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