]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blobdiff - include/linux/swap.h
x86/apic/msi: Plug non-maskable MSI affinity race
[mirror_ubuntu-bionic-kernel.git] / include / linux / swap.h
index f02fb5db8914bf0731c03ae80e444156ec83a3cb..ea96cd4ae80ae935017a4562d2f56290d9ecd2f0 100644 (file)
@@ -155,9 +155,9 @@ struct swap_extent {
 /*
  * Max bad pages in the new format..
  */
-#define __swapoffset(x) ((unsigned long)&((union swap_header *)0)->x)
 #define MAX_SWAP_BADPAGES \
-       ((__swapoffset(magic.magic) - __swapoffset(info.badpages)) / sizeof(int))
+       ((offsetof(union swap_header, magic.magic) - \
+         offsetof(union swap_header, info.badpages)) / sizeof(int))
 
 enum {
        SWP_USED        = (1 << 0),     /* is slot in swap_info[] used? */
@@ -171,8 +171,9 @@ enum {
        SWP_AREA_DISCARD = (1 << 8),    /* single-time swap area discards */
        SWP_PAGE_DISCARD = (1 << 9),    /* freed swap page-cluster discards */
        SWP_STABLE_WRITES = (1 << 10),  /* no overwrite PG_writeback pages */
+       SWP_SYNCHRONOUS_IO = (1 << 11), /* synchronous IO is efficient */
                                        /* add others here before... */
-       SWP_SCANNING    = (1 << 11),    /* refcount in scan_swap_map */
+       SWP_SCANNING    = (1 << 12),    /* refcount in scan_swap_map */
 };
 
 #define SWAP_CLUSTER_MAX 32UL
@@ -231,7 +232,6 @@ struct swap_info_struct {
        unsigned long   flags;          /* SWP_USED etc: see above */
        signed short    prio;           /* swap priority of this type */
        struct plist_node list;         /* entry in swap_active_head */
-       struct plist_node avail_lists[MAX_NUMNODES];/* entry in swap_avail_heads */
        signed char     type;           /* strange name for an index */
        unsigned int    max;            /* extent of the swap_map */
        unsigned char *swap_map;        /* vmalloc'ed array of usage counts */
@@ -272,6 +272,16 @@ struct swap_info_struct {
                                         */
        struct work_struct discard_work; /* discard worker */
        struct swap_cluster_list discard_clusters; /* discard clusters list */
+       struct plist_node avail_lists[0]; /*
+                                          * entries in swap_avail_heads, one
+                                          * entry per node.
+                                          * Must be last as the number of the
+                                          * array is nr_node_ids, which is not
+                                          * a fixed value so have to allocate
+                                          * dynamically.
+                                          * And it has to be an array so that
+                                          * plist_for_each_* can work.
+                                          */
 };
 
 #ifdef CONFIG_64BIT
@@ -297,7 +307,18 @@ struct vma_swap_readahead {
 void *workingset_eviction(struct address_space *mapping, struct page *page);
 bool workingset_refault(void *shadow);
 void workingset_activation(struct page *page);
-void workingset_update_node(struct radix_tree_node *node, void *private);
+
+/* Do not use directly, use workingset_lookup_update */
+void workingset_update_node(struct radix_tree_node *node);
+
+/* Returns workingset_update_node() if the mapping has shadow entries. */
+#define workingset_lookup_update(mapping)                              \
+({                                                                     \
+       radix_tree_update_node_t __helper = workingset_update_node;     \
+       if (dax_mapping(mapping) || shmem_mapping(mapping))             \
+               __helper = NULL;                                        \
+       __helper;                                                       \
+})
 
 /* linux/mm/page_alloc.c */
 extern unsigned long totalram_pages;
@@ -354,14 +375,8 @@ extern unsigned long vm_total_pages;
 extern int node_reclaim_mode;
 extern int sysctl_min_unmapped_ratio;
 extern int sysctl_min_slab_ratio;
-extern int node_reclaim(struct pglist_data *, gfp_t, unsigned int);
 #else
 #define node_reclaim_mode 0
-static inline int node_reclaim(struct pglist_data *pgdat, gfp_t mask,
-                               unsigned int order)
-{
-       return 0;
-}
 #endif
 
 extern int page_evictable(struct page *page);
@@ -462,9 +477,11 @@ extern unsigned int count_swap_pages(int, int);
 extern sector_t map_swap_page(struct page *, struct block_device **);
 extern sector_t swapdev_block(int, pgoff_t);
 extern int page_swapcount(struct page *);
+extern int __swap_count(struct swap_info_struct *si, swp_entry_t entry);
 extern int __swp_swapcount(swp_entry_t entry);
 extern int swp_swapcount(swp_entry_t entry);
 extern struct swap_info_struct *page_swap_info(struct page *);
+extern struct swap_info_struct *swp_swap_info(swp_entry_t entry);
 extern bool reuse_swap_page(struct page *, int *);
 extern int try_to_free_swap(struct page *);
 struct backing_dev_info;
@@ -473,6 +490,16 @@ extern void exit_swap_address_space(unsigned int type);
 
 #else /* CONFIG_SWAP */
 
+static inline int swap_readpage(struct page *page, bool do_poll)
+{
+       return 0;
+}
+
+static inline struct swap_info_struct *swp_swap_info(swp_entry_t entry)
+{
+       return NULL;
+}
+
 #define swap_address_space(entry)              (NULL)
 #define get_nr_swap_pages()                    0L
 #define total_swap_pages                       0L
@@ -486,7 +513,7 @@ extern void exit_swap_address_space(unsigned int type);
 #define free_page_and_swap_cache(page) \
        put_page(page)
 #define free_pages_and_swap_cache(pages, nr) \
-       release_pages((pages), (nr), false);
+       release_pages((pages), (nr));
 
 static inline void show_swap_cache_info(void)
 {
@@ -577,6 +604,11 @@ static inline int page_swapcount(struct page *page)
        return 0;
 }
 
+static inline int __swap_count(struct swap_info_struct *si, swp_entry_t entry)
+{
+       return 0;
+}
+
 static inline int __swp_swapcount(swp_entry_t entry)
 {
        return 0;