Hi, Belisko Marek writes: > we're using USB RAW gadget for communicating with PC application. We > have created loopback test which send file (any size) from PC to > device and then same data are sent back to PC to verify roundtrip time > (using bulk data transfer). Everything works fine up to 3MB file size. > If we sent bigger file like e.g. 5M we can receive file on device but > when we want to write to output endpoint we got: > > WARNING: CPU: 0 PID: 12299 at /kernel-source//mm/page_alloc.c:3725 > __alloc_pages_nodemask+0x1b0/0xde4 > [] (unwind_backtrace) from [] (show_stack+0x20/0x24) > [] (show_stack) from [] (dump_stack+0x20/0x28) > [] (dump_stack) from [] (__warn+0xec/0x108) > [] (__warn) from [] (warn_slowpath_null+0x30/0x38) > [] (warn_slowpath_null) from [] > (__alloc_pages_nodemask+0x1b0/0xde4) > [] (__alloc_pages_nodemask) from [] > (kmalloc_order+0x2c/0x48) > [] (kmalloc_order) from [] (kmalloc_order_trace+0x2c/0xd4) > [] (kmalloc_order_trace) from [] (__kmalloc+0x40/0x264) > [] (__kmalloc) from [] (ffs_epfile_io+0x13c/0x570 > [usb_f_fs]) > [] (ffs_epfile_io [usb_f_fs]) from [] > (ffs_epfile_write_iter+0xc8/0x120 [usb_f_fs]) > [] (ffs_epfile_write_iter [usb_f_fs]) from [] > (new_sync_write+0xc8/0xec) > [] (new_sync_write) from [] (__vfs_write+0x3c/0x48) > [] (__vfs_write) from [] (vfs_write+0xcc/0x158) > [] (vfs_write) from [] (SyS_write+0x50/0x88) > [] (SyS_write) from [] (ret_fast_syscall+0x0/0x54) > ---[ end trace fe5f79fe415b9881 ]--- > > and write ends up with: write /run/ffs/ep1: cannot allocate memory > > When checked free command there should be plenty of available memory. > Is there some limitation when writing to endpoint? We tried to split > buffer to e.g. 3M and sent it and this works but looks like there is > penalty when sending bigger files (100MB file received in 5secs whicle > sending back it took 2minutes). Thanks for ideas and hints. that's trying to allocate a 5MiB buffer in kernel space. It just goes over max allocation size, I'm assuming. Which kernel version are you using? Which gadget controller are you using? -- balbi