On 7/10/20, Piotr P. Stefaniak <ps...@freebsd.org> wrote:
>>       */
>>-     memcpy(sbp, &mp->mnt_stat, sizeof(*sbp));
>>+     if (sbp != &mp->mnt_stat)
>>+             memcpy(sbp, &mp->mnt_stat, sizeof(*sbp));
>>
>
> Slightly unrelated question: wouldn't it be prudent to incorporate this
> logic into memcpy?
>

Calls like that are just abusing the routine and indicate design
problems in the consumer.
Adding the branch into the routine would add overhead for everyone.

However, now that you mention it, it may be prudent to do something like this:

dtrace -n 'fbt::memcpy:entry,fbt::memmove:entry /arg1 == arg2/ {
@[stack()] = count(); }'

and run your favourite workload.

-- 
Mateusz Guzik <mjguzik gmail.com>
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to