Revert "ANDROID: zram: Refactor writeback helpers"

This reverts commit 40c4d5553e.

It has merge conflicts with upstream patches in v7.0. It can be later
reapplied if needed.

Bug: 421065577
Cc: Richard Chang <richardycc@google.com>
Change-Id: If2d56b842adf435ce9a9a4f15a362228fcbbba06
Signed-off-by: Carlos Llamas <cmllamas@google.com>
This commit is contained in:
Carlos Llamas authored and android-test-infra-autosubmit@system.gserviceaccount.com committed 2026-04-17 22:51:45 -07:00
1 parent 42a5939990
commit 4ff6650a01
2 files changed
+30 -48

No files matched your search

+30 -9
View File
@@ -112,7 +112,7 @@ static void zram_slot_unlock(struct zram *zram, u32 index)
clear_and_wake_up_bit(ZRAM_ENTRY_LOCK, lock);
}
bool init_done(struct zram *zram)
static inline bool init_done(struct zram *zram)
{
return zram->disksize;
}
@@ -238,7 +238,18 @@ struct zram_pp_slot {
struct list_head entry;
};
struct zram_pp_ctl *init_pp_ctl(void)
/*
* A post-processing bucket is, essentially, a size class, this defines
* the range (in bytes) of pp-slots sizes in particular bucket.
*/
#define PP_BUCKET_SIZE_RANGE 64
#define NUM_PP_BUCKETS ((PAGE_SIZE / PP_BUCKET_SIZE_RANGE) + 1)
struct zram_pp_ctl {
struct list_head pp_buckets[NUM_PP_BUCKETS];
};
static struct zram_pp_ctl *init_pp_ctl(void)
{
struct zram_pp_ctl *ctl;
u32 idx;
@@ -263,7 +274,7 @@ static void release_pp_slot(struct zram *zram, struct zram_pp_slot *pps)
kfree(pps);
}
void release_pp_ctl(struct zram *zram, struct zram_pp_ctl *ctl)
static void release_pp_ctl(struct zram *zram, struct zram_pp_ctl *ctl)
{
u32 idx;
@@ -491,6 +502,16 @@ out:
#ifdef CONFIG_ZRAM_WRITEBACK
#define INVALID_BDEV_BLOCK (~0UL)
struct zram_wb_ctl {
/* idle list is accessed only by the writeback task, no concurency */
struct list_head idle_reqs;
/* done list is accessed concurrently, protect by done_lock */
struct list_head done_reqs;
wait_queue_head_t done_wait;
spinlock_t done_lock;
atomic_t num_inflight;
};
struct zram_wb_req {
unsigned long blk_idx;
struct page *page;
@@ -974,9 +995,9 @@ static struct zram_wb_req *zram_select_idle_req(struct zram_wb_ctl *wb_ctl)
return req;
}
int zram_writeback_slots(struct zram *zram,
struct zram_pp_ctl *ctl,
struct zram_wb_ctl *wb_ctl)
static int zram_writeback_slots(struct zram *zram,
struct zram_pp_ctl *ctl,
struct zram_wb_ctl *wb_ctl)
{
unsigned long blk_idx = INVALID_BDEV_BLOCK;
struct zram_wb_req *req = NULL;
@@ -1137,9 +1158,9 @@ static int parse_mode(char *val, u32 *mode)
return 0;
}
int scan_slots_for_writeback(struct zram *zram, u32 mode,
unsigned long lo, unsigned long hi,
struct zram_pp_ctl *ctl)
static int scan_slots_for_writeback(struct zram *zram, u32 mode,
unsigned long lo, unsigned long hi,
struct zram_pp_ctl *ctl)
{
u32 index = lo;
-39
View File
@@ -139,43 +139,4 @@ struct zram {
#endif
atomic_t pp_in_progress;
};
bool init_done(struct zram *zram);
#if defined CONFIG_ZRAM_WRITEBACK || defined CONFIG_ZRAM_MULTI_COMP
/*
* A post-processing bucket is, essentially, a size class, this defines
* the range (in bytes) of pp-slots sizes in particular bucket.
*/
#define PP_BUCKET_SIZE_RANGE 64
#define NUM_PP_BUCKETS ((PAGE_SIZE / PP_BUCKET_SIZE_RANGE) + 1)
struct zram_pp_ctl {
struct list_head pp_buckets[NUM_PP_BUCKETS];
};
struct zram_pp_ctl *init_pp_ctl(void);
void release_pp_ctl(struct zram *zram, struct zram_pp_ctl *ctl);
int scan_slots_for_writeback(struct zram *zram, u32 mode,
unsigned long lo, unsigned long hi,
struct zram_pp_ctl *ctl);
#endif
#ifdef CONFIG_ZRAM_WRITEBACK
struct zram_wb_ctl {
/* idle list is accessed only by the writeback task, no concurency */
struct list_head idle_reqs;
/* done list is accessed concurrently, protect by done_lock */
struct list_head done_reqs;
wait_queue_head_t done_wait;
spinlock_t done_lock;
atomic_t num_inflight;
};
int zram_writeback_slots(struct zram *zram,
struct zram_pp_ctl *ctl,
struct zram_wb_ctl *wb_ctl);
#endif
#endif