UBA
UBA

Reputation: 81

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

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?

Upvotes: 3

Views: 646

Answers (1)

Mike Andrews
Mike Andrews

Reputation: 3206

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

Upvotes: 2

Related Questions