Re: Documentation/vm/locking: why not hold two PT locks?

Ed L Cashin
2004-02-09T16:19:09Z

Kanoj Sarcar <kanojsarcar@yahoo.com> writes:

...
> Its been a while since I wrote up those rules in
> the "locking" file, but the example that Robert has
> pointed out involving two different threads, each
> crabbing one mm lock and trying for the next one,
> is the deadlock I had in mind. There may have been
> new changes in 2.5 timeframe that also requires
> the rule, I am not sure.

Thanks, Kanoj!

After further looking into it, one thing in Documentation/vm/locking
does seem out of date. It says that "Page stealers hold kernel_lock
to protect against a bunch of races."

The only page stealing code that I can find is in rmap.c and vmscan.c.
When vmscan.c:shrink_caches and its callees need to unmap a page,
rmap.c:try_to_unmap gets called. But nowhere is there a lock_kernel
call that I could find. Instead, they use trylocks and get the page
table lock before stealing a page.

Are there other page stealers?

--
--Ed L Cashin PGP public key: http://noserose.net/e/pgp/