LWN.net Logo

Split PMD locks

Split PMD locks

Posted Sep 26, 2013 21:30 UTC (Thu) by ncm (subscriber, #165)
Parent article: Split PMD locks

A pointer in struct page to a mutex elsewhere makes the problem worse, unless there are many fewer mutexes than pages pointing to them.

Instead of a lock for each struct page, it should suffice to have a global, fixed-size table of mutexes, with the mutex for a particular page identified by hashing the page identifier. The mutex table just needs to be large compared to the number of CPUs, not the number of pages. Yes, sharing a mutex among multiple pages increases contention, but that can be tuned.

Growing struct page invites apocalypse.


(Log in to post comments)

Split PMD locks

Posted Sep 27, 2013 5:53 UTC (Fri) by jzbiciak (✭ supporter ✭, #5246) [Link]

I had the same thought: It must be a much smaller pool of locks that struct page points to, otherwise the indirection only bought you the cost (both time and space) of indirection.

This was one place I was hoping for a link to an LWN article or other thread that explained what as on the other side of that pointer. (I admit, because I didn't want to try to decode the code myself.)

Split PMD locks

Posted Sep 27, 2013 6:24 UTC (Fri) by corbet (editor, #1) [Link]

"Many fewer mutexes than pages pointing to them" is pretty much the situation. Remember, these locks are only needed for pages holding page tables, not for pages in general.

Copyright © 2013, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds