Re: [PATCH] zram: modernize writeback interface

From: Sergey Senozhatsky
Date: Wed Mar 26 2025 - 05:31:28 EST


On (25/03/26 17:45), Sergey Senozhatsky wrote:
> On (25/03/26 17:15), Sergey Senozhatsky wrote:
> > On (25/03/26 15:07), Richard Chang wrote:
> > [..]
> > > Another alternative thought, how about page_index supporting both
> > > single instance and ranges?
> > > The key is shorter and the parser is relatively simpler.
> > > Eg: page_index=500 page_index=10000-10001
> >
> > I probably can look into it.
>
> Can't say I really like that "index" will mean both index and
> a range of indexes. But let me think more.

We can permit multiple page_index= as well

page_index=1000 page_index=2000 page_indexes=5000-6000

because one element range (N-N+1) can easily waste more space
than page_index. (historically zram permitted only one page_index
per call.)

And plural for index comes at two extra bytes, which seems fine.

I'll wait for more opinions.

---

if (!strcmp(param, "page_index")) {
err = parse_page_index(val, nr_pages, &lo, &hi);
if (err) {
ret = err;
goto release_init_lock;
}

scan_slots_for_writeback(zram, mode, lo, hi, ctl);
continue;
}

if (!strcmp(param, "page_indexes")) {
err = parse_page_indexes(val, nr_pages, &lo, &hi);
if (err) {
ret = err;
goto release_init_lock;
}

scan_slots_for_writeback(zram, mode, lo, hi, ctl);
continue;
}