Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1662787

[patch v2 -mm] mm, hugetlb: schedule when potentially allocating many hugepages

From David Rientjes <rientjes@google.com>
Newsgroups linux.kernel
Subject [patch v2 -mm] mm, hugetlb: schedule when potentially allocating many hugepages
Date 2017-06-10 00:40 +0200
Message-ID <tQAJr-7ia-3@gated-at.bofh.it> (permalink)
References <tPWVI-7FJ-9@gated-at.bofh.it> <tPXoJ-7V3-5@gated-at.bofh.it> <tQAJr-7ia-5@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


A few hugetlb allocators loop while calling the page allocator and can
potentially prevent rescheduling if the page allocator slowpath is not
utilized.

Conditionally schedule when large numbers of hugepages can be allocated.

Signed-off-by: David Rientjes <rientjes@google.com>
---
 Based on -mm only to prevent merge conflicts with
 "mm/hugetlb.c: warn the user when issues arise on boot due to hugepages"

 v2: removed redundant cond_resched() per Mike

 mm/hugetlb.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/mm/hugetlb.c b/mm/hugetlb.c
--- a/mm/hugetlb.c
+++ b/mm/hugetlb.c
@@ -1754,6 +1754,7 @@ static int gather_surplus_pages(struct hstate *h, int delta)
 			break;
 		}
 		list_add(&page->lru, &surplus_list);
+		cond_resched();
 	}
 	allocated += i;
 
@@ -2222,6 +2223,7 @@ static void __init hugetlb_hstate_alloc_pages(struct hstate *h)
 		} else if (!alloc_fresh_huge_page(h,
 					 &node_states[N_MEMORY]))
 			break;
+		cond_resched();
 	}
 	if (i < h->max_huge_pages) {
 		char buf[32];

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[patch -mm] mm, hugetlb: schedule when potentially allocating many  hugepages David Rientjes <rientjes@google.com> - 2017-06-08 06:10 +0200
  Re: [patch -mm] mm, hugetlb: schedule when potentially allocating  many hugepages Mike Kravetz <mike.kravetz@oracle.com> - 2017-06-08 06:40 +0200
    [patch v2 -mm] mm, hugetlb: schedule when potentially allocating  many hugepages David Rientjes <rientjes@google.com> - 2017-06-10 00:40 +0200
      Re: [patch v2 -mm] mm, hugetlb: schedule when potentially allocating  many hugepages Mike Kravetz <mike.kravetz@oracle.com> - 2017-06-10 00:50 +0200
    Re: [patch -mm] mm, hugetlb: schedule when potentially allocating  many hugepages David Rientjes <rientjes@google.com> - 2017-06-10 00:40 +0200

csiph-web