]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit - sys/kern/kern_timeout.c
Micro optimise _callout_stop_safe() by removing dead code.
authorhselasky <hselasky@FreeBSD.org>
Wed, 2 Sep 2020 09:44:00 +0000 (09:44 +0000)
committerhselasky <hselasky@FreeBSD.org>
Wed, 2 Sep 2020 09:44:00 +0000 (09:44 +0000)
commit389cec385776ffa71c665539bf81d033fafa7bff
tree9f9a44c23d9116a002cace0fecf25f257dbd7539
parente1a8ce398ea55b4fff49e0c713149343910ba99a
Micro optimise _callout_stop_safe() by removing dead code.

The CS_DRAIN flag cannot be set at the same time like the async-drain function
pointer is set. These are orthogonal features. Assert this at the beginning
of the function.

Before:
        if (flags & CS_DRAIN) {
                /* FALLTHROUGH */
        } else if (xxx) {
                return yyy;
        }
        if (drain) {
                zzz = drain;
        }
After:
        if (flags & CS_DRAIN) {
                /* FALLTHROUGH */
        } else if (xxx) {
                return yyy;
        } else {
                if (drain) {
                        zzz = drain;
                }
        }

Reviewed by: markj@
Tested by: callout_test
Differential Revision: https://reviews.freebsd.org/D26285
MFC after: 1 week
Sponsored by: Mellanox Technologies // NVIDIA Networking
sys/kern/kern_timeout.c