Re: [RFC PATCH] iov_iter: Convert iterate*() to inline funcs
From: David Howells <dhowells@redhat.com>
Date: 2023-08-14 13:14:41
Also in:
linux-fsdevel, linux-mm, lkml
From: David Howells <dhowells@redhat.com>
Date: 2023-08-14 13:14:41
Also in:
linux-fsdevel, linux-mm, lkml
Linus Torvalds [off-list ref] wrote:
So I think you need to remove the changes you did to
memcpy_from_iter(). The old code was an explicit conditional of direct
calls:
if (iov_iter_is_copy_mc(i))
return (void *)copy_mc_to_kernel(to, from, size);
return memcpy(to, from, size);
and now you do that
iov_iter_is_copy_mc(i) ?
memcpy_from_iter_mc : memcpy_from_iter);
to pass in a function pointer.
Not ok. Not ok at all. It may look clever, but function pointers are
bad. Avoid them like the plague.Yeah. I was hoping that the compiler would manage to inline that, but it just does an indirect call. I'm trying to avoid passing the iterator as that makes things bigger. I think I can probably share the extra argument used for passing checksums. David