Messages in this thread Patch in this message | | | Date | Tue, 29 Jun 1999 23:11:36 +0100 (GMT) | From | Bryn Paul Arnold Jones <> | Subject | Re: free_page_and_swap_cache sleeps (so sleep also zap_page_range) |
| |
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
On Tue, 29 Jun 1999, Andrea Arcangeli wrote:
> > Thinking only a bit more we can do something better with this other > simpler approch: "go ahead only if you don't need to sleep". >
Bit more though required ;)
> (patch untested) > > Index: linux/mm/swap_state.c > =================================================================== > RCS file: /var/cvs/linux/mm/swap_state.c,v > retrieving revision 1.1.1.8 > diff -u -r1.1.1.8 swap_state.c > --- linux/mm/swap_state.c 1999/06/28 15:10:10 1.1.1.8 > +++ linux/mm/swap_state.c 1999/06/29 16:37:04 > @@ -265,14 +265,13 @@ > /* > * If we are the only user, then free up the swap cache. > */ > - lock_page(page); > - if (PageSwapCache(page) && !is_page_shared(page)) { > + if (!TryLockPage(page) && PageSwapCache(page) && !is_page_shared(page)) {
TryLockPage() locks the page? If so you can't do it like that, suppose: !TryLockPage(page) == True and PageSwapCache(page) && !is_page_shared(page) == False.
You now have the page locked, but you don't unlock it now. If you move the TryLockPage(page) to the end of the condition, it will fix the problem (assuming the other conditions don't have side effects).
> long entry = page->offset; > remove_from_swap_cache(page); > swap_free(entry); > page_cache_release(page); > + UnlockPage(page); > } > - UnlockPage(page); > > __free_page(page); > } > > > > Andrea >
Bryn - -- Or words to that effect ... PGP pubkeys from http://www.gytha.demon.co.uk/pubkey.asc.
-----BEGIN PGP SIGNATURE----- Version: PGPfreeware 5.0i for non-commercial use Comment: Silly comment here ... Charset: noconv
iQA/AwUBN3lEmt94IUtvfSqaEQIuNwCeL72iWNFdgioOYXJL2XwDsqIl/TIAnRtn eiaqdCgt/fndQyyCmf00oXL8 =pPTw -----END PGP SIGNATURE-----
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/
| |