ANDROID: GKI: Swap Allocator ABI Fixup Restore the include/linux/swap.h to it's state before FROMLIST allocator patches (aosp/3164822, aosp/3164823) -- Revert to using bit fields instead of u[8|16] and restore the CLUSTER_STATE_* defines in swap.h; in order to maintain ABI compatibility. Change-Id: I7cec72d12ca1ac07c012d9cdfcdac4667ef4d132 Signed-off-by: Chris Li <chrisl@kernel.org> Bug: 313807618 Bug: 351082780 Bug: 356294461 Signed-off-by: Kalesh Singh <kaleshsingh@google.com> Signed-off-by: yangwenbo <yangwenbo@oppo.com>
diff --git a/include/linux/swap.h b/include/linux/swap.h index 5481bf7..1df4f0f 100644 --- a/include/linux/swap.h +++ b/include/linux/swap.h
@@ -254,23 +254,26 @@ enum { * space with SWAPFILE_CLUSTER pages long and naturally aligns in disk. All * free clusters are organized into a list. We fetch an entry from the list to * get a free cluster. - * - * The flags field determines if a cluster is free. This is - * protected by cluster lock. */ struct swap_cluster_info { spinlock_t lock; /* - * Protect swap_cluster_info fields - * other than list, and swap_info_struct->swap_map - * elements correspond to the swap cluster. + * Protect swap_cluster_info count and state + * field and swap_info_struct->swap_map + * elements correspond to the swap + * cluster */ - u16 count; - u8 flags; - u8 order; - struct list_head list; + unsigned int count:12; + unsigned int state:3; + unsigned int order:4; + unsigned int reserved:1; + unsigned int flags:4; + struct list_head list; /* Protected by swap_info_struct->lock */ }; -#define CLUSTER_FLAG_FREE 1 /* This cluster is free */ -#define CLUSTER_FLAG_NONFULL 2 /* This cluster is on nonfull list */ + +#define CLUSTER_STATE_FREE 1 /* This cluster is free */ +#define CLUSTER_STATE_PER_CPU 2 /* This cluster on per_cpu_cluster */ +#define CLUSTER_STATE_SCANNED 3 /* This cluster off per_cpu_cluster */ +#define CLUSTER_STATE_NONFULL 4 /* This cluster is on nonfull list */ /*
diff --git a/mm/swapfile.c b/mm/swapfile.c index 35d4a25..f2605a9 100644 --- a/mm/swapfile.c +++ b/mm/swapfile.c
@@ -49,6 +49,9 @@ #include "internal.h" #include "swap.h" +#define CLUSTER_FLAG_FREE 1 /* This cluster is free */ +#define CLUSTER_FLAG_NONFULL 2 /* This cluster on nonfull list */ + static bool swap_count_continued(struct swap_info_struct *, pgoff_t, unsigned char); static void free_swap_count_continuations(struct swap_info_struct *);