On Sat, Nov 05, 2022 at 08:41:37AM +0900, Sergey Senozhatsky wrote: > On (22/11/04 10:43), Minchan Kim wrote: > > > > Configure 2 alternative algos, with priority 1 and 2 > > > > > > > > echo "name=lz4 priority=1" > recomp_algo > > > > echo "name=lz5 priority=2" > recomp_algo > > > > > > > > Recompress pages using algo 1 and algo 2 > > > > > > > > echo "type=huge threshold=3000 algo_idx=1" > recompress > > > > echo "type=idle threshold=2000 algo_idx=2" > recompress > > > > > > > > Maybe we can even pass algo name instead of idx. > > > > > > Or pass priority= so that interface that uses algorithms has the > > > same keyword that the interface that configures those algorithms. > > > > Hmm, why do we need algo_idx here if we already set up every > > fields at algorithm setup time? > > > > My understaind(assuming default(i.e., primary) algo is lzo) is > > > > echo "name=lz4 priority=1" > recomp_algo > > echo "name=lz5 priority=2" > recomp_algo > > > > echo "type=huge threshold=3000" > recompress > > > > It will try compress every objects which greater than 3000B with lz4 first > > and then lz5 if it's stillgreater or equal than 3000(or same size class). > > One can be SW one can be HW. So I thought about having flexibility here. > Instead of doing > > for (idx = 1; idx < MAX_IDX; idx++) { > len = zcomp_compress(zram->comps[idx]); > if (len <= threshold) > break; > } > > We would just directly use the suggested algo. > > But we probably don't need that param at all and can use > the loop instead? I don't understand what param you are saying. I expected the zram->comps array already has sorted algoritm based on the priority so the loop will try compression as expected so loop is fine. Are we on same page? > > [..] > > echo "name=lz4 priority=1" > recomp_algo > > echo "name=lz5 priority=2" > recomp_algo > > > > # or I realized to change lz5 to lz7 so > > echo "name=lz6 priority=2" > recomp_algo > > So the latter should delete lz5 at idx 2 and put lz6 there? > I can add that. Yub.