Thread (21 messages) 21 messages, 4 authors, 2012-09-13

Re: [PATCH v2 10/10] thp: implement refcounting for huge zero page

From: Kirill A. Shutemov <hidden>
Date: 2012-09-10 15:07:23
Also in: lkml

On Mon, Sep 10, 2012 at 04:57:59PM +0200, Eric Dumazet wrote:
On Mon, 2012-09-10 at 17:44 +0300, Kirill A. Shutemov wrote:

quoted
Yes, disabling preemption before alloc_pages() and enabling after
atomic_set() looks reasonable. Thanks.
In fact, as alloc_pages(GFP_TRANSHUGE | __GFP_ZERO, HPAGE_PMD_ORDER);
might sleep, it would be better to disable preemption after calling it :
Yeah, I've alread thought about that. :)
zero_page = alloc_pages(GFP_TRANSHUGE | __GFP_ZERO, HPAGE_PMD_ORDER);
if (!zero_page)
	return 0;
preempt_disable();
if (cmpxchg(&huge_zero_pfn, 0, page_to_pfn(zero_page))) {
	preempt_enable();
	__free_page(zero_page);
	goto retry;
}
atomic_set(&huge_zero_refcount, 2);
preempt_enable();
-- 
 Kirill A. Shutemov

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help