Re: [PATCH rdma-next 2/6] RDMA/umem: Add API to find best driver supported page size in an MR

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Jan 04, 2019 at 08:18:32AM -0600, Shiraz Saleem wrote:

> > > + */
> > > +unsigned long ib_umem_find_single_pg_size(struct ib_umem *umem,
> > > +					  unsigned long supported_pgsz,
> > > +					  unsigned long uvirt_addr)
> > > +{
> > > +	struct scatterlist *sg;
> > > +	unsigned int pg_bit_sg, min_pg_bit, best_pg_bit;
> > > +	int i;
> > > +
> > > +	if (!supported_pgsz)
> > > +		return 0;
> > 
> > Maybe like:
> > 
> > if (WARN_ON(!(BIT_ULL(PAGE_SHIFT) & supported_pgsz)))
> >      return 0;

Actually this is a bit over-reaching, it should be 'driver must
support the system page size or smaller' so maybe

WARN_ON(support_pgsz & GENMASK(PAGE_SHIFT, 0) == 0)

because we can always take large pages and break them down.

Jason



[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]     [Yosemite Photos]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux