On Fri, Aug 12, 2011 at 8:36 AM, Andrea Arcangeli <aarcange@xxxxxxxxxx> wrote: > On Tue, Aug 09, 2011 at 04:04:21AM -0700, Michel Lespinasse wrote: >> - Use my proposed page count lock in order to avoid the race. One >> would have to convert all get_page_unless_zero() sites to use it. I >> expect the cost would be low but still measurable. > > I didn't yet focus at your problem after we talked about it at MM > summit, but I seem to recall I suggested there to just get to the head > page and always take the lock on it. split_huge_page only works at 2M > aligned pages, the rest you don't care about. Getting to the head page > compound_lock should be always safe. And that will still scale > incredibly better than taking the lru_lock for the whole zone (which > would also work). And it seems the best way to stop split_huge_page > without having to alter the put_page fast path when it works on head > pages (the only thing that gets into put_page complex slow path is the > release of tail pages after get_user_pages* so it'd be nice if > put_page fast path still didn't need to take locks). We did talk about it. At some point I thought it might work :) The problem case there is this. Say the page I want to get_page_unless_zero is a single page, and the page at the prior 2M aligned boundary is currently free. I can't rely on the desired page not getting reallocated, because I don't have a reference on it yet. But I can't make things safe by taking a reference and/or the compound lock on the aligned page either, because its refcount currently is zero. -- Michel "Walken" Lespinasse A program is never fully debugged until the last user dies. -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@xxxxxxxxx. For more info on Linux MM, see: http://www.linux-mm.org/ . Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/ Don't email: <a href=mailto:"dont@xxxxxxxxx"> email@xxxxxxxxx </a>