Ditto.
And preface: I'm a lousy person to be advising on driver writing, it
often turns out that I'm making a fool of myself one way or another.
If you're very lucky, not this time!
I'd strongly recommend that do as you are already doing, not switch
over to the Infiniband method. The Infiniband drivers have to satisfy
standards that demand that userspace define the buffers, and that adds
a great deal of complexity and scope for error. Unless you have to
satisfy an external standard of that kind, let your driver define
the buffers as it already does. (From what you say later about 32kB
extents, I can't see how you could let userspace define them anyway.)
32kB, order 3. Okay, __alloc_pages will retry for those, so there's
a reasonable chance you'll be able to get them. But be aware that
asking for non-0 order pages will always place some strain on the
memory management system, no matter what anti-fragmentation measures
are taken now or in future. I take it you have a hardware constraint
that makes the smaller buffers significantly less efficient; if it's
just a software issue, then better to redesign to use 0-order pages.
Most drivers would use the same set of pages over and over again,
not have to fault each page each time it's used.
But yes, that's fine, many drivers do it like that.
That's right, vm_insert_page inserts just a single pte. We're rather
schizophrenic when we say "page", sometimes we're thinking about "a
compound page" or a "high-order page", and sometimes we're thinking
about all the component "struct page"s that make that up: confusing.
I've made a note to add such a comment there.
Oh, I've been repeating myself, have I? Scatter-gather is indeed
what we prefer to use, instead of demanding >0-order pages. But
no way can I advise you on USB URBs.
Hugh
-