]> git.kernelconcepts.de Git - karo-tx-linux.git/blobdiff - include/linux/swap.h
mm-add-extra-free-kbytes-tunable-update
[karo-tx-linux.git] / include / linux / swap.h
index b1fd5c7925feab91948ee46f0b5140b4c0ae5399..fbe8473c37207f037a0ab4c8d92a8052866729a0 100644 (file)
@@ -197,6 +197,10 @@ struct swap_info_struct {
        struct block_device *bdev;      /* swap device or bdev of swap file */
        struct file *swap_file;         /* seldom referenced */
        unsigned int old_block_size;    /* seldom referenced */
+#ifdef CONFIG_FRONTSWAP
+       unsigned long *frontswap_map;   /* frontswap in-use, one bit per page */
+       atomic_t frontswap_pages;       /* frontswap pages in-use counter */
+#endif
 };
 
 struct swap_list_t {
@@ -211,6 +215,8 @@ struct swap_list_t {
 extern unsigned long totalram_pages;
 extern unsigned long totalreserve_pages;
 extern unsigned long dirty_balance_reserve;
+extern int min_free_kbytes;
+extern int extra_free_kbytes;
 extern unsigned int nr_free_buffer_pages(void);
 extern unsigned int nr_free_pagecache_pages(void);
 
@@ -372,6 +378,26 @@ static inline void put_swap_token(struct mm_struct *mm)
                __put_swap_token(mm);
 }
 
+static inline bool has_active_swap_token(struct mm_struct *mm)
+{
+       return has_swap_token(mm) && atomic_read(&mm->active_swap_token);
+}
+
+static inline bool activate_swap_token(struct mm_struct *mm)
+{
+       if (has_swap_token(mm)) {
+               atomic_inc(&mm->active_swap_token);
+               return true;
+       }
+       return false;
+}
+
+static inline void deactivate_swap_token(struct mm_struct *mm, bool swap_token)
+{
+       if (swap_token)
+               atomic_dec(&mm->active_swap_token);
+}
+
 #ifdef CONFIG_CGROUP_MEM_RES_CTLR
 extern void
 mem_cgroup_uncharge_swapcache(struct page *page, swp_entry_t ent, bool swapout);
@@ -490,6 +516,20 @@ static inline int has_swap_token(struct mm_struct *mm)
        return 0;
 }
 
+static inline bool has_active_swap_token(struct mm_struct *mm)
+{
+       return false;
+}
+
+static inline bool activate_swap_token(struct mm_struct *mm)
+{
+       return false;
+}
+
+static inline void deactivate_swap_token(struct mm_struct *mm, bool swap_token)
+{
+}
+
 static inline void disable_swap_token(struct mem_cgroup *memcg)
 {
 }