Loading include/linux/plist.h +3 −0 Original line number Diff line number Diff line Loading @@ -266,6 +266,9 @@ static inline int plist_node_empty(const struct plist_node *node) #define plist_next(pos) \ list_next_entry(pos, node_list) #define plist_next_entry(pos, type, member) \ container_of(plist_next(pos), type, member) /** * plist_prev - get the prev entry in list * @pos: the type * to cursor Loading include/linux/swap.h +5 −0 Original line number Diff line number Diff line Loading @@ -178,6 +178,7 @@ enum { #define SWAP_CLUSTER_MAX 32UL #define COMPACT_CLUSTER_MAX SWAP_CLUSTER_MAX #define SWAPFILE_CLUSTER 256 #define SWAP_MAP_MAX 0x3e /* Max duplication count, in first swap_map */ #define SWAP_MAP_BAD 0x3f /* Note pageblock is bad, in first swap_map */ Loading Loading @@ -273,6 +274,8 @@ struct swap_info_struct { */ struct work_struct discard_work; /* discard worker */ struct swap_cluster_list discard_clusters; /* discard clusters list */ unsigned int write_pending; unsigned int max_writes; }; #ifdef CONFIG_64BIT Loading Loading @@ -355,6 +358,8 @@ extern unsigned long mem_cgroup_shrink_node(struct mem_cgroup *mem, unsigned long *nr_scanned); extern unsigned long shrink_all_memory(unsigned long nr_pages); extern int vm_swappiness; extern int sysctl_swap_ratio; extern int sysctl_swap_ratio_enable; extern int remove_mapping(struct address_space *mapping, struct page *page); extern unsigned long vm_total_pages; Loading include/linux/swapfile.h +5 −0 Original line number Diff line number Diff line Loading @@ -8,9 +8,14 @@ */ extern spinlock_t swap_lock; extern struct plist_head swap_active_head; extern spinlock_t swap_avail_lock; extern struct plist_head *swap_avail_heads; extern struct swap_info_struct *swap_info[]; extern int try_to_unuse(unsigned int, bool, unsigned long); extern unsigned long generic_max_swapfile_size(void); extern unsigned long max_swapfile_size(void); extern int swap_ratio(struct swap_info_struct **si, int node); extern void setup_swap_ratio(struct swap_info_struct *p, int prio); extern bool is_swap_ratio_group(int prio); #endif /* _LINUX_SWAPFILE_H */ kernel/sysctl.c +16 −0 Original line number Diff line number Diff line Loading @@ -1672,6 +1672,22 @@ static struct ctl_table vm_table[] = { .extra1 = (void *)&mmap_rnd_compat_bits_min, .extra2 = (void *)&mmap_rnd_compat_bits_max, }, #endif #ifdef CONFIG_SWAP { .procname = "swap_ratio", .data = &sysctl_swap_ratio, .maxlen = sizeof(sysctl_swap_ratio), .mode = 0644, .proc_handler = proc_dointvec_minmax, }, { .procname = "swap_ratio_enable", .data = &sysctl_swap_ratio_enable, .maxlen = sizeof(sysctl_swap_ratio_enable), .mode = 0644, .proc_handler = proc_dointvec_minmax, }, #endif { } }; Loading mm/Makefile +1 −1 Original line number Diff line number Diff line Loading @@ -54,7 +54,7 @@ ifdef CONFIG_MMU endif obj-$(CONFIG_HAVE_MEMBLOCK) += memblock.o obj-$(CONFIG_SWAP) += page_io.o swap_state.o swapfile.o swap_slots.o obj-$(CONFIG_SWAP) += page_io.o swap_state.o swapfile.o swap_slots.o swap_ratio.o obj-$(CONFIG_FRONTSWAP) += frontswap.o obj-$(CONFIG_ZSWAP) += zswap.o obj-$(CONFIG_HAS_DMA) += dmapool.o Loading Loading
include/linux/plist.h +3 −0 Original line number Diff line number Diff line Loading @@ -266,6 +266,9 @@ static inline int plist_node_empty(const struct plist_node *node) #define plist_next(pos) \ list_next_entry(pos, node_list) #define plist_next_entry(pos, type, member) \ container_of(plist_next(pos), type, member) /** * plist_prev - get the prev entry in list * @pos: the type * to cursor Loading
include/linux/swap.h +5 −0 Original line number Diff line number Diff line Loading @@ -178,6 +178,7 @@ enum { #define SWAP_CLUSTER_MAX 32UL #define COMPACT_CLUSTER_MAX SWAP_CLUSTER_MAX #define SWAPFILE_CLUSTER 256 #define SWAP_MAP_MAX 0x3e /* Max duplication count, in first swap_map */ #define SWAP_MAP_BAD 0x3f /* Note pageblock is bad, in first swap_map */ Loading Loading @@ -273,6 +274,8 @@ struct swap_info_struct { */ struct work_struct discard_work; /* discard worker */ struct swap_cluster_list discard_clusters; /* discard clusters list */ unsigned int write_pending; unsigned int max_writes; }; #ifdef CONFIG_64BIT Loading Loading @@ -355,6 +358,8 @@ extern unsigned long mem_cgroup_shrink_node(struct mem_cgroup *mem, unsigned long *nr_scanned); extern unsigned long shrink_all_memory(unsigned long nr_pages); extern int vm_swappiness; extern int sysctl_swap_ratio; extern int sysctl_swap_ratio_enable; extern int remove_mapping(struct address_space *mapping, struct page *page); extern unsigned long vm_total_pages; Loading
include/linux/swapfile.h +5 −0 Original line number Diff line number Diff line Loading @@ -8,9 +8,14 @@ */ extern spinlock_t swap_lock; extern struct plist_head swap_active_head; extern spinlock_t swap_avail_lock; extern struct plist_head *swap_avail_heads; extern struct swap_info_struct *swap_info[]; extern int try_to_unuse(unsigned int, bool, unsigned long); extern unsigned long generic_max_swapfile_size(void); extern unsigned long max_swapfile_size(void); extern int swap_ratio(struct swap_info_struct **si, int node); extern void setup_swap_ratio(struct swap_info_struct *p, int prio); extern bool is_swap_ratio_group(int prio); #endif /* _LINUX_SWAPFILE_H */
kernel/sysctl.c +16 −0 Original line number Diff line number Diff line Loading @@ -1672,6 +1672,22 @@ static struct ctl_table vm_table[] = { .extra1 = (void *)&mmap_rnd_compat_bits_min, .extra2 = (void *)&mmap_rnd_compat_bits_max, }, #endif #ifdef CONFIG_SWAP { .procname = "swap_ratio", .data = &sysctl_swap_ratio, .maxlen = sizeof(sysctl_swap_ratio), .mode = 0644, .proc_handler = proc_dointvec_minmax, }, { .procname = "swap_ratio_enable", .data = &sysctl_swap_ratio_enable, .maxlen = sizeof(sysctl_swap_ratio_enable), .mode = 0644, .proc_handler = proc_dointvec_minmax, }, #endif { } }; Loading
mm/Makefile +1 −1 Original line number Diff line number Diff line Loading @@ -54,7 +54,7 @@ ifdef CONFIG_MMU endif obj-$(CONFIG_HAVE_MEMBLOCK) += memblock.o obj-$(CONFIG_SWAP) += page_io.o swap_state.o swapfile.o swap_slots.o obj-$(CONFIG_SWAP) += page_io.o swap_state.o swapfile.o swap_slots.o swap_ratio.o obj-$(CONFIG_FRONTSWAP) += frontswap.o obj-$(CONFIG_ZSWAP) += zswap.o obj-$(CONFIG_HAS_DMA) += dmapool.o Loading