unbound/util
Renaud Métrich d63cb99649 Changed log lock from 'quick' to 'basic' because this is an I/O lock.
We cannot use a 'quick' lock (i.e. lock spinning on the CPU) for the log
lock because it can wait a lot on I/Os. Using a 'quick' lock leads to
eating the CPU for no good reason.

Example of 'pidstat' output when using various locks for log_lock:

- 'quick' lock and slow log file system (tail -f on the log file on XFS on RHEL 8)

04:15:11 PM   UID      TGID       TID    %usr %system    %CPU CPU  Command
04:15:21 PM   998     16431         -  100.00    4.20  100.00   2  unbound
04:15:21 PM   998         -     16431   31.00    1.00   32.00   2  |__unbound
04:15:21 PM   998         -     16432   31.30    0.80   32.10   0  |__unbound
04:15:21 PM   998         -     16433   30.20    1.40   31.60   1  |__unbound
04:15:21 PM   998         -     16434   30.70    1.00   31.70   3  |__unbound

- 'quick' lock and log file system being fast

04:15:40 PM   UID      TGID       TID    %usr %system   %CPU CPU  Command
04:15:50 PM   998     16431         -   10.00    1.60  11.60   1  unbound
04:15:50 PM   998         -     16431    2.50    0.50   3.00   1  |__unbound
04:15:50 PM   998         -     16432    2.30    0.40   2.70   3  |__unbound
04:15:50 PM   998         -     16433    2.70    0.30   3.00   0  |__unbound
04:15:50 PM   998         -     16434    2.60    0.40   3.00   2  |__unbound

- 'basic' lock (this commit) and slow log file system (tail -f on the log file on XFS on RHEL 8)

04:29:48 PM   UID      TGID       TID    %usr %system   %CPU CPU  Command
04:29:58 PM   998     11632         -    7.10   14.10  21.20   3  unbound
04:29:58 PM   998         -     11632    1.70    3.20   4.90   3  |__unbound
04:29:58 PM   998         -     11633    1.60    3.30   4.90   1  |__unbound
04:29:58 PM   998         -     11634    2.00    4.10   6.10   1  |__unbound
04:29:58 PM   998         -     11635    1.90    3.50   5.40   1  |__unbound

We can see in the above example, when 'basic' lock is used, that CPU
isn't consumed when log file system is slow.

