On Fri 19-03-21 15:42:08, Mike Kravetz wrote: > The locks acquired in free_huge_page are irq safe. However, in certain > circumstances the routine update_and_free_page could sleep. Since > free_huge_page can be called from any context, it can not sleep. > > Use a waitqueue to defer freeing of pages if the operation may sleep. A > new routine update_and_free_page_no_sleep provides this functionality > and is only called from free_huge_page. > > Note that any 'pages' sent to the workqueue for deferred freeing have > already been removed from the hugetlb subsystem. What is actually > deferred is returning those base pages to the low level allocator.
This patch or its alternative would need to be applied prior to patch 6 which makes the whole context IRQ safe. Besides that the changelog doesn't really say anything about changed user visible behavior change. Now if somebody decreases the GB huge pool from the userspace the real effect on the freed up memory will be postponed to some later time. That "later" is unpredictable as it depends on WQ utilization. We definitely need some sort of wait_for_inflight pages. One way to do that would be to have a dedicated WQ and schedule a sync work item after the pool has been shrunk and wait for that item. -- Michal Hocko SUSE Labs