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
Signed-off-by: Kalesh Singh <kaleshsingh@google.com>
This commit is contained in:
Chris Li 2024-07-09 11:14:51 -07:00 committed by Treehugger Robot
parent 7cbe80f0b6
commit b7c3d209b4
2 changed files with 18 additions and 12 deletions

View File

@ -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 */
/*

View File

@ -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 *);