> > +#define WORK_PENDING 0 > > +#define ACTIVATION_THRSHLD 4 /* 4 IOs */ > Rather than fixing it with macro, how about using sysfs and make it > configurable? Yes. I will add a patch making all the logic configurable. As all those are hpb-related parameters, I think module parameters are more adequate. > > > @@ -306,12 +325,39 @@ void ufshpb_prep(struct ufs_hba *hba, struct > ufshcd_lrb *lrbp) > > ufshpb_set_ppn_dirty(hpb, rgn_idx, srgn_idx, srgn_offset, > > transfer_len); > > spin_unlock_irqrestore(&hpb->rgn_state_lock, flags); > > + > > + if (ufshpb_mode == HPB_HOST_CONTROL) > > + atomic64_set(&rgn->reads, 0); > > + > > return; > > } > > > > + if (ufshpb_mode == HPB_HOST_CONTROL) > > + reads = atomic64_inc_return(&rgn->reads); > > + > > if (!ufshpb_is_support_chunk(transfer_len)) > > return; <- *this* > > > > + if (ufshpb_mode == HPB_HOST_CONTROL) { > > + /* > > + * in host control mode, reads are the main source for > > + * activation trials. > > + */ > > + if (reads == ACTIVATION_THRSHLD) { > If the chunk size is not supported, we can not active this region > permanently. It may be returned before get this statement. Yes. I already noticed that replying to Greg. Fixed that when I dropped the use of atomic variables. > > > diff --git a/drivers/scsi/ufs/ufshpb.h b/drivers/scsi/ufs/ufshpb.h > > index 8a34b0f42754..b0e78728af38 100644 > > --- a/drivers/scsi/ufs/ufshpb.h > > +++ b/drivers/scsi/ufs/ufshpb.h > > @@ -115,6 +115,9 @@ struct ufshpb_region { > > /* below information is used by lru */ > > struct list_head list_lru_rgn; > > unsigned long rgn_flags; > > + > > + /* region reads - for host mode */ > > + atomic64_t reads; > I think 32 bits are suitable, because it is normalized by worker on every > specific time. Done.