Skip to content

0.30.6 #133

Merged
merged 56 commits into from
May 11, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
177f6ea
Makefile: Udpate version to 0.30.6
donald Apr 10, 2022
0ea4705
mxqset: Remove unused variable and argument
donald Apr 14, 2022
8318176
mxqset: Use initializers with designators
donald Apr 14, 2022
a67850d
tree: Add fall through annotations
donald Apr 14, 2022
0052141
mxqd: Make slots_to_start unsigned
donald Apr 14, 2022
ad98991
mx_proc: getline returns signed size type
donald Apr 14, 2022
de3553c
mxq_job: Remove unused parameter from mxq_unload_job_from_server
donald Apr 14, 2022
9328af6
mxqsub: Remove unused parameter flags from mxq_submit_task
donald Apr 14, 2022
0c35a52
mx_myqsl: Don't compare signed int and unsigned long
donald Apr 14, 2022
98e4d2c
keywordset: Match type of local variable to argument
donald Apr 14, 2022
5e3cc57
mxqd_control: Explicitly convert pid_t to unsigned
donald Apr 14, 2022
bbd0b5c
parser: Annotate unused arguments
donald Apr 14, 2022
e6edbd5
test_*: Remove unused parameters from main
donald Apr 15, 2022
421dc0c
mx_util: Simplify signature of mx_vasprintf_forever
donald Apr 15, 2022
de9849c
mxqd: Remove two functions
donald May 5, 2022
fe3c128
mx_util: Rename mx_call_external* to mx_pipe_external*
donald Apr 15, 2022
55b4c2d
mx_util: Rework mx_pipe_external_v
donald Apr 15, 2022
97057c4
mx_util: Export mx_pipe_external_v
donald Apr 15, 2022
6448ff2
mxqd: Prefer mx_pipe_external_v over mx_pipe_external
donald Apr 15, 2022
66653d0
test_mx_util: Prefer mx_pipe_external_v over mx_pipe_external_v
donald May 3, 2022
577df46
mx_util: Remove mx_pipe_external
donald May 5, 2022
da60fe7
mx_util: Rename mx_pipe_external_v to mx_pipe_external
donald May 5, 2022
0713866
mx_util: Add mx_call_external
donald Apr 15, 2022
bd856d7
test_mx_util: Add test for mx_call_external
donald May 5, 2022
4040371
helper/create-job-tmpdir: Fix typo in error path
donald May 5, 2022
06fa4f1
helper: Rename create_job_tmpdir to tmpdir-setup
donald Apr 15, 2022
40de658
tmpdir-setup: Use arguments instead of environment
donald Apr 15, 2022
84a66e4
mxqd: Do not disconnect from mysql before helper call
donald May 5, 2022
f12d171
mxqd: Sleep, when external helper failed to set up tmpdir
donald Apr 15, 2022
f752a60
Add mxq_reaper
donald Apr 20, 2022
cba234a
mxqd: Use external reaper
donald Apr 20, 2022
aaa6c77
mxqd: Rename reaper_process to exec_reaper
donald Apr 20, 2022
30cdd48
mxqd: Inline user_process into exec_reaper
donald Apr 20, 2022
eee337d
mxqd: Invert return status of init_child_process
donald Apr 20, 2022
c2f254e
mxqd: Inline init_child_process into exec_reaper
donald Apr 20, 2022
f311ae2
mxqd: Do not return status from exec_reaper
donald Apr 20, 2022
88d9aa4
mxqd: Simplify exec_reaper()
donald Apr 20, 2022
79ce67c
mxqd: Don't free() before exec() or _exit().
donald Apr 20, 2022
16aee83
mx_util: Add close_range syscall wrapper for glibc < 2.34
donald May 5, 2022
b065827
mxqd: Do not disconnect from mysql server on job start
donald Apr 20, 2022
d37ba3b
helper/tmpdir-setup: Add cleanup command
donald Apr 20, 2022
7b0d90c
mxqd: Use helper to unmount tmpdir
donald Apr 20, 2022
c89786c
mxqd: Don't let the child check status after fork
donald Apr 21, 2022
05de584
mxqd: Remove missleading logging
donald Apr 26, 2022
ebf1a1a
mxqd.c: Remove two unused variables
donald May 1, 2022
fc872f1
Makefile: Remove two obsolete warning exceptions
donald May 1, 2022
567844d
Revert "mx_util: Avoid false maybe-uninitialized warnings"
donald May 1, 2022
0663c4e
mx_util: Avoid "may be used uninitialized" warning
donald May 1, 2022
3763a09
mxqd: Remove unused "pagesize" value
donald May 2, 2022
ca89196
mxqd: Remove dead store
donald May 2, 2022
cf0f122
mxqsub: Remove dead store
donald May 2, 2022
49442f9
mx_mxql: Initialize s->func
donald May 3, 2022
3f89869
Makefile: Enable -Wextra
donald Apr 14, 2022
16b0457
Makefile: Add target to run LLVMs static analyzer
donald May 2, 2022
9640f65
tmpdir-setup: Make umount faster
donald May 5, 2022
efe43f4
mxqsub: Default tmpdir to 100G
donald May 8, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ parser.tab.o
test_parser.o
test_parser
ppidcache.o
mxq_reaper.o

