mm: thp: tail page refcounting fix
[platform/kernel/linux-arm64.git] / include / linux / mm_types.h
index 774b895..5b42f1b 100644 (file)
@@ -62,10 +62,23 @@ struct page {
                        struct {
 
                                union {
-                                       atomic_t _mapcount;     /* Count of ptes mapped in mms,
-                                                        * to show when page is mapped
-                                                        * & limit reverse map searches.
-                                                        */
+                                       /*
+                                        * Count of ptes mapped in
+                                        * mms, to show when page is
+                                        * mapped & limit reverse map
+                                        * searches.
+                                        *
+                                        * Used also for tail pages
+                                        * refcounting instead of
+                                        * _count. Tail pages cannot
+                                        * be mapped and keeping the
+                                        * tail page _count zero at
+                                        * all times guarantees
+                                        * get_page_unless_zero() will
+                                        * never succeed on tail
+                                        * pages.
+                                        */
+                                       atomic_t _mapcount;
 
                                        struct {
                                                unsigned inuse:16;
@@ -79,9 +92,21 @@ struct page {
        };
 
        /* Third double word block */
-       struct list_head lru;           /* Pageout list, eg. active_list
+       union {
+               struct list_head lru;   /* Pageout list, eg. active_list
                                         * protected by zone->lru_lock !
                                         */
+               struct {                /* slub per cpu partial pages */
+                       struct page *next;      /* Next partial slab */
+#ifdef CONFIG_64BIT
+                       int pages;      /* Nr of partial slabs left */
+                       int pobjects;   /* Approximate # of objects */
+#else
+                       short int pages;
+                       short int pobjects;
+#endif
+               };
+       };
 
        /* Remainder is not double word aligned */
        union {
@@ -135,6 +160,17 @@ struct page {
 #endif
 ;
 
+struct page_frag {
+       struct page *page;
+#if (BITS_PER_LONG > 32) || (PAGE_SIZE >= 65536)
+       __u32 offset;
+       __u32 size;
+#else
+       __u16 offset;
+       __u16 size;
+#endif
+};
+
 typedef unsigned long __nocast vm_flags_t;
 
 /*
@@ -281,8 +317,15 @@ struct mm_struct {
        unsigned long hiwater_rss;      /* High-watermark of RSS usage */
        unsigned long hiwater_vm;       /* High-water virtual memory usage */
 
-       unsigned long total_vm, locked_vm, shared_vm, exec_vm;
-       unsigned long stack_vm, reserved_vm, def_flags, nr_ptes;
+       unsigned long total_vm;         /* Total pages mapped */
+       unsigned long locked_vm;        /* Pages that have PG_mlocked set */
+       unsigned long pinned_vm;        /* Refcount permanently increased */
+       unsigned long shared_vm;        /* Shared pages (files) */
+       unsigned long exec_vm;          /* VM_EXEC & ~VM_WRITE */
+       unsigned long stack_vm;         /* VM_GROWSUP/DOWN */
+       unsigned long reserved_vm;      /* VM_RESERVED|VM_IO pages */
+       unsigned long def_flags;
+       unsigned long nr_ptes;          /* Page table pages */
        unsigned long start_code, end_code, start_data, end_data;
        unsigned long start_brk, brk, start_stack;
        unsigned long arg_start, arg_end, env_start, env_end;
@@ -313,9 +356,6 @@ struct mm_struct {
        unsigned int token_priority;
        unsigned int last_interval;
 
-       /* How many tasks sharing this mm are OOM_DISABLE */
-       atomic_t oom_disable_count;
-
        unsigned long flags; /* Must use atomic bitops to access the bits */
 
        struct core_state *core_state; /* coredumping support */