09.09.2020 11:19, Mikko Perttunen пишет: ... >>> + if (!job_data->used_mappings) >>> + return -ENOMEM; >>> + >>> + for (i = 0; i < args->num_bufs; i++) { >>> + copy_err = copy_from_user(&buf, user_bufs_ptr+i, sizeof(buf)); >> >> Whole array always should be copied at once. Please keep in mind that >> each copy_from_user() has a cpu-time cost, there should maximum up to 2 >> copyings per job. >> > > OK. BTW, do you have some reference/numbers for this or is it based on > grate-driver experience? I had numbers about 2 years ago while was profiling job submission latency using host1x-tests and for a simple jobs there was a visible difference caused by each copy_from_user(), kmalloc() and having firewall functions uninlined. Of course it wasn't critical, but it's also not difficult to optimize such things.