aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/mm.h
diff options
context:
space:
mode:
authorAndrea Arcangeli <aarcange@redhat.com>2011-01-13 18:47:16 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2011-01-13 20:32:47 -0500
commit37c2ac7872a9387542616f658d20ac25f5bdb32e (patch)
treed115915db4a61e261012bf0f9c4cf14630243d71 /include/linux/mm.h
parent91600e9e592e48736e630851c83da2ad6bf0e91f (diff)
thp: compound_trans_order
Read compound_trans_order safe. Noop for CONFIG_TRANSPARENT_HUGEPAGE=n. Signed-off-by: Andrea Arcangeli <aarcange@redhat.com> Cc: Daisuke Nishimura <nishimura@mxp.nes.nec.co.jp> Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include/linux/mm.h')
-rw-r--r--include/linux/mm.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/include/linux/mm.h b/include/linux/mm.h
index 9c2695beab86..ce97a2bb0b19 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -450,6 +450,20 @@ static inline int compound_order(struct page *page)
450 return (unsigned long)page[1].lru.prev; 450 return (unsigned long)page[1].lru.prev;
451} 451}
452 452
453static inline int compound_trans_order(struct page *page)
454{
455 int order;
456 unsigned long flags;
457
458 if (!PageHead(page))
459 return 0;
460
461 flags = compound_lock_irqsave(page);
462 order = compound_order(page);
463 compound_unlock_irqrestore(page, flags);
464 return order;
465}
466
453static inline void set_compound_order(struct page *page, unsigned long order) 467static inline void set_compound_order(struct page *page, unsigned long order)
454{ 468{
455 page[1].lru.prev = (void *)order; 469 page[1].lru.prev = (void *)order;