On 3/24/21 1:36 AM, Michal Hocko wrote: > On Tue 23-03-21 16:18:08, Mike Kravetz wrote: > [...] >> Here is another thought. >> In patch 5 you suggest removing all pages from hugetlb with the lock >> held, and adding them to a list. Then, drop the lock and free all >> pages on the list. If we do this, then the value computed here (min_count) >> can not change while we are looping. So, this patch would be unnecessary. >> That is another argument in favor of batching the frees. >> >> Unless there is something wrong in my thinking, I am going to take that >> approach and drop this patch. > > Makes sense > I still think this is the way to go in this series. However, Muchun's "Free some vmemmap pages of HugeTLB page" series would likely want to drop the lock for each page as the free operation may fail. So, we may end up back with one lock cycle per page. That is something that will be discussed in that series. -- Mike Kravetz