]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
Micro optimise _callout_stop_safe() by removing dead code.
authorHans Petter Selasky <hselasky@FreeBSD.org>
Wed, 2 Sep 2020 09:44:00 +0000 (09:44 +0000)
committerHans Petter Selasky <hselasky@FreeBSD.org>
Wed, 2 Sep 2020 09:44:00 +0000 (09:44 +0000)
commit0d0053d7ed2cf9ce64915aa873285d5c3ad11541
tree9f9a44c23d9116a002cace0fecf25f257dbd7539
parent72d849c76142f00c8016fa1ba9d3e6c3eb5481c4
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