On Thu, 9 Oct 2025 at 09:22, Kiryl Shutsemau wrote: > > Objtool is not happy about calling random stuff within UACCESS. I > ignored it for now. Yeah, that needs to be done inside the other stuff - including, very much, the folio lookup. > I am not sure if I use user_access_begin()/_end() correctly. Let me know > if I misunderstood or misimplemented your idea. Close. Except I'd have gotten rid of the iov stuff by making the inner helper just get a 'void __user *' pointer and a length, and then updating the iov state outside that helper. > This patch brings 4k reads from 512k files to ~60GiB/s. Making the > buffer 4k, brings it ~95GiB/s (baseline is 100GiB/s). Note that right now, 'unsafe_copy_to_user()' is a horrible thing. It's almost entirely unoptimized, see the hacky unsafe_copy_loop implementation in . Because before this code, it was only used for readdir() to copy individual filenames, I think. Anyway, I'd have organized things a bit differently. Incremental UNTESTED patch attached. objtool still complains about SMAP issues, because memcpy_from_file_folio() ends up resulting in a external call to memcpy. Not great. I don't love how complicated this all got, and even with your bigger buffer it's slower than the baseline/ So honestly I'd be inclined to go back to "just deal with the trivially small reads", and scratch this extra complexity. Linus