Re: [RFC PATCH 2/8] hugetlb: recompute min_count when dropping hugetlb_lock

2021-03-24 Thread Mike Kravetz
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 t

Re: [RFC PATCH 2/8] hugetlb: recompute min_count when dropping hugetlb_lock

2021-03-24 Thread Michal Hocko
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) >

Re: [RFC PATCH 2/8] hugetlb: recompute min_count when dropping hugetlb_lock

2021-03-23 Thread Mike Kravetz
On 3/23/21 1:14 AM, Michal Hocko wrote: > On Tue 23-03-21 09:01:02, Peter Zijlstra wrote: >> On Tue, Mar 23, 2021 at 08:50:53AM +0100, Michal Hocko wrote: >> >> +static inline unsigned long min_hp_count(struct hstate *h, unsigned >> long count) >> +{ >> +unsigned long min_c

Re: [RFC PATCH 2/8] hugetlb: recompute min_count when dropping hugetlb_lock

2021-03-23 Thread Michal Hocko
On Tue 23-03-21 09:01:02, Peter Zijlstra wrote: > On Tue, Mar 23, 2021 at 08:50:53AM +0100, Michal Hocko wrote: > > > > >> +static inline unsigned long min_hp_count(struct hstate *h, unsigned > > > >> long count) > > > >> +{ > > > >> + unsigned long min_count; > > > >> + > > > >> + min_

Re: [RFC PATCH 2/8] hugetlb: recompute min_count when dropping hugetlb_lock

2021-03-23 Thread Peter Zijlstra
On Tue, Mar 23, 2021 at 08:50:53AM +0100, Michal Hocko wrote: > > >> +static inline unsigned long min_hp_count(struct hstate *h, unsigned > > >> long count) > > >> +{ > > >> +unsigned long min_count; > > >> + > > >> +min_count = h->resv_huge_pages + h->nr_huge_pages - > > >> h->f

Re: [RFC PATCH 2/8] hugetlb: recompute min_count when dropping hugetlb_lock

2021-03-23 Thread Michal Hocko
On Mon 22-03-21 16:07:29, Mike Kravetz wrote: > On 3/22/21 7:07 AM, Michal Hocko wrote: > > On Fri 19-03-21 15:42:03, Mike Kravetz wrote: > >> The routine set_max_huge_pages reduces the number of hugetlb_pages, > >> by calling free_pool_huge_page in a loop. It does this as long as > >> persistent_

Re: [RFC PATCH 2/8] hugetlb: recompute min_count when dropping hugetlb_lock

2021-03-22 Thread Mike Kravetz
On 3/22/21 7:07 AM, Michal Hocko wrote: > On Fri 19-03-21 15:42:03, Mike Kravetz wrote: >> The routine set_max_huge_pages reduces the number of hugetlb_pages, >> by calling free_pool_huge_page in a loop. It does this as long as >> persistent_huge_pages() is above a calculated min_count value. >> H

Re: [RFC PATCH 2/8] hugetlb: recompute min_count when dropping hugetlb_lock

2021-03-22 Thread Michal Hocko
On Fri 19-03-21 15:42:03, Mike Kravetz wrote: > The routine set_max_huge_pages reduces the number of hugetlb_pages, > by calling free_pool_huge_page in a loop. It does this as long as > persistent_huge_pages() is above a calculated min_count value. > However, this loop can conditionally drop huget

[RFC PATCH 2/8] hugetlb: recompute min_count when dropping hugetlb_lock

2021-03-19 Thread Mike Kravetz
The routine set_max_huge_pages reduces the number of hugetlb_pages, by calling free_pool_huge_page in a loop. It does this as long as persistent_huge_pages() is above a calculated min_count value. However, this loop can conditionally drop hugetlb_lock and in some circumstances free_pool_huge_page