[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YG17U4PolKicoch8@dhcp22.suse.cz>
Date: Wed, 7 Apr 2021 11:28:51 +0200
From: Michal Hocko <mhocko@...e.com>
To: Oscar Salvador <osalvador@...e.de>
Cc: Mike Kravetz <mike.kravetz@...cle.com>, linux-mm@...ck.org,
linux-kernel@...r.kernel.org, Roman Gushchin <guro@...com>,
Shakeel Butt <shakeelb@...gle.com>,
David Hildenbrand <david@...hat.com>,
Muchun Song <songmuchun@...edance.com>,
David Rientjes <rientjes@...gle.com>,
Miaohe Lin <linmiaohe@...wei.com>,
Peter Zijlstra <peterz@...radead.org>,
Matthew Wilcox <willy@...radead.org>,
HORIGUCHI NAOYA <naoya.horiguchi@....com>,
"Aneesh Kumar K . V" <aneesh.kumar@...ux.ibm.com>,
Waiman Long <longman@...hat.com>, Peter Xu <peterx@...hat.com>,
Mina Almasry <almasrymina@...gle.com>,
Hillf Danton <hdanton@...a.com>,
Joonsoo Kim <iamjoonsoo.kim@....com>,
Barry Song <song.bao.hua@...ilicon.com>,
Will Deacon <will@...nel.org>,
Andrew Morton <akpm@...ux-foundation.org>
Subject: Re: [PATCH v4 5/8] hugetlb: call update_and_free_page without
hugetlb_lock
On Wed 07-04-21 10:27:49, Oscar Salvador wrote:
> On Mon, Apr 05, 2021 at 04:00:40PM -0700, Mike Kravetz wrote:
[...]
> > @@ -2671,22 +2682,34 @@ static void try_to_free_low(struct hstate *h, unsigned long count,
> > nodemask_t *nodes_allowed)
> > {
> > int i;
> > + struct page *page, *next;
> > + LIST_HEAD(page_list);
> >
> > if (hstate_is_gigantic(h))
> > return;
> >
> > + /*
> > + * Collect pages to be freed on a list, and free after dropping lock
> > + */
> > for_each_node_mask(i, *nodes_allowed) {
> > - struct page *page, *next;
> > struct list_head *freel = &h->hugepage_freelists[i];
> > list_for_each_entry_safe(page, next, freel, lru) {
> > if (count >= h->nr_huge_pages)
> > - return;
> > + goto out;
> > if (PageHighMem(page))
> > continue;
> > remove_hugetlb_page(h, page, false);
> > - update_and_free_page(h, page);
> > + list_add(&page->lru, &page_list);
> > }
> > }
> > +
> > +out:
> > + spin_unlock(&hugetlb_lock);
> > + list_for_each_entry_safe(page, next, &page_list, lru) {
> > + update_and_free_page(h, page);
> > + cond_resched();
> > + }
> > + spin_lock(&hugetlb_lock);
>
> Can we get here with an empty list?
An emoty page_list? If yes then sure, this can happen but
list_for_each_entry_safe will simply not iterate. Or what do you mean?
--
Michal Hocko
SUSE Labs
Powered by blists - more mailing lists