mxqsub
/mxqsub.1
Expand All @@ -44,6 +45,7 @@ test_mx_log
test_mx_mysq
test_mxqd_control
test_keywordset
mxq_reaper

/web/pages/mxq/mxq
web/lighttpd.conf
Expand Down
24 changes: 18 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MXQ_VERSION_MAJOR = 0
MXQ_VERSION_MINOR = 30
MXQ_VERSION_PATCH = 5
MXQ_VERSION_PATCH = 6
MXQ_VERSION_EXTRA = "beta"
MXQ_VERSIONDATE = 2022

Expand Down Expand Up @@ -122,7 +122,7 @@ CFLAGS_MYSQL += -DMX_MYSQL_FAIL_WAIT_DEFAULT=5

CFLAGS += -g
CFLAGS += -O3
CFLAGS += -Wall
CFLAGS += -Wall -Wextra -Wno-override-init
CFLAGS += -DMXQ_VERSION=\"${MXQ_VERSION}\"
CFLAGS += -DMXQ_VERSIONFULL=\"${MXQ_VERSIONFULL}\"
CFLAGS += -DMXQ_VERSIONDATE=\"${MXQ_VERSIONDATE}\"
Expand Down Expand Up @@ -289,6 +289,13 @@ install::

########################################################################

.PHONY: scan-build

scan-build::
scan-build $(MAKE) build

########################################################################

### mx_log.h -----------------------------------------------------------

mx_log.h += mx_log.h
Expand Down Expand Up @@ -499,7 +506,6 @@ mxqd.o: CFLAGS += $(CFLAGS_MYSQL)
mxqd.o: CFLAGS += $(CFLAGS_MXQ_INITIAL_PATH)
mxqd.o: CFLAGS += $(CFLAGS_MXQ_INITIAL_TMPDIR)
mxqd.o: CFLAGS += $(CFLAGS_MXQ_FINISHED_JOBSDIR)
mxqd.o: CFLAGS += -Wno-unused-but-set-variable

clean: CLEAN += mxqd.o

Expand Down Expand Up @@ -587,7 +593,6 @@ mxqdump: mxq_job.o
mxqdump: mx_util.o
mxqdump: mx_getopt.o
mxqdump: LDLIBS += $(LDLIBS_MYSQL)
mxqdump: CFLAGS += -Wunused-function

build: mxqdump

Expand Down Expand Up @@ -656,10 +661,17 @@ build: mxqps

clean: CLEAN += mxqps

### mxqps -------------------------------------------------------------

clean: CLEAN += mxq_reaper.o mxq_reaper
build: mxq_reaper
install:: mxq_reaper
$(call quiet-install,0755,$^,${DESTDIR}${LIBEXECDIR}/mxq/mxq_reaper)

### script helper -----------------------------------------------------

install:: helper/create_job_tmpdir
$(call quiet-install,0755,$^,${DESTDIR}${LIBEXECDIR}/mxq/create_job_tmpdir)
install:: helper/tmpdir-setup
$(call quiet-install,0755,$^,${DESTDIR}${LIBEXECDIR}/mxq/tmpdir-setup)

install:: helper/gpu-setup
$(call quiet-install,0755,$^,${DESTDIR}${LIBEXECDIR}/mxq/gpu-setup)
Expand Down
2 changes: 1 addition & 1 deletion helper/create_job_tmpdir
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,6 @@ if fallocate -l ${MXQ_SIZE}G $filename; then
fi
rm $filename
else
test -e $fileame && rm $filename
test -e $filename && rm $filename
fi
exit $status
76 changes: 76 additions & 0 deletions helper/tmpdir-setup
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
#! /usr/bin/bash

usage() {
cat <<EOF >&2
usage:
$0 create JOBID SIZE UID # create SIZE GiB /dev/shm/mxqd/mnt/job/$JOBID
$0 cleanup JOBID # cleanup
EOF
exit 1
}

tmpdir=/scratch/local2/mxqd/tmp
mntdir=/dev/shm/mxqd/mnt/job

cmd_create() {
(( $# == 3 )) || usage
MXQ_JOBID=$1
MXQ_SIZE=$2
MXQ_UID=$3

filename=$tmpdir/$MXQ_JOBID.tmp
mountpoint=$mntdir/$MXQ_JOBID

umask 006
mkdir -p $tmpdir
mkdir -p $mntdir

status=1;

if fallocate -l ${MXQ_SIZE}G $filename; then
if loopdevice=$(losetup --find --show $filename); then
if mkfs.ext4 \
-q \
-m 0 \
-E nodiscard,mmp_update_interval=300,lazy_journal_init=1,root_owner=$MXQ_UID:0 \
-O '64bit,ext_attr,filetype,^has_journal,huge_file,inline_data,^mmp,^quota,sparse_super2' \
$loopdevice \
&& mkdir -p $mountpoint && mount -Odata=writeback,barrier=0 $loopdevice $mountpoint; then
rmdir $mountpoint/lost+found
status=0
fi
losetup -d $loopdevice
fi
rm $filename
else
test -e $filename && rm $filename
fi
exit $status
}

cmd_cleanup() {
(( $# == 1 )) || usage
MXQ_JOBID=$1

(
shopt -s dotglob;
rm -rf /dev/shm/mxqd/mnt/job/$MXQ_JOBID/*
umount /dev/shm/mxqd/mnt/job/$MXQ_JOBID
rmdir /dev/shm/mxqd/mnt/job/$MXQ_JOBID
) &
}

(( $# > 0 )) || usage
cmd="$1"
shift;
case "$cmd" in
create)
cmd_create "$@"
;;
cleanup)
cmd_cleanup "$@"
;;
*)
usage
;;
esac
2 changes: 1 addition & 1 deletion keywordset.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ struct keywordset {

static int find_name(struct keywordset *kws, char *name, size_t len) {
int i;
int j;
size_t j;
for ( i = 0; i < kws->used ; i++ ) {
j = 0;
while(1) {
Expand Down
13 changes: 5 additions & 8 deletions mx_mysql.c
Original file line number Diff line number Diff line change
Expand Up @@ -699,11 +699,9 @@ static int _mx_mysql_bind_string(struct mx_mysql_bind *b, unsigned int index, ch

static int _mx_mysql_bind_validate(struct mx_mysql_bind *b)
{
int i;

mx_assert_return_minus_errno(b, EINVAL);

for (i=0; i < b->count; i++) {
for (unsigned long i=0; i < b->count; i++) {
if (!(b->data[i].flags)) {
return -(errno=EBADSLT);
}
Expand Down Expand Up @@ -947,6 +945,7 @@ static int mx_mysql_statement_init(struct mx_mysql *mysql, struct mx_mysql_stmt
s = mx_calloc_forever(1, sizeof(*s));

s->mysql = mysql;
s->func = "";

do {
res = mx__mysql_stmt_init(s);
Expand Down Expand Up @@ -1015,7 +1014,6 @@ int mx_mysql_statement_fetch(struct mx_mysql_stmt *stmt)
{
struct mx_mysql_bind *r;
int res;
int col;
char *str;
int no_error = 1;

Expand Down Expand Up @@ -1044,7 +1042,7 @@ int mx_mysql_statement_fetch(struct mx_mysql_stmt *stmt)
}

r = &stmt->result;
for (col = 0; col < r->count; col++) {
for (unsigned long col = 0; col < r->count; col++) {
if (r->bind[col].buffer_type == MYSQL_TYPE_STRING) {
str = mx_calloc_forever(r->data[col].length + 1, sizeof(*str));

Expand All @@ -1063,7 +1061,7 @@ int mx_mysql_statement_fetch(struct mx_mysql_stmt *stmt)
if (!(r->data[col].is_error))
continue;

mx_log_debug("WARNING: result data returned in column with index %d was truncated. query was:", col);
mx_log_debug("WARNING: result data returned in column with index %lu was truncated. query was:", col);
mx_log_debug(" \\ %s", stmt->statement);
no_error = 0;
}
Expand Down Expand Up @@ -1165,7 +1163,6 @@ static int _mx_mysql_do_statement(struct mx_mysql *mysql, char *query, struct mx
struct mx_mysql_stmt *stmt = NULL;
unsigned long long num_rows = 0;
int res;
int cnt = 0;
char *tmpdata;

assert(mysql);
Expand Down Expand Up @@ -1196,7 +1193,7 @@ static int _mx_mysql_do_statement(struct mx_mysql *mysql, char *query, struct mx
if (result && result->count && num_rows) {
tmpdata = mx_calloc_forever(num_rows, size);

for (cnt = 0; cnt < num_rows; cnt++) {
for (unsigned long cnt = 0; cnt < num_rows; cnt++) {
res = mx_mysql_statement_fetch(stmt);
if (res < 0) {
mx_log_err("mx_mysql_statement_fetch(): %m");
Expand Down
8 changes: 3 additions & 5 deletions mx_proc.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,14 @@
#include "mx_proc.h"

static long long int get_rss_anon(pid_t pid) {
_mx_cleanup_free_ char *fname;
mx_asprintf_forever(&fname, "/proc/%d/status", pid);
_mx_cleanup_free_ char *fname = mx_asprintf_forever("/proc/%d/status", pid);
_mx_cleanup_fclose_ FILE *file = fopen(fname, "r");
if (file == NULL)
return -errno;
_mx_cleanup_free_ char *buf = NULL;
size_t n = 0;
while(1) {
size_t len = getline(&buf, &n, file);
ssize_t len = getline(&buf, &n, file);
if (len == -1)
break;
if (strncmp(buf, "RssAnon:", 8) == 0) {
Expand Down Expand Up @@ -131,15 +130,14 @@ int mx_proc_pid_stat(struct mx_proc_pid_stat **pps, pid_t pid)

int mx_proc_pid_stat_read(struct mx_proc_pid_stat *pps, char *fmt, ...)
{
_mx_cleanup_free_ char *fname = NULL;
_mx_cleanup_free_ char *line = NULL;
va_list ap;
int res;

assert(pps);

va_start(ap, fmt);
mx_vasprintf_forever(&fname, fmt, ap);
_mx_cleanup_free_ char *fname = fname = mx_vasprintf_forever(fmt, ap);
va_end(ap);

res = mx_read_first_line_from_file(fname, &line);
Expand Down
Loading