Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a way to get the internal limits for the number of events for io_setup() call on Linux?

Tags:

linux

aio

The man page for io_setup() says it will fail with EINVAL if the specified maxevents exceeds internal limits. Is there a way to find out what this "internal limit" is?

like image 559
UBA Avatar asked Nov 17 '25 13:11

UBA


1 Answers

That case is hardcoded in the kernel source, in fs/aio.c. And, it's pretty big!

    /* Prevent overflows */
    if (nr_events > (0x10000000U / sizeof(struct io_event))) {
        pr_debug("ENOMEM: nr_events too high\n");
        return ERR_PTR(-EINVAL);
    }

Typically, /proc/sys/fs/aio-max-nr is the one you need to worry about. That seems to be 65536 everywhere I've looked recently.

Source: https://github.com/torvalds/linux/blob/master/fs/aio.c

like image 93
Mike Andrews Avatar answered Nov 20 '25 03:11

Mike Andrews