Another reproducer scenario: put the log file on a NFS share with 'sync'
option.
2019-11-26 16:32:07 +01:00
..
data - Fix Out-of-Bounds Read in dname_valid(), 2019-11-20 11:38:11 +01:00
shm_side - Fix Shared Memory World Writeable, 2019-11-20 11:13:45 +01:00
storage Fix spelling in code annotation of changes 2019-05-06 10:10:58 +02:00
alloc.c - Fix for out of bounds integers, thanks to OSTIF audit. It is in 2019-04-02 12:28:20 +00:00
alloc.h - Fix that unbound-control reload frees the rrset keys and returns 2018-05-01 14:00:06 +00:00
as112.c And document the files. 2016-02-09 13:51:35 +00:00
as112.h And document the files. 2016-02-09 13:51:35 +00:00
config_file.c - Fix python dict reference and double free in config. 2019-06-18 17:25:08 +02:00
config_file.h Merge branch 'dev/all-merged/master' of git://github.com/episource/unbound into episource-dev/all-merged/master 2019-06-18 17:07:57 +02:00
configlexer.c - The unbound.conf includes are sorted ascending, for include 2019-09-25 16:50:30 +02:00
configlexer.lex - The unbound.conf includes are sorted ascending, for include 2019-09-25 16:50:30 +02:00
configparser.c - update to bison output of 3.4.1 in code repository. 2019-11-18 10:50:54 +01:00
configparser.h - update to bison output of 3.4.1 in code repository. 2019-11-18 10:50:54 +01:00
configparser.y Merge branch 'dev/all-merged/master' of git://github.com/episource/unbound into episource-dev/all-merged/master 2019-06-18 17:07:57 +02:00
configyyrename.h Neater configure and no double config.h includes. 2009-03-24 10:42:57 +00:00
edns.c - Moved includes and make depend. 2019-01-24 16:10:05 +00:00
edns.h - Please doxygen so it passes. 2018-07-31 08:10:20 +00:00
fptr_wlist.c Add support for ipset 2019-05-02 19:43:30 +08:00
fptr_wlist.h - Can set tls authentication with forward-addr: IP#tls.auth.name 2018-04-19 12:10:05 +00:00
iana_ports.inc - iana portlist updated. 2019-11-13 11:37:06 +01:00
locks.c - Fix to rename internally used types from _t to _type, because _t 2017-01-19 10:25:41 +00:00
locks.h - Fix to rename internally used types from _t to _type, because _t 2017-01-19 10:25:41 +00:00
log.c Changed log lock from 'quick' to 'basic' because this is an I/O lock. 2019-11-26 16:32:07 +01:00
log.h - log-tag-queryreply: yes in unbound.conf tags the log-queries and 2018-11-30 09:45:37 +00:00
mini_event.c - Fix to timeval_add for remaining second in microseconds. 2019-08-01 16:48:41 +02:00
mini_event.h - Fix to rename internally used types from _t to _type, because _t 2017-01-19 10:25:41 +00:00
module.c - Expose if a query (or a subquery) was ratelimited (not src IP 2018-08-03 14:00:46 +00:00
module.h - #4140: Expose repinfo (comm_reply) to the inplace_callbacks. This 2018-08-22 10:51:13 +00:00
net_help.c - Portable grep usage for reuseport configure test. 2019-11-18 15:53:47 +01:00
net_help.h - squelch DNS over TLS errors 'ssl handshake failed crypto error' 2019-09-03 09:47:27 +02:00
netevent.c - Fix Enum Name not Used, reported by X41 D-Sec. 2019-11-20 14:22:06 +01:00
netevent.h - Initial commit for out-of-order processing for TCP and TLS. 2019-01-11 14:12:27 +00:00
random.c - Fix Bad Randomness in Seed, reported by X41 D-Sec. 2019-11-20 14:40:50 +01:00
random.h - Fix Bad Randomness in Seed, reported by X41 D-Sec. 2019-11-20 14:40:50 +01:00
rbtree.c fixes for _t changes. 2017-01-19 14:11:59 +00:00
rbtree.h layout. 2017-01-20 16:09:37 +00:00
regional.c - Fix Integer Underflow in Regional Allocator, 2019-11-20 13:00:56 +01:00
regional.h And fix #551 REGENT to COPYRIGHT HOLDER in license in file headings. 2014-02-07 13:28:39 +00:00
rtt.c - Fix for 4126 that the #define for UNKNOWN_SERVER_NICENESS can be more 2018-07-12 14:15:03 +00:00
rtt.h - spelling fixes from Igor Sobrado Delgado. 2015-11-18 14:11:46 +00:00
tcp_conn_limit.c - Fix warning on compile without threads. 2018-08-16 10:28:11 +00:00
tcp_conn_limit.h Fix comment reference to variable name in header file. 2018-08-07 12:03:46 +00:00
timehist.c please lint. 2017-04-13 13:03:38 +00:00
timehist.h - (for 1.6.3:) unbound.h exports the shm stats structures. They use 2017-04-13 12:47:29 +00:00
tube.c - Fix #3817: core dump happens in libunbound delete, when queued 2018-03-15 13:32:19 +00:00
tube.h - Fix to rename internally used types from _t to _type, because _t 2017-01-19 10:25:41 +00:00
ub_event.c - Fixes to please lint checks. 2019-11-19 12:10:03 +01:00
ub_event.h - Spelling fixes, from Phil Porada. 2017-09-15 14:29:28 +00:00
ub_event_pluggable.c - Fixes to please lint checks. 2019-11-19 12:10:03 +01:00
winsock_event.c - Fix to timeval_add for remaining second in microseconds. 2019-08-01 16:48:41 +02:00
winsock_event.h fixes for _t changes. 2017-01-19 14:11:59 +00:00