RE: [RFC PATCH v2 4/5] scsi: ufs: L2P map management for HPB read

From: Daejun Park
Date: Thu Jun 18 2020 - 20:20:09 EST


> > > +
> > > > +static struct ufshpb_map_ctx *ufshpb_get_map_ctx(struct ufshpb_lu
> > *hpb)
> > > > +{
> > > > + struct ufshpb_map_ctx *mctx;
> > > > + int i, j;
> > > > +
> > > > + mctx = mempool_alloc(ufshpb_drv.ufshpb_mctx_pool, GFP_KERNEL);
> > > > + if (!mctx)
> > > > + return NULL;
> > > So you use ufshpb_host_map_kbytes as the min_nr in your
> > mempool_create,
> > > But you know that you need max_lru_active_cnt x srgns_per_rgn such
> > mapping context elements.
> > > So you are
> > > a) failing to provide the slab allocator an information that you already have,
> > and
> > > b) selecting from a finite pool will assure that you'll never exceed max-
> > active-regions,
> > > even if some corner case fails your logic.
> > It was intend to provide user-configurable pre-allocated memory to reduce
> > latency due to memory allocation. The value of ufshpb_host_map_kbytes can
> > be set to max_lru_active_cnt x srgns_per_rgn, if the user want to.
> Ok, I see your point.
> It is as if you expect that a "user" will query the unit descriptors first,
> Make some calculations, and then will run modprobe with the proper value.
> Are you assuming that an "intelligent" user does all that?
>
> The reasonable scenario IMO, is that OEMs will initiate a service in their
> ramdisk/init.rc with some default value.
>
> Don't you see the damage potential in using a wrong value here?
>
I understand your scenario. I will remove module parameter and set min_nr
value of memory pool as "max_lru_active_cnt x srgns_per_rgn" size.

Thanks,
Daejun