From: David Howells
> Sent: Wednesday, August 16, 2023 1:08 PM
Given:
> iter->copy_mc is only used with a bvec iterator and only by
> dump_emit_page() in fs/coredump.c so rather than handle this in
> memcpy_from_iter_mc() where it is checked repeatedly by _copy_from_iter() and
> copy_page_from_iter_atomic(),
Instead of adding the extra check to every copy:
> +static __always_inline
> +size_t __copy_from_iter(void *addr, size_t bytes, struct iov_iter *i)
> +{
> + if (unlikely(iov_iter_is_copy_mc(i)))
> + return __copy_from_iter_mc(addr, bytes, i);
> + return iterate_and_advance(i, bytes, addr,
> + copy_from_user_iter, memcpy_from_iter);
> }
Couldn't the relevant code directly call __copy_frtom_iter_mc() ?
Or a version then checked iov_is_copy_mc() and then fell
back to the standard function.
David
-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)