On 7/10/20, Mateusz Guzik <mjgu...@gmail.com> wrote: > 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. >
Oops, that should be: dtrace -n 'fbt::memcpy:entry,fbt::memmove:entry /arg0 == arg1/ { @[stack()] = count(); }' You can look for other abuse too, here are 0-sized calls: dtrace -n 'fbt::memcpy:entry,fbt::memmove:entry,fbt::memset:entry /arg2 == 0/ { @[probefunc,stack()] = count(); }' -- 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"