Prevent MariaDB from filling up tmpdir and hanging the system
tmp is used when mysql/mariadb engine can't use ENGINE=MEMORY for temporary tables. That happens for many reasons:


Temporary table is too big to fit into join/sort buffer. That may
be caused by too small buffers or by queries that produce too big
results due to the bad design. 
Temporary table contains text/blob fields that are not appropriate
for MEMORY engine.
Proper index(es) are missed for the query, so massive filesorts performed on the disk in the mysql/tmp dir.


Anyway as far as disk-based temp-tables are significantly slower than in-memory ones, queries that fill up the mysql/tmp dir are listed in the slow queries log along with short diagnosis.