lkml.org 
[lkml]   [2021]   [Mar]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [RFC PATCH 5/8] hugetlb: change free_pool_huge_page to remove_pool_huge_page
On Fri 19-03-21 15:42:06, Mike Kravetz wrote:
[...]
> @@ -2090,9 +2084,15 @@ static void return_unused_surplus_pages(struct hstate *h,
> while (nr_pages--) {
> h->resv_huge_pages--;
> unused_resv_pages--;
> - if (!free_pool_huge_page(h, &node_states[N_MEMORY], 1))
> + page = remove_pool_huge_page(h, &node_states[N_MEMORY], 1);
> + if (!page)
> goto out;
> - cond_resched_lock(&hugetlb_lock);
> +
> + /* Drop lock and free page to buddy as it could sleep */
> + spin_unlock(&hugetlb_lock);
> + update_and_free_page(h, page);
> + cond_resched();
> + spin_lock(&hugetlb_lock);
> }
>
> out:

This is likely a matter of taste but the repeated pattern of unlock,
update_and_free_page, cond_resched and lock seems rather clumsy.
Would it be slightly better/nicer to remove_pool_huge_page into a
list_head under a single lock invocation and then free up the whole lot
after the lock is dropped?

--
Michal Hocko
SUSE Labs

\
 
 \ /
  Last update: 2021-03-22 15:33    [W:0.668 / U:0.180 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site