Re: [PATCH net-next 3/3] net/smc: optimize MTTE consumption for SMC-R buffers

From: D. Wythe

Date: Sat Jan 24 2026 - 04:26:00 EST


On Fri, Jan 23, 2026 at 06:52:55AM -0800, Christoph Hellwig wrote:
> On Fri, Jan 23, 2026 at 04:23:49PM +0800, D. Wythe wrote:
> > +static inline int smc_buf_get_vm_page_order(struct smc_buf_desc *buf_slot)
> > +{
> > +#ifdef CONFIG_HAVE_ARCH_HUGE_VMALLOC
> > + struct vm_struct *vm;
> > +
> > + vm = find_vm_area(buf_slot->cpu_addr);
> > + return vm ? vm->page_order : 0;
> > +#else
> > + return 0;
> > +#endif
>
> You might want to encapsulate this logic in a vmalloc_order or similar
> helper in vmalloc.c.

Hi Christoph,

That's a great suggestion. Encapsulating this logic into a helper like
vmalloc_page_order() (or similar) within vmalloc.c is indeed much
cleaner than exporting find_vm_area().

I'll implement this helper in V2 and use it in the SMC code. Thanks for
pointing this out!

Thanks,
D. Wythe