svn commit: r363068 - head/sys/kern
Mateusz Guzik
mjguzik at gmail.com
Fri Jul 10 08:31:37 UTC 2020
On 7/10/20, Piotr P. Stefaniak <pstef at 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>
More information about the svn-src-all
mailing list