On Fri, 2020-04-17 at 17:08:52 UTC, Christophe Leroy wrote: > At the time being, unsafe_copy_to_user() is based on > raw_copy_to_user() which calls __copy_tofrom_user(). > > __copy_tofrom_user() is a big optimised function to copy big amount > of data. It aligns destinations to cache line in order to use > dcbz instruction. > > Today unsafe_copy_to_user() is called only from filldir(). > It is used to mainly copy small amount of data like filenames, > so __copy_tofrom_user() is not fit. > > Also, unsafe_copy_to_user() is used within user_access_begin/end > sections. In those section, it is preferable to not call functions. > > Rewrite unsafe_copy_to_user() as a macro that uses __put_user_goto(). > We first perform a loop of long, then we finish with necessary > complements. > > unsafe_copy_to_user() might be used in the near future to copy > fixed-size data, like pt_regs structs during signal processing. > Having it as a macro allows GCC to optimise it for instead when > it knows the size in advance, it can unloop loops, drop complements > when the size is a multiple of longs, etc ... > > Signed-off-by: Christophe Leroy <christophe.le...@c-s.fr>
Applied to powerpc topic/uaccess-ppc, thanks. https://git.kernel.org/powerpc/c/17bc43367fc2a720400d21c745db641c654c1e6b cheers