On 2/5/26 09:06, David Hildenbrand (Arm) wrote: >> But can't we RCU-free the page table? Why do we need to wait for the >> RCU readers to finish? > > For unsharing hugetlb PMD tables the problem is not the freeing but the > reuse of the PMD table for other purposes in the last remaining user. > It's complicated.
Letting the previously-shared table get released to everything else in the system sounds like a fixable problem. tlb_flush_unshared_tables() talks about this, and it makes sense that once locks get dropped that something else could get mapped in and start using the PMD. The RCU way of fixing that would be to allocate new page table, replace the old one, and RCU-free the old one. Read, Copy, Update. :) It does temporarily eat up an extra page, and cost an extra copy. But neither of those seems expensive compared to IPI'ing the world. > For page table freeing, we only do it if we fail to allocate memory -- > if we cannot use RCU IIRC. But that case is fine to be slow and use synchronize_rcu(). If you're failing to allocate a single page, you're in a way slow path anyway. > khugepaged, no idea. Sounds like Lance has some homework to do there. :)

