[PATCHv2] nvme: add 'iopolicy' module parameter

Keith Busch kbusch at kernel.org
Fri Dec 17 13:24:50 PST 2021


On Fri, Dec 17, 2021 at 07:03:58PM +0100, Daniel Wagner wrote:
> On Fri, Dec 17, 2021 at 04:02:22PM +0100, Hannes Reinecke wrote:
> > +static int iopolicy = NVME_IOPOLICY_NUMA;
> > +module_param(iopolicy, int, 0444);
> > +MODULE_PARM_DESC(iopolicy,
> > +	"Default multipath I/O policy; 0 - NUMA (default), 1 - Round-robin");
> > +
> > +void nvme_mpath_default_iopolicy(struct nvme_subsystem *subsys)
> > +{
> > +	subsys->iopolicy = iopolicy;
> 
> Wouldn't make sense to check if iopolicy has a valid value too?
> 

Even better would be to ensure the iopolicy can never be invalid in the
first place. If the module param is invalid, then the sysfs attribute
for it will run off the end of the array, among other problems.

The sysfs toggle already ensures a valid iopolicy, so just need
something similar for the module parameter. You can append a callback to
the module parameter (module_param_cb) to enforce valid values only, and
I think using that would be appropriate here.



More information about the Linux-nvme mailing list