Detach sched.h from mm.h
[deliverable/linux.git] / include / linux / mm.h
index 8c149fa4491d751bd70997b024d220a5a139f8d4..e4183c6c7de3dca209ed8f99eb852719e3f31bfb 100644 (file)
@@ -1,7 +1,6 @@
 #ifndef _LINUX_MM_H
 #define _LINUX_MM_H
 
-#include <linux/sched.h>
 #include <linux/errno.h>
 #include <linux/capability.h>
 
@@ -20,6 +19,7 @@
 
 struct mempolicy;
 struct anon_vma;
+struct user_struct;
 
 #ifndef CONFIG_DISCONTIGMEM          /* Don't use mapnrs, do it properly */
 extern unsigned long max_mapnr;
@@ -269,14 +269,7 @@ static inline int get_page_unless_zero(struct page *page)
 
 static inline struct page *compound_head(struct page *page)
 {
-       /*
-        * We could avoid the PageCompound(page) check if
-        * we would not overload PageTail().
-        *
-        * This check has to be done in several performance critical
-        * paths of the slab etc. IMHO PageTail deserves its own flag.
-        */
-       if (unlikely(PageCompound(page) && PageTail(page)))
+       if (unlikely(PageTail(page)))
                return page->first_page;
        return page;
 }
@@ -293,6 +286,12 @@ static inline void get_page(struct page *page)
        atomic_inc(&page->_count);
 }
 
+static inline struct page *virt_to_head_page(const void *x)
+{
+       struct page *page = virt_to_page(x);
+       return compound_head(page);
+}
+
 /*
  * Setup the page count before being freed into the page allocator for
  * the first time (boot or memory hotplug)
@@ -327,7 +326,7 @@ static inline compound_page_dtor *get_compound_page_dtor(struct page *page)
 
 static inline int compound_order(struct page *page)
 {
-       if (!PageCompound(page) || PageTail(page))
+       if (!PageHead(page))
                return 0;
        return (unsigned long)page[1].lru.prev;
 }
@@ -718,14 +717,7 @@ extern unsigned long shmem_get_unmapped_area(struct file *file,
                                             unsigned long flags);
 #endif
 
-static inline int can_do_mlock(void)
-{
-       if (capable(CAP_IPC_LOCK))
-               return 1;
-       if (current->signal->rlim[RLIMIT_MEMLOCK].rlim_cur != 0)
-               return 1;
-       return 0;
-}
+extern int can_do_mlock(void);
 extern int user_shm_lock(size_t, struct user_struct *);
 extern void user_shm_unlock(size_t, struct user_struct *);
 
This page took 0.048976 seconds and 5 git commands to generate.