Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1191362
| From | David Rientjes <rientjes@google.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH] hugetlb: cond_resched for set_max_huge_pages and follow_hugetlb_page |
| Date | 2015-07-24 00:10 +0200 |
| Message-ID | <pPwQH-30s-21@gated-at.bofh.it> (permalink) |
| References | <pPwH0-2zU-15@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Thu, 23 Jul 2015, Spencer Baugh wrote: > From: Joern Engel <joern@logfs.org> > > ~150ms scheduler latency for both observed in the wild. > > Signed-off-by: Joern Engel <joern@logfs.org> > Signed-off-by: Spencer Baugh <sbaugh@catern.com> > --- > mm/hugetlb.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/mm/hugetlb.c b/mm/hugetlb.c > index a8c3087..2eb6919 100644 > --- a/mm/hugetlb.c > +++ b/mm/hugetlb.c > @@ -1836,6 +1836,7 @@ static unsigned long set_max_huge_pages(struct hstate *h, unsigned long count, > ret = alloc_fresh_gigantic_page(h, nodes_allowed); > else > ret = alloc_fresh_huge_page(h, nodes_allowed); > + cond_resched(); > spin_lock(&hugetlb_lock); > if (!ret) > goto out; This is wrong, you'd want to do any cond_resched() before the page allocation to avoid racing with an update to h->nr_huge_pages or h->surplus_huge_pages while hugetlb_lock was dropped that would result in the page having been uselessly allocated. > @@ -3521,6 +3522,7 @@ long follow_hugetlb_page(struct mm_struct *mm, struct vm_area_struct *vma, > spin_unlock(ptl); > ret = hugetlb_fault(mm, vma, vaddr, > (flags & FOLL_WRITE) ? FAULT_FLAG_WRITE : 0); > + cond_resched(); > if (!(ret & VM_FAULT_ERROR)) > continue; > This is almost certainly the wrong placement as well since it's inserted inside a conditional inside a while loop and there's no reason to hugetlb_fault(), schedule, and then check the return value. You need to insert your cond_resched()'s in legitimate places. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH] hugetlb: cond_resched for set_max_huge_pages and follow_hugetlb_page Spencer Baugh <sbaugh@catern.com> - 2015-07-24 00:00 +0200
Re: [PATCH] hugetlb: cond_resched for set_max_huge_pages and follow_hugetlb_page David Rientjes <rientjes@google.com> - 2015-07-24 00:10 +0200
Re: [PATCH] hugetlb: cond_resched for set_max_huge_pages and follow_hugetlb_page Jörn Engel <joern@purestorage.com> - 2015-07-24 00:40 +0200
Re: [PATCH] hugetlb: cond_resched for set_max_huge_pages and follow_hugetlb_page David Rientjes <rientjes@google.com> - 2015-07-24 01:00 +0200
Re: [PATCH] hugetlb: cond_resched for set_max_huge_pages and follow_hugetlb_page Jörn Engel <joern@purestorage.com> - 2015-07-24 01:10 +0200
csiph